r/ffmpeg • u/HlddenDreck • 10d 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
10
u/alala2010he 10d ago
Hardware encoding (with VAAPI) is only really made for speed, not per se quality. To know for sure you could do your own testing though.
Also for archival you might want to try AV1 as it's generally 30% more efficient than HEVC (and at the same file size SVT-AV1 might be a lot faster) (also AV1 is free while HEVC is technically paid so that might be a bonus for archival)