2

When I run

ffmpeg -f concat -i resizedvideolist.txt -c copy concatenated_time.mp4 2>&1

it concatenates all the videos in the txt, but there is one video around halfway through that get glitched out. The audio just doesn't play for that video, but then starts playing on the next video, so it has been delayed. Then somewhere the audio managed to catch up and gets back in sync. Seems like some major corruption going on here.

I do not know how to fix this as the codec is the same as all the other vidoes, H.264, it is an mp4 like the others. The individual video file runs fine as it is, and it already is in the same timescale, because before this ffmpeg command, I ran

ffmpeg -i ./tempDownloadedMemes/$videoFileName -filter_complex 'scale=1080:-1,pad=1080:1080:(ow-iw)/2:(oh-ih)/2:0x2F2F2F' -video_track_timescale 15360 ./resizedVideos/resized_videoFileName 2>&1

To be honest I don't even know what timescale is, but I read that it needs to be the same for it to work. I deleted the video from the list, tried this same command, and the problem was gone at the same time in the video that it would have appeared. It seems like it is something to do with that one file itself. Any known issues/workarounds on concat bugs? This is very important to me. Thanks.

  • 1
    You need to show info about each input. ffmpeg -i input0 -i input1 -i input2 – llogan Apr 11 '17 at 19:10
  • Just found this answer on SO. The problem might be the call from shell_exec which might not let ffmpeg clean up memory and thus corrupt the video file. – mab Nov 14 '18 at 15:47
1

meh, I found a really hacky workaround using another concat method.

$resizedVideoList = file('resizedVideoList.txt', FILE_IGNORE_NEW_LINES);
$inputStringForConcat = "";
$concatString = "";
$concateNvalue = 0;
 foreach ($resizedVideoList as $key => $value) {
   //$limiter++;
   //if ($limiter > 2)break;
   $inputStringForConcat .= " -i ".$value;
   $concatString .= "[$key:0][$key:1]";
   $concateNvalue++;
 }
 $concatString .= " concat=n=$concateNvalue:v=1:a=1[v][a]";
  echo ("<pre>");
    print_r($inputStringForConcat);
    print_r($concatString);


 echo shell_exec("./ffmpeg $inputStringForConcat -filter_complex '$concatString' -map '[v]' -map '[a]' concatenated_time.mp4 2>&1");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.