I want to start a screen recording from a script, so I’m looking for a way to record screen via terminal.
I found the following command on r/kde
sudo ffmpeg -device /dev/dri/card0 -f kmsgrab -i - -filter:v 'hwmap=derive_device=vaapi,scale_vaapi=w=1920:h=1080:format=nv12' -codec:v h264_vaapi recording.mkv
But It gives the following error
sudo ffmpeg -device /dev/dri/card0 -f kmsgrab -i - -filter:v 'hwmap=derive_device=vaapi,scale_vaapi=w=1920:h=1080:format=nv12' -codec:v h264_vaapi recording.mkv
The whole output of the command is
ffmpeg version n6.0 Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 12.2.1 (GCC) 20230201
configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libjxl --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-opencl --enable-opengl --enable-shared --enable-version3 --enable-vulkan
libavutil 58. 2.100 / 58. 2.100
libavcodec 60. 3.100 / 60. 3.100
libavformat 60. 3.100 / 60. 3.100
libavdevice 60. 1.100 / 60. 1.100
libavfilter 9. 3.100 / 9. 3.100
libswscale 7. 1.100 / 7. 1.100
libswresample 4. 10.100 / 4. 10.100
libpostproc 57. 1.100 / 57. 1.100
[kmsgrab @ 0x560c331e6f40] Using plane 31 to locate framebuffers.
[kmsgrab @ 0x560c331e6f40] Template framebuffer is 359: 1920x1080 format 30335241 modifier 100000000000002 flags 2.
[kmsgrab @ 0x560c331e6f40] Framebuffer pixel format 30335241 is not a known supported format.
fd:: Invalid argument