[FFmpeg-user] Sync video and audio after using complex filters to blend two files

luke harrison looxonline at gmail.com
Mon Dec 19 09:24:52 EET 2016


I actually fixed my issue by including my audio processing into my complex
filter instead of trying to use a shortcut copy command with offset once
the complex filter command was done. I see that your use case is a little
different to mine but you also include your audio processing into the
complex filter. It seems as if you have an audio track from the mp3 that
spans the duration of the file at a lower volume while still maintaining
the audio from all of the other files at the input volume.

It's interesting that all of the players which are traditionally looked
down on are the ones that play without a loss of sync. Could it be that
their slack approach to decoding is actually overlooking some data within
the files? Maybe even the PTS info?

I'm very inexperienced with complex filters so I can't confirm that this
would work but perhaps try to first set the PTS info back to a zero start
point for each segment manually (audio and video), thereby removing any
input offset that they may come with. Once each video and audio stream has
a normalized PTS offset you can then concat them. Have a look at my command
up top where I normalize video using setpts=PTS-STARTPTS. There is also an
audio analog, "asetpts" which could be used to accomplish the same thing
with the audio stream of each segment. As an interesting side note the
manual for the concat filter states "For this filter to work correctly, all
segments must start at timestamp 0."

Regards,
Luke.

On Fri, Dec 16, 2016 at 6:23 AM, Luke Harrison <looxonline at gmail.com> wrote:

> Managed to fix mine. Will respond in full later.
>
> Regards,
> Luke.
>
> Sent from my iPhone
>
> > On 15 Dec 2016, at 8:56 PM, DevOfAllTrades <echarles at bostonproductions.
> com> wrote:
> >
> > I'm having a similar problem.
> >
> > This is the call I'm using:
> >
> > ffmpeg -y -r 30 -i titleCard.mp4 -i rawRecording.mp4 -i credits.mp4  -i
> > longSong.mp3 -filter_complex "[0:0][0:1][1:0][1:1][2:0][2:1]
> > concat=n=3:v=1:a=1 [concatv] [concata],
> > [3:0]aformat=sample_fmts=fltp:sample_rates=48000:channel_
> layouts=stereo,volume=0.4[quiet],
> > [concata][quiet]amerge=inputs=2[aout]" -map [concatv] -map [aout]
> -pix_fmt
> > yuv420p -c:a aac -strict -2 output.mp4
> >
> > I've tested this on a bunch of platforms, and I've found that it plays
> back
> > with no issues on Windows Media Player and the new Windows 10 Movies & TV
> > app (of all things), but not in Chrome, Quicktime, VLC, etc.
> >
> > What platform are you trying to play your output file back on? I'd be
> > curious to see if it plays with no sync issues on any platform.
> >
> >
> >
> >
> > --
> > View this message in context: http://ffmpeg-users.933282.n4.
> nabble.com/Sync-video-and-audio-after-using-complex-
> filters-to-blend-two-files-tp4678487p4678596.html
> > Sent from the FFmpeg-users mailing list archive at Nabble.com.
> > _______________________________________________
> > ffmpeg-user mailing list
> > ffmpeg-user at ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-user
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>



-- 

Kind regards,
Luke Harrison


More information about the ffmpeg-user mailing list