[FFmpeg-user] video stream out of sync

Adrian Dusa dusa.adrian at gmail.com
Tue Apr 19 10:05:19 CEST 2011

Dear ffmpeg users,

I'm a newbie, so trying to be both short and clear.
Working under Kubuntu 10.1 Maverick, I have an X11 grab and an
external mp3 audio file, the task being to merge both into an .avi
file of reasonable dimensions (say 2MB per minute).

Steps done:
-- grab the video stream:
ffmpeg -f x11grab -s 816x816 -i :0.0+407x162 -r 15 -vcodec libx264
-vpre lossless_ultrafast -threads 0 blahvideo.mkv

-- cut the video stream from moment X till moment Y (in order to match
the audio stream length):
ffmpeg -i blavideo.mkv -ss 00:00:XX -t 00:0Y:YY.YY -r 15 -vcodec
libx264 -vpre lossless_ultrafast -threads 0 blahcut.mkv

-- merge them together:
ffmpeg -i blahcut.mkv -i blahaudio.mp3 -acodec copy -vcodec libxvid
-qscale 5 -b 2k -r 15 -f avi bla.avi

The final result is quite satisfactory in terms of video quality, but
towards the end the video stream gets desynced behind the audio stream
with about 1 second every 5 minutes. Could you please advice what I
could do in order to avoid this?

Thanks very much, this is a great software,

More information about the ffmpeg-user mailing list