View Full Version : FFmpeg and h264_vaapi


desktop_ready
3rd August 2020, 20:19
Hello,

Not sure if this is the right forum.
I have an Intel CPU and I wanted to use hardware acceleration to encode videos in H.264.

Without the hardware acceleration, I am currently having good results with the veryslow preset (which is using CRF 23 I believe):
ffmpeg -i <input> -acodec aac -vcodec libx264 -preset veryslow -y <output>

With the hardware acceleration, I can use:
ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i <input> -acodec aac -vcodec h264_vaapi -b:v 6M -y <output>

As you can see, I manually specified the bitrate (6M) which does not result in the same quality as using CRF.

Is there any way I can improve the quality of the results without messing too much with the parameters depending on the video ?

Thanks

Blue_MiSfit
3rd August 2020, 22:00
Hardware accelerated H.264 encoding will generally need many more bits per frame to match x264 quality, especially if veryslow is your reference.

stax76
4th August 2020, 06:38
Hardware accelerated H.264 encoding will generally need many more bits per frame to match x264 quality, especially if veryslow is your reference.

It would be interesting to know how many percent more bits hw encoding needs in general to match quality of software encoding.

desktop_ready
4th August 2020, 20:02
Basically I am just looking for a general purpose command-line which can be applicable for all kind of videos.
The preset veryslow is working very well for that purpose.
I am a bit lost with h264_vaapi.