[FFmpeg-user] A/V synchronization problems

Andy Young Andy.Young at bbcspp.com
Fri Sep 5 17:05:21 CEST 2014

>I have a problem with A/V synchronization when the source signal is
>disturbed. I am using the following command for transcoding my video:
>ffmpeg -y -probesize 6000000 -threads 1 -i $filename -vf scale=256:144 -b:v
>192k -acodec libmp3lame -b:a 128k -ac 1 -af aresample=async=1000 -ss 0
>-threads 1 -t 3720 -f avi $filename.avi
>(I grabbed part of the stream with wget, and it is available on
>https://docs.google.com/file/d/0B86ie_Sd0O9jRlNnYkU5SlkwNnM if you would
>like to play with it on your own, but this is big file, 1.6GB)
>At the beginning of the file the synchronization is OK, but after any
>disturbance the audio is going away from video. It is clearly visible that
>about 20 minute of the file the synchronization is broken.
>I was trying also with -vsync otions, but it was even worse, or maybe I
>haven't used them in proper way.
>Is this possible to make this better? Could you please help me with this
>problem? Thank you!

I had a look and I think it's just that AVI is not able to store the sync information. It's a really outdated container format, and when I used to use it I seem to recall all sorts of problems with AV sync.

Just trying Matroska fixes things and you get a better quality encode as it defaults to x264 instead of MPEG4 for that container format.

I just changed your command a little but didn't seek to improve it, just fix the xync issue. Presumably you wish to keep the bitrate and frame size very low for a reason.

ffmpeg -fflags +genpts -i ${filename} -vf scale=256:144 -b:v 192k -acodec libmp3lame -b:a 128k -ac 1 -f matroska $filename.mkv

The whole file stays in sync right through to the end in that container format. Take that as a starting point and play from there ...


Andy Young.


This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately.
Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.


More information about the ffmpeg-user mailing list