[FFmpeg-user] How to reduce frame drops while screen grabbing

Ulf Zibis Ulf.Zibis at CoSoCo.de
Wed Oct 4 03:27:30 EEST 2023


Hi,

I have experienced ~11 % dropped frames while screen grabbing, see below.

When I used simplescreenrecorder [1], which also uses FFmpeg libraries under the hood, I had less than 1 % frame drops with the parameters "vcodec=libx264rgb,crf=0,preset=ultrafast" and the same dimensions.
[1] https://www.maartenbaert.be/simplescreenrecorder/

So I'm wondering, if there are additional parameters, which could reduce the frame drops when using the "naked" ffmpeg command line tool.

$ ffmpeg -t 02:15:00 -video_size 1280x688 -framerate 24 -f x11grab -i :0.0+2,235 -c:v libx264rgb -crf 0 -preset ultrafast Ohne_Ton_2.mkv
ffmpeg version 5.1.1-1ubuntu2.1 Copyright (c) 2000-2022 the FFmpeg developers
   built with gcc 12 (Ubuntu 12.2.0-3ubuntu1)
   configuration: --prefix=/usr --extra-version=1ubuntu2.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librist --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid 
--enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --disable-sndio --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-shared
   libavutil      57. 28.100 / 57. 28.100
   libavcodec     59. 37.100 / 59. 37.100
   libavformat    59. 27.100 / 59. 27.100
   libavdevice    59.  7.100 / 59.  7.100
   libavfilter     8. 44.100 /  8. 44.100
   libswscale      6.  7.100 /  6.  7.100
   libswresample   4.  7.100 /  4.  7.100
   libpostproc    56.  6.100 / 56.  6.100
[x11grab @ 0x56159829c940] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, x11grab, from ':0.0+2,235':
   Duration: N/A, start: 1696294511.936851, bitrate: 676331 kb/s
   Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1280x688, 676331 kb/s, 24 fps, 1000k tbr, 1000k tbn
Stream mapping:
   Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264rgb))
Press [q] to stop, [?] for help
[libx264rgb @ 0x5615982a94c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1 Cache64
[libx264rgb @ 0x5615982a94c0] profile High 4:4:4 Predictive, level 3.1, 4:4:4, 8-bit
[libx264rgb @ 0x5615982a94c0] 264 - core 164 r3095 baee400 - H.264/MPEG-4 AVC codec - Copyleft 2003-2022 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=0 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=0 chroma_qp_offset=0 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=24 scenecut=0 intra_refresh=0 rc=cqp mbtree=0 qp=0
Output #0, matroska, to 'Ohne_Ton_2.mkv':
   Metadata:
     encoder         : Lavf59.27.100
   Stream #0:0: Video: h264 (H264 / 0x34363248), bgr0(progressive), 1280x688, q=2-31, 24 fps, 1k tbn
     Metadata:
       encoder         : Lavc59.37.100 libx264rgb
     Side data:
       cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
frame=173312 fps= 21 q=-1.0 Lsize=58222239kB time=02:15:00.04 bitrate=58883.2kbits/s dup=0 drop=21087 speed=   1x
video:58220717kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.002614%
[libx264rgb @ 0x5615982a94c0] frame I:694   Avg QP: 0.00 size:785992
[libx264rgb @ 0x5615982a94c0] frame P:172618 Avg QP: 0.00 size:342215
[libx264rgb @ 0x5615982a94c0] mb I  I16..4: 100.0%  0.0%  0.0%
[libx264rgb @ 0x5615982a94c0] mb P  I16..4: 35.2%  0.0%  0.0% P16..4: 25.8%  0.0%  0.0%  0.0%  0.0%    skip:39.0%
[libx264rgb @ 0x5615982a94c0] coded y,u,v intra: 50.0% 50.1% 51.3% inter: 33.1% 32.7% 33.1%
[libx264rgb @ 0x5615982a94c0] i16 v,h,dc,p: 73% 27%  0%  0%
[libx264rgb @ 0x5615982a94c0] kb/s:58881.38

-Ulf



More information about the ffmpeg-user mailing list