Bug 282862

Summary: Recoding a video using multimedia/ffmpeg + vaapi creates too large files
Product: Ports & Packages Reporter: shamaz.mazum
Component: Individual Port(s)Assignee: freebsd-multimedia (Nobody) <multimedia>
Status: New ---    
Severity: Affects Only Me Flags: bugzilla: maintainer-feedback? (multimedia)
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   

Description shamaz.mazum 2024-11-19 13:04:14 UTC
Hi. When recoding a video with GPU acceleration, an output has too big size despite quality settings (about 1 GB per minute), but the video itself is OK. How to reproduce (be sure not to run to completion!):

ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format -i input.mp4 -c:a copy -c:v hevc_vaapi -qp 20 output.mp4

hevc_vaapi can be replaced with h264_vaapi as well.

System info:
FreeBSD 14.1-RELEASE-p6
sway 1.10
ffmpeg 6.1.2_5,1
mesa-dri/-libs/-gallium-va 24.1.7
libva(-utils) 2.22.0

Video card:
AMD Radeon RX 6600 XT
drm-61-kmod 6.1.92_2
gpu-firmware-amd-kmod-dimgrey-cavefish 20230625_2

vainfo output:
vasily@vonbraun:~ % vainfo
Trying display: wayland
libva info: VA-API version 1.22.0
libva info: Trying to open /usr/local/lib/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_1_22
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.22 (libva 2.22.0)
vainfo: Driver version: Mesa Gallium driver 24.1.7 for AMD Radeon RX 6600 XT (radeonsi, navi23, LLVM 15.0.7, DRM 3.49, 14.1-RELEASE-p6)
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
      VAProfileHEVCMain10             :	VAEntrypointEncSlice
      VAProfileJPEGBaseline           :	VAEntrypointVLD
      VAProfileVP9Profile0            :	VAEntrypointVLD
      VAProfileVP9Profile2            :	VAEntrypointVLD
      VAProfileAV1Profile0            :	VAEntrypointVLD
      VAProfileNone                   :	VAEntrypointVideoProc
Comment 1 shamaz.mazum 2024-11-19 13:34:12 UTC
Update: My another computer which runs FreeBSD 14.1-RELEASE-p4 (all ports have the same versions as on the first computer) and has an integrated Vega 8 card does the job fine, but ffmpeg produces additional output:

Warning: Obsolete rate control is being used due to outdated VCN firmware on system.
Updating VCN firmware is highly recommended.

So I guess the difference is in the hardware.