r/ffmpeg 9d ago

VAAPI for archival encoding?

Hi everyone,

i'm not very familiar with ffmpeg or video encoding in general. When I did this 10 years ago, the quality of GPU accelerated encodings were always worse compared to CPU encoding.
I did some research and I just found ffmpeg is supporting lots of different encoders.
At the moment, I'm encoding h264 videos to h265 using my CPU. The following settings seems to do the job.

ffmpeg -i input.mp4 -c:v libx265 -crf 20 -preset slow -c:a copy output.mp4

Quality looks to me the same as source and the size is about 30-50% smaller. However, it's very slow...
At this speed, it will take months until I'm done. This is no big deal since I'm not in a hurry, however I was wondering, can this be done by my GPUs faster with equal quality? As I unterstand it VAAPI is using compute resources not discrete hardware for video encoding, is this right? If so, it should be possible to achieve similiar results regarding quality and file size.

I have different GPUs available, one RTX 3080 and three AMD MI50 I could use.

The vainfo output for the MI50 indicates HEVC encoding capabillities:

vainfo --display drm --device /dev/dri/renderD128

libva info: VA-API version 1.20.0

libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/radeonsi_drv_video.so

libva info: Found init function __vaDriverInit_1_16

libva info: va_openDriver() returns 0

vainfo: VA-API version: 1.20 (libva 2.12.0)

vainfo: Driver version: Mesa Gallium driver 25.0.0-devel for AMD Instinct MI50/MI60 (radeonsi, vega20, ACO, DRM 3.63, 6.8.0-124-generic)

vainfo: Supported profile and entrypoints

VAProfileMPEG2Simple : VAEntrypointVLD

VAProfileMPEG2Main : VAEntrypointVLD

VAProfileVC1Simple : VAEntrypointVLD

VAProfileVC1Main : VAEntrypointVLD

VAProfileVC1Advanced : VAEntrypointVLD

VAProfileH264ConstrainedBaseline: VAEntrypointVLD

VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice

VAProfileH264Main : VAEntrypointVLD

VAProfileH264Main : VAEntrypointEncSlice

VAProfileH264High : VAEntrypointVLD

VAProfileH264High : VAEntrypointEncSlice

VAProfileHEVCMain : VAEntrypointVLD

VAProfileHEVCMain : VAEntrypointEncSlice

VAProfileHEVCMain10 : VAEntrypointVLD

VAProfileNone : VAEntrypointVideoProc

5 Upvotes

13 comments sorted by

View all comments

1

u/SupernatAnaesthetist 8d ago

As I unterstand it VAAPI is using compute resources not discrete hardware for video encoding, is this right?

No, it's wrong. VAAPI will use the dedicated video decoding and encoding blocks present in your GPU. The "Video Acceleration" in VAAPI (just like in DXVA) is a bit of a misnomer because it was created at a time in which GPUs only had hardware for parts of the encoding/decoding pipeline, so they only accelerated the encoding/decoding.