Opened 5 years ago

Closed 4 years ago

#8196 closed defect (needs_more_info)

ffmpeg X11 grab video too fast

Reported by: fld Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords: x11grab
Cc: safinaskar@mail.ru Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

This issue appears only from time to time grabbing X11 displays in an automated process running inside docker images.

This is the command line we use:

% ffmpeg -y -thread_queue_size 512 -f pulse -i pa.monitor -f x11grab -r 30 -video_size 1280x720 -draw_mouse 0 -i 127.0.0.1:1 -filter:v setpts=N/FRAME_RATE/TB -filter:a asetpts=(SR-4)/SR*N/SR/TB -codec:v libx264 -preset veryfast -tune film -pix_fmt yuv420p -threads 3 -y -framerate 30 -codec:a aac -movflags +faststart -shortest out.mp4

Most of the time (>99%) the video and audio are ok.
But from time to time, we have a video that appears like being 2x and audio is at normal speed

During that capture, the ffmpeg logs show something like :

frame=  645 fps= 13 q=29.0 size=    2304kB time=00:00:20.84 bitrate= 905.7kbits/s speed=0.43x

while usually we have:

frame=  638 fps= 30 q=29.0 size=    1536kB time=00:00:20.60 bitrate= 610.7kbits/s speed=0.972x

(see difference in bitrate and speed)

Unfortunately I haven't managed to reproduce it manually and cannot provide any of the impacted video files.

Any idea what could be causing this and how to avoid it? Or what kind of debug option I can use to try to troubleshoot it?

Change History (4)

comment:1 by Carl Eugen Hoyos, 5 years ago

Component: ffmpegundetermined
Keywords: bitrate speed removed
Version: 4.0.4unspecified

To make this a valid ticket please test current FFmpeg git head and provide the command line you tested together with the complete, uncut console console output showing the issue.

comment:2 by Askar Safin, 4 years ago

I got similar problem one time. I captured screen using x11grab, output video had mostly correct fps, but there are fragments with unusually high fps. It turned out that such fragments follow periods when my computer is in suspend mode. So my guess is so: when computer is suspended, ffmpeg is unable to capture frames, and when the computer wakes up, ffmpeg tries to "catch up" and thus temporary raises fps. If I remember correctly I fixed this by replacing "-r NUMBER" with "-framerate NUMBER"

comment:3 by Askar Safin, 4 years ago

Cc: safinaskar@mail.ru added

comment:4 by Carl Eugen Hoyos, 4 years ago

Resolution: needs_more_info
Status: newclosed
Note: See TracTickets for help on using tickets.