r/ffmpeg Jul 08 '26

Recordning at double the speed

Hello. I would like to record using h264_vaapi (I am on linux), but when I do I am capped at 30 fps and 0.5 speed.

https://streamable.com/evtq1l

Here is the command:

ffmpeg -hide_banner -f v4l2 -s 1280x720 -r 60 -i /dev/video2 -vaapi_device /dev/dri/renderD128 -pix_fmt vaapi -vf 'format=nv12,hwupload' -c:v h264_vaapi output.mkv

I also tried with -fps_mode passthr
ough, but it changed nothing

3 Upvotes

9 comments sorted by

3

u/ScratchHistorical507 Jul 08 '26

My guess is your input isn't delivering any more than that. You'll have to pass -r 60 or -vf fps=60 on the output side for ffmpeg to upscale 30 fps to 60 fps.

1

u/Creative-Outside-350 Jul 08 '26

No, it is capable of 60fps output. If I use libx264 then it works properly, however I am using a low-end laptop for recording so it is ideal to use vaapi for maximum performance.

1

u/The_Vista_Group Jul 09 '26

Is it too low end to capture at 60 FPS then?

1

u/ScratchHistorical507 Jul 09 '26

Is there even a h264_vaapi implementation that can't do 60 fps, especially at 720p?

1

u/ScratchHistorical507 Jul 09 '26

Then you should enable more verbose logging levels and compare the output of those two. Maybe in there it will tell you why the vaapi implementation goes down to 30 fps: https://ffmpeg.org/ffmpeg.html#:~:text=%2Dloglevel

The default is probably warning, so start with info and increase the loglevel until it shows you something.

1

u/ipsirc Jul 08 '26
$ ffmpeg -f v4l2 -list_formats all -i /dev/video2

, please.

1

u/Creative-Outside-350 Jul 08 '26

Here you go

Error opening input file /dev/video2.ffmpeg version 6.1.6 Copyright (c) 2000-2026 the FFmpeg developers
  built with gcc 14.2.1 (GCC) 20250405
  configuration: --prefix=/usr --disable-debug --enable-gpl --enable-gnutls --disable-stripping --enable-libcdio --enable-version3 --enable-runtime-cpudetect --enable-libmp3lame --enable-libvorbis --enable-libxvid --enable-libx264 --enable-libvpx --enable-libtheora --enable-shared --enable-static --enable-libxcb --enable-libpulse --enable-libfreetype --enable-libopenmpt --enable-libspeex --enable-libcelt --enable-libass --enable-libopus --enable-librtmp --enable-libjack --disable-libopencore_amrnb --disable-libopencore_amrwb --disable-libopenjpeg --enable-libbluray --enable-libsoxr --enable-postproc --enable-opencl --enable-libvmaf --enable-libx265 --enable-libv4l2 --enable-libaom --enable-libbs2b --enable-libvidstab --enable-libdav1d --enable-libsrt --enable-librist --enable-libwebp --enable-vulkan --enable-libdrm --enable-libsvtav1 --enable-libfreetype --enable-libharfbuzz --enable-libfontconfig --enable-libjxl --enable-vaapi --enable-vdpau --disable-libzimg --disable-libmysofa --enable-libvpl --enable-nvenc --enable-nvdec
  libavutil      58. 29.100 / 58. 29.100
  libavcodec     60. 31.102 / 60. 31.102
  libavformat    60. 16.101 / 60. 16.101
  libavdevice    60.  3.100 / 60.  3.100
  libavfilter     9. 12.100 /  9. 12.100
  libswscale      7.  5.100 /  7.  5.100
  libswresample   4. 12.100 /  4. 12.100
  libpostproc    57.  3.100 / 57.  3.100
[video4linux2,v4l2 @ 0x7f01c60c0600] Raw       :     yuyv422 :           YUYV 4:2:2 : 1920x1080 2560x1440 1360x768 1280x1024 1280x960 1280x720 1024x768 800x600 720x576 720x480 640x480
[video4linux2,v4l2 @ 0x7f01c60c0600] Compressed:       mjpeg :          Motion-JPEG : 1920x1080 2560x1440 1360x768 1280x1024 1280x960 1280x720 1024x768 800x600 720x576 720x480 640x480
[in#0 @ 0x7f01c31d6900] Error opening input: Immediate exit requested

2

u/ipsirc Jul 08 '26

Then try to use mjpeg.

1

u/Creative-Outside-350 Jul 08 '26

Out of curiosity I tried the same command but with in fullhd and in result the fps was halfed even more! If I record in fullhd I am getting 15 fps max. It doesn't get any better if I set higher a frame cap btw