0

I want to concat two videos together but in doing so, the second video is being stretched. Here is my code

$command = "ffmpeg -i ../unprocessed/{$temp_name} -vf \"[in]drawtext=fontsize=47:fontcolor=white:fontfile='../fonts/Nunito/nunito.ttf':text='{$name}':x=10:y=(h) - 120, drawtext=fontsize=35:fontcolor=white:fontfile='../fonts/Amiri/amiri.ttf':text='{$second}':x=10:y=(h) - 80, drawtext=fontsize=30:fontcolor=white:fontfile='../fonts/Amiri/amiri.ttf':text='{$hospital}':x=10:y=(h-40)[out]\" -y ../unprocessed/{$edited}";
    system($command);
    unlink("../unprocessed/{$temp_name}");

    $video_1 = $_POST["video1"];
    $video_2 = $edited;

    try{

      //generating intermediate files
      $intermediate1 =  "intermediate".rand(100000, 1000000000).rand(100000, 1000000000).".mpg";
      $command = "ffmpeg -i ../unprocessed/{$edited} -qscale 0 -r 25 ../unprocessed/{$intermediate1}";
      system($command);
      unlink("../unprocessed/{$edited}");

      $intermediate2 =  "intermediate".rand(100000, 1000000000).rand(100000, 1000000000).".mpg";
      $command = "ffmpeg -i ../admin/videos/{$video_1} -qscale 0 -r 25 ../unprocessed/{$intermediate2}";
      system($command);

      $outputfile_temp = "upload".rand(100000, 1000000000).rand(100000, 1000000000).rand(100000, 1000000000).".mp4";

      $command = "ffmpeg -i \"concat:../unprocessed/{$intermediate1}|../unprocessed/{$intermediate2}\" -c copy ../merged_videos/{$outputfile_temp}";
      system($command);
      unlink("../unprocessed/{$intermediate1}");
      unlink("../unprocessed/{$intermediate2}");

      $outputfile = "upload".rand(100000, 1000000000).rand(100000, 1000000000).rand(100000, 1000000000).".mp4";
      $command = "ffmpeg -i ../merged_videos/{$outputfile_temp} ../merged_videos/{$outputfile}";
      system($command);
      unlink("../merged_videos/{$outputfile_temp}");
mchawre
  • 10,744
  • 4
  • 35
  • 57
Xnox
  • 1
  • 1
    Try to shorten your code and eliminate extra code to show your problem only. – Nabzi Jul 25 '20 at 07:24
  • Since this is just an issue involving ffmpeg usage you can remove all of the PHP code which is superfluous and in the way. Show the actual ffmpeg commands being executed and the complete log for each command. Only once you get ffmpeg working then you should add it to your code. – llogan Jul 25 '20 at 19:54

0 Answers0