[FFmpeg-user] vaapi_h264 encoding very low bitrate

Mark Thompson sw at jkqxz.net
Wed Jan 20 15:07:39 EET 2021

On 19/01/2021 16:07, owen s wrote:
> I am running this command with
> ffmpeg -y -loglevel debug \
> -vaapi_device /dev/dri/renderD128 \
> -loop 1 -r 1 -i ./image.jpg -pix_fmt vaapi_vld \
> -b:v 18000k -minrate 18000k \
> -vf 'format=nv12|vaapi,hwupload,scale_vaapi=w=1280:h=720' \
> -rc_mode 3 \
> -r 30 -g 60 \
> -c:v h264_vaapi -f flv /dev/null
> I am getting high encoding speed of greater than 3x but the bitrate is
> terrible 350Kbits/s
> Why is that when I can get better encoding speeds using cpu? log file
> http://0x0.st/-i2j.txt

Given that you're encoding the same image repeatedly, most of the frames will be a trivial "this frame is the same as the previous one" which can be signalled with very few bits.

If you want to push the bitrate up then either don't use the same frame repeatedly as input or decrease the gop size (-g option) so that it is forced to intra-code more frames (I would guess that at -g 1 it will probably be able to hit the 18M target).

- Mark

More information about the ffmpeg-user mailing list