[FFmpeg-user] Stuck on adelay/amix sync problem..
Paul B Mahol
onemda at gmail.com
Tue Dec 19 10:36:33 EET 2017
On 12/19/17, Mark Corner <mcorner at gmail.com> wrote:
> I am having trouble with amix producing different results with different
> input orders and only one input to amix staying in sync with the video.
> I am starting with three video and three audio files, vp8 and opus
> encoded. There is a video and audio that go together and are about 32
> minutes long. Then there are two pairs of audio and video, each about 16
> minutes long.
> First I combine the three videos using an overlay:
> ffmpeg -y -itsoffset 0 -i
> sed.mkv -itsoffset 2.364 -i
> essed.mkv -itsoffset 983.503 -i
> processed.mkv -filter_complex
> "pad=iw*2:ih[t0];[t0]overlay=W/2:0[t1];[t1]overlay=0:0[t2]" -map
> -an -c:v libvpx -crf 23 -b:v 1M -cpu-used 3 -threads 8
> That works fine.
> Then I combine the audio (this is where the problem is):
> ffmpeg -y -i
> -i /tmp/RM359a097bf45
> 9c327e34954525862d2b7/RTb5d9c3c0a59e98061159ddb310587b71 -i
> 764b5fda55a4dcd23cfed673d -filter_complex
> 25[t2];[t2][t1][t0]amix=inputs=3" -strict -2 -c:a libopus
> And then merge the audio and video together:
> ffmpeg -y -i /tmp/RM359a097bf459c327e34954525862d2b7/output_audio.mka -i
> /tmp/RM359a097bf459c327e34954525862d2b7/output_video.webm -c:v copy -c:a
> copy /tmp/RM359a097bf459c327e34954525862d2b7/full.webm
> The problem is that the audio and video are only in sync for what ever is
> first in the amix filter.... So in the above example, the t2 audio input
> will be in sync, but not the t1 or t0. If I change the order to something
> like [t1][t2][t0], then the t1 audio is in sync, but none of the others.
> In fact the length of the output_audio.mka will differ based on the order
> of inputs to amix.... As far as I understand, the order to amix shouldn't
> matter at all.
> Thanks for any advice you can offer.
Perhaps you need to use asetpts filter after each adelay to reset pts
to sane value?
More information about the ffmpeg-user