0

As a follow-up on Video concatenation puts sound out of sync, I have 6 video clips where the audio is 200 ms shorter than the video. The last clip has a chair banging on the floor and serves to measure the total misalignment in the concatenation.

I tried concatenating them simply with:

ffmpeg -safe 0 -f concat -i files_to_combine -vcodec copy -acodec copy temp.MOV

where files_to_combine contains a list of the files in format file ./DSC_0013.MOV for example. The result is 0.5 seconds of misalignment.

I also tried trimming each clip to the shortest stream with:

ffmpeg -i DSC_0013.MOV -map 0 -c copy \
  -fflags +shortest -max_interleave_delta 0 DSC_0013_trimmed.MOV

before concatenating them as above. The results is 0.08 seconds of misalignment. I also tried increasing the value of -max_interleave_delta, with similar results.

With iMovie, the concatenation of audio and video is perfectly aligned.

How can I trim and concatenate the clips with FFMPEG so they concatenate as cleanly as with iMovie?

1

In the process of submitting a bug report, I tested the same input samples on the nightly build of FFMPEG of 11 February 2020, which fixed the problem. That nightly build had version:

ffmpeg version git-2020-02-11-f15007a

To install a nightly build, I suggest using the compiled binaries from Zeranoe. Beginners should choose "Static" libraries, which includes the required libraries in the build.

I suspect that the problem is due to the input samples being slices of an hour-long footage, which is longer than the EU restriction on camcorders. Using the nightly build avoids this case of sound and video out of sync even with shortest clip trimming.

For the EU restriction, see Filesystem that records longer than 4 GiB, or one hour without interruption or Why is there a limit restriction to the 1080p film video?.

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.