[FFmpeg-user] Audio/Video slowly desync while using ffmpeg's x11grab

Kody Kurtz kody.j.kurtz at gmail.com
Sun Feb 10 08:46:35 CET 2013


I'm trying to capture some gameplay footage from video games for purposes
of review and commentary, and to do this, I am using ffmpeg's x11grab tool.
When I go to capture the footage, everything starts out recording properly
synced, but as the video goes on, the audio slowly drifts behind the video
by several seconds. While I'm capturing, ffmpeg reports no dropped frames,
and I don't see any during playback, so that does not appear to be the
cause of my problem. My CPU usage while recording is 50%, and that's
accounting for both CPU usage from the game itself and CPU usage from
capturing the video and audio, so I doubt that could be the cause, either.

The command I use to capture is

ffmpeg -f alsa -ac 2 -i pulse -f x11grab -r 30 -s 640x480 -i :0.0+256,256
-acodec pcm_s16le -vcodec libx264 -crf 0 -preset ultrafast -threads 0 -y

and a video demonstrating the issue I am having can be found at


I thank anyone who can assist me in advance.


More information about the ffmpeg-user mailing list