[FFmpeg-user] Choppy video when recording/streaming desktop/games with mesa drivers if i set fps below 60

KoreanFanOfficial koreanfanofficial at gmail.com
Thu Apr 21 19:01:41 EEST 2022


I got choppy video when recording desktop with mesa drivers with fps below
60. With code like this i got choppy video:
ffmpeg -y -r 25 -window_id 0x540002e -vaapi_device /dev/dri/renderD128 -f
x11grab -i :0 -f alsa -i default -c:v h264_vaapi -vf
"hwupload,scale_vaapi=1280:720:format=nv12" -b:v 2500k -maxrate 2500k
-minrate 2500k -bufsize 3750k -c:a mp3 -b:a 128k -f flv 3.flv

ffmpeg -y -r 25 -window_id 0x560002e -vaapi_device /dev/dri/renderD128 -f
x11grab -i :0 -f alsa -i default -c:v h264 -vf
"hwupload,scale_vaapi=1280:720:format=nv12,hwdownload,format=yuv420p"
-preset ultrafast -b:v 2500k -maxrate 2500k -minrate 2500k -bufsize 3750k
-c:a mp3 -b:a 128k -f flv 3.flv

ffmpeg -y -r 25 -window_id 0x560002e -f x11grab -i :0 -f alsa -i default
-c:v h264 -vf "scale=1280:720,format=yuv420p" -preset ultrafast -b:v 2500k
-maxrate 2500k -minrate 2500k -bufsize 3750k -c:a mp3 -b:a 128k -f flv 3.flv

But if i use amdgpu-pro drivers with those codes for record i got perfect
video, no choppy. I also tested amf encoder with vaapi accel and there were
no choppy video.

But with mesa drivers, if i set fps 60 or more i got video without
chopping, but 60 fps or more eat more resources.
If i set fps with framerate command instead of r then i got same results or
xorg can crash and i will be logged out of system and stuck in logscreen or
i can got choppy video with 1-2 fps.
Please, help me.
System: debian,ubuntu,arch,manjaro
video:amd card


More information about the ffmpeg-user mailing list