<p>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:</p>

<pre>
ffmpeg version git-2020-02-11-f15007a
</pre>

<p>To install a nightly build, I suggest using the compiled binaries from <a href="https://ffmpeg.zeranoe.com/builds/" rel="nofollow noreferrer">Zeranoe</a>. Beginners should choose "Static" libraries, which includes the required libraries in the build.</p>

<p>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.</p>

<p>For the EU restriction, see <a href="https://video.stackexchange.com/questions/28738/filesystem-that-records-longer-than-4-gib-or-one-hour-without-interruption/28740#28740">Filesystem that records longer than 4 GiB, or one hour without interruption</a> or <a href="https://photo.stackexchange.com/questions/14563/why-is-there-a-limit-restriction-to-the-1080p-film-video-recording-time-duration">Why is there a limit restriction to the 1080p film video?</a>.</p>

CC BY-SA 4.0
2020-02-23T16:28:07.920Z
2020-03-10T09:24:18.333Z
2020-03-10T09:24:18.333Z
emonigma
<p>As a follow-up on <a href="https://video.stackexchange.com/questions/27887/video-concatenation-puts-sound-out-of-sync?noredirect=1#comment38725_27887">Video concatenation puts sound out of sync</a>, 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.</p>

<p>I tried concatenating them simply with:</p>

<pre><code>ffmpeg -safe 0 -f concat -i files_to_combine -vcodec copy -acodec copy temp.MOV
</code></pre>

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

<p>I also tried trimming each clip to the shortest stream with:</p>

<pre><code>ffmpeg -i DSC_0013.MOV -map 0 -c copy \
  -fflags +shortest -max_interleave_delta 0 DSC_0013_trimmed.MOV
</code></pre>

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

<p>With iMovie, the concatenation of audio and video is perfectly aligned.</p>

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

<ffmpeg><sync>
FFMPEG is not trimming the audio to the length of the video
emonigma
# FFMPEG is not trimming the audio to the length of the video

(Asked by: username_0 on 2019-10-06)

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?

**Tags:** ffmpeg, sync


---

## 1 answers

### Answer by username_0 on 2020-02-23. Score: 1 | Accepted answer

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?.


---

