[Cin] Custom built utilizing system FFmpeg VAAPI Hwaccel

Terje J. Hanssen terjejhanssen at gmail.com
Sun Oct 13 22:09:32 CEST 2024


While recent testing of a custom built didn't succeed to fire up system 
FFmpeg QSV hwaccel encoding (so far), it possibly may be better success 
with the more generic VAAPI instead.
Cingg has currently rendering preset/profile for h264/hevc_vaapi, but 
not av1_vaapi yet(?) as supported by ffmpeg (?)

First to find the system FFmpeg 7.0.2 supported vaapi encoders and formats:

ffmpeg -hide_banner -encoders | grep vaapi
  V....D av1_vaapi            AV1 (VAAPI) (codec av1)
  V....D h264_vaapi           H.264/AVC (VAAPI) (codec h264)
  V....D hevc_vaapi           H.265/HEVC (VAAPI) (codec hevc)
  V....D mjpeg_vaapi          MJPEG (VAAPI) (codec mjpeg)
  V....D mpeg2_vaapi          MPEG-2 (VAAPI) (codec mpeg2video)
  V....D vp8_vaapi            VP8 (VAAPI) (codec vp8)
  V....D vp9_vaapi            VP9 (VAAPI) (codec vp9)


ffmpeg -hide_banner -h encoder=av1_vaapi | egrep 
'Supported|profile|main|high'
     Supported hardware devices: vaapi
     Supported pixel formats: vaapi
   -profile           <int>        E..V....... Set profile (seq_profile) 
(from -99 to 255) (default -99)
      main            0            E..V.......
      high            1            E..V.......
   -tier              <int>        E..V....... Set tier (seq_tier) (from 
0 to 1) (default main)
      main            0            E..V.......
      high            1            E..V.......


ffmpeg -hide_banner -h encoder=hevc_vaapi | egrep 
'Supported|profile|main|high'
     Supported hardware devices: vaapi
     Supported pixel formats: vaapi
   -profile           <int>        E..V....... Set profile 
(general_profile_idc) (from -99 to 255) (default -99)
      main            1            E..V.......
      main10          2            E..V.......
   -tier              <int>        E..V....... Set tier 
(general_tier_flag) (from 0 to 1) (default main)
      main            0            E..V.......
      high            1            E..V.......

------------------------

FFmpeg -loglevel debug details for now

1)
SD-DV --> VAAPI_HEVC
........
[AVHWDeviceContext @ 0x7f9080c3b780] Trying to use DRM render node for 
device 0.
[AVHWDeviceContext @ 0x7f9080c3b780] libva: VA-API version 1.22.0
[AVHWDeviceContext @ 0x7f9080c3b780] libva: Trying to open 
/usr/lib64/dri/iHD_drv_video.so
[AVHWDeviceContext @ 0x7f9080c3b780] libva: Found init function 
__vaDriverInit_1_22
[AVHWDeviceContext @ 0x7f9080c3b780] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x7f9080c3b780] Initialised VAAPI connection: 
version 1.22
[AVHWDeviceContext @ 0x7f9080c3b780] Format 0x41524742 -> bgra.
[AVHWDeviceContext @ 0x7f9080c3b780] Format 0x41424752 -> rgba.
[AVHWDeviceContext @ 0x7f9080c3b780] Format 0x58524742 -> bgr0.
[AVHWDeviceContext @ 0x7f9080c3b780] Format 0x58424752 -> rgb0.
[AVHWDeviceContext @ 0x7f9080c3b780] Format 0x30335241 -> unknown.
[AVHWDeviceContext @ 0x7f9080c3b780] Format 0x30334241 -> unknown.
[AVHWDeviceContext @ 0x7f9080c3b780] Format 0x30335258 -> x2rgb10le.
[AVHWDeviceContext @ 0x7f9080c3b780] Format 0x30334258 -> unknown.
[AVHWDeviceContext @ 0x7f9080c3b780] Format 0x36314752 -> unknown.
[AVHWDeviceContext @ 0x7f9080c3b780] Format 0x56555941 -> unknown.
[AVHWDeviceContext @ 0x7f9080c3b780] Format 0x56555958 -> vuyx.
[AVHWDeviceContext @ 0x7f9080c3b780] Format 0x30303859 -> gray.
[AVHWDeviceContext @ 0x7f9080c3b780] Format 0x3231564e -> nv12.
[AVHWDeviceContext @ 0x7f9080c3b780] Format 0x3132564e -> unknown.
[AVHWDeviceContext @ 0x7f9080c3b780] Format 0x32595559 -> yuyv422.
[AVHWDeviceContext @ 0x7f9080c3b780] Format 0x59565955 -> uyvy422.
[AVHWDeviceContext @ 0x7f9080c3b780] Format 0x32315659 -> yuv420p.
[AVHWDeviceContext @ 0x7f9080c3b780] Format 0x30323449 -> yuv420p.
[AVHWDeviceContext @ 0x7f9080c3b780] Format 0x50313134 -> yuv411p.
[AVHWDeviceContext @ 0x7f9080c3b780] Format 0x48323234 -> yuv422p.
[AVHWDeviceContext @ 0x7f9080c3b780] Format 0x56323234 -> yuv440p.
[AVHWDeviceContext @ 0x7f9080c3b780] Format 0x50343434 -> yuv444p.
[AVHWDeviceContext @ 0x7f9080c3b780] Format 0x33434d49 -> unknown.
[AVHWDeviceContext @ 0x7f9080c3b780] Format 0x30313050 -> p010le.
[AVHWDeviceContext @ 0x7f9080c3b780] Format 0x32313050 -> p012le.
[AVHWDeviceContext @ 0x7f9080c3b780] Format 0x36313050 -> unknown.
[AVHWDeviceContext @ 0x7f9080c3b780] Format 0x30313259 -> y210le.
[AVHWDeviceContext @ 0x7f9080c3b780] Format 0x32313259 -> y212le.
[AVHWDeviceContext @ 0x7f9080c3b780] Format 0x36313259 -> unknown.
[AVHWDeviceContext @ 0x7f9080c3b780] Format 0x30313459 -> xv30le.
[AVHWDeviceContext @ 0x7f9080c3b780] Format 0x32313459 -> xv36le.
[AVHWDeviceContext @ 0x7f9080c3b780] Format 0x36313459 -> unknown.
[AVHWDeviceContext @ 0x7f9080c3b780] Format 0x50424752 -> unknown.
[AVHWDeviceContext @ 0x7f9080c3b780] Format 0x50524742 -> unknown.
[AVHWDeviceContext @ 0x7f9080c3b780] VAAPI driver: Intel iHD driver for 
Intel(R) Gen Graphics - 24.3.4 ().
[AVHWDeviceContext @ 0x7f9080c3b780] Driver not found in known 
nonstandard list, using standard behaviour.
[AVHWFramesContext @ 0x7f90800de5c0] Created surface 0.
[AVHWFramesContext @ 0x7f90800de5c0] Direct mapping possible.
[hevc_vaapi @ 0x7f90803a3cc0] Input surface format is nv12.
[hevc_vaapi @ 0x7f90803a3cc0] Using VAAPI profile VAProfileHEVCMain (17).
[hevc_vaapi @ 0x7f90803a3cc0] Using VAAPI entrypoint 
VAEntrypointEncSliceLP (8).
[hevc_vaapi @ 0x7f90803a3cc0] Using VAAPI render target format YUV420 (0x1).
[hevc_vaapi @ 0x7f90803a3cc0] Using CTU size 64x64, min CB size 8x8.
[hevc_vaapi @ 0x7f90803a3cc0] Driver supports RC modes CQP, CBR, VBR, 
ICQ, QVBR.
[hevc_vaapi @ 0x7f90803a3cc0] No quality level set; using default (25).
[hevc_vaapi @ 0x7f90803a3cc0] RC mode: ICQ.
[hevc_vaapi @ 0x7f90803a3cc0] Block Level bitrate control: OFF.
[hevc_vaapi @ 0x7f90803a3cc0] RC quality: 25.
[hevc_vaapi @ 0x7f90803a3cc0] RC framerate: 25/1 (25.00 fps).
[hevc_vaapi @ 0x7f90803a3cc0] Driver does not support P-frames, 
replacing them with B-frames.
[hevc_vaapi @ 0x7f90803a3cc0] Using intra and B-frames (supported 
references: 3 / 3).
[hevc_vaapi @ 0x7f90803a3cc0] All wanted packed headers available 
(wanted 0xd, found 0x1f).
[hevc_vaapi @ 0x7f90803a3cc0] Using nv12 as format of reconstructed frames.
[AVHWFramesContext @ 0x7f908030aac0] Created surface 0x1.
[AVHWFramesContext @ 0x7f908030aac0] Direct mapping possible.
[hevc_vaapi @ 0x7f90803a3cc0] Using level 3.
[SWR @ 0x7f908036d040] Using fltp internally between filters
Transform tree:
     mdct_fwd_float_c - type: mdct_float, len: 1024, factors[2]: [2, 
any], flags: [unaligned, out_of_place, fwd_only]
         fft_sr_ns_float_avx2 - type: fft_float, len: 512, factor: 2, 
flags: [aligned, inplace, out_of_place, preshuf]
Transform tree:
     mdct_fwd_float_c - type: mdct_float, len: 128, factors[2]: [2, 
any], flags: [unaligned, out_of_place, fwd_only]
         fft_sr_ns_float_avx2 - type: fft_float, len: 64, factor: 2, 
flags: [aligned, inplace, out_of_place, preshuf]
Render::render_single: Session finished.
** rendered 2832 frames in 4.068 secs, 696.165 fps
audio0 pad 32 0 (32)
Total excess of backups: -50
Session time: 0:11:48
Cpu time: user: 0:00:26.120 sys: 0:00:06.087

-----------
ffprobe -hide_banner dv01_07_hevc_vaapi.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'dv01_07_hevc_vaapi.mp4':
   Metadata:
     major_brand     : isom
     minor_version   : 512
     compatible_brands: isomiso2mp41
     encoder         : Lavf61.1.100
   Duration: 00:01:53.28, start: 0.000000, bitrate: 6237 kb/s
   Stream #0:0[0x1](und): Video: hevc (Main) (hev1 / 0x31766568), 
yuv420p(tv, bt470bg/unknown/unknown), 720x576 [SAR 16:15 DAR 4:3], 6103 
kb/s, 25 fps, 25 tbr, 12800 tbn (default)
       Metadata:
         handler_name    : VideoHandler
         vendor_id       : [0][0][0][0]
   Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 
stereo, fltp, 128 kb/s (default)
       Metadata:
         handler_name    : SoundHandler
         vendor_id       : [0][0][0][0]


2)
HDV --> VAAPI HEVC
..........
[AVHWDeviceContext @ 0x7fe48c030680] Trying to use DRM render node for 
device 0.
[AVHWDeviceContext @ 0x7fe48c030680] libva: VA-API version 1.22.0
[AVHWDeviceContext @ 0x7fe48c030680] libva: Trying to open 
/usr/lib64/dri/iHD_drv_video.so
[AVHWDeviceContext @ 0x7fe48c030680] libva: Found init function 
__vaDriverInit_1_22
[AVHWDeviceContext @ 0x7fe48c030680] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x7fe48c030680] Initialised VAAPI connection: 
version 1.22
[AVHWDeviceContext @ 0x7fe48c030680] Format 0x41524742 -> bgra.
[AVHWDeviceContext @ 0x7fe48c030680] Format 0x41424752 -> rgba.
[AVHWDeviceContext @ 0x7fe48c030680] Format 0x58524742 -> bgr0.
[AVHWDeviceContext @ 0x7fe48c030680] Format 0x58424752 -> rgb0.
[AVHWDeviceContext @ 0x7fe48c030680] Format 0x30335241 -> unknown.
[AVHWDeviceContext @ 0x7fe48c030680] Format 0x30334241 -> unknown.
[AVHWDeviceContext @ 0x7fe48c030680] Format 0x30335258 -> x2rgb10le.
[AVHWDeviceContext @ 0x7fe48c030680] Format 0x30334258 -> unknown.
[AVHWDeviceContext @ 0x7fe48c030680] Format 0x36314752 -> unknown.
[AVHWDeviceContext @ 0x7fe48c030680] Format 0x56555941 -> unknown.
[AVHWDeviceContext @ 0x7fe48c030680] Format 0x56555958 -> vuyx.
[AVHWDeviceContext @ 0x7fe48c030680] Format 0x30303859 -> gray.
[AVHWDeviceContext @ 0x7fe48c030680] Format 0x3231564e -> nv12.
[AVHWDeviceContext @ 0x7fe48c030680] Format 0x3132564e -> unknown.
[AVHWDeviceContext @ 0x7fe48c030680] Format 0x32595559 -> yuyv422.
[AVHWDeviceContext @ 0x7fe48c030680] Format 0x59565955 -> uyvy422.
[AVHWDeviceContext @ 0x7fe48c030680] Format 0x32315659 -> yuv420p.
[AVHWDeviceContext @ 0x7fe48c030680] Format 0x30323449 -> yuv420p.
[AVHWDeviceContext @ 0x7fe48c030680] Format 0x50313134 -> yuv411p.
[AVHWDeviceContext @ 0x7fe48c030680] Format 0x48323234 -> yuv422p.
[AVHWDeviceContext @ 0x7fe48c030680] Format 0x56323234 -> yuv440p.
[AVHWDeviceContext @ 0x7fe48c030680] Format 0x50343434 -> yuv444p.
[AVHWDeviceContext @ 0x7fe48c030680] Format 0x33434d49 -> unknown.
[AVHWDeviceContext @ 0x7fe48c030680] Format 0x30313050 -> p010le.
[AVHWDeviceContext @ 0x7fe48c030680] Format 0x32313050 -> p012le.
[AVHWDeviceContext @ 0x7fe48c030680] Format 0x36313050 -> unknown.
[AVHWDeviceContext @ 0x7fe48c030680] Format 0x30313259 -> y210le.
[AVHWDeviceContext @ 0x7fe48c030680] Format 0x32313259 -> y212le.
[AVHWDeviceContext @ 0x7fe48c030680] Format 0x36313259 -> unknown.
[AVHWDeviceContext @ 0x7fe48c030680] Format 0x30313459 -> xv30le.
[AVHWDeviceContext @ 0x7fe48c030680] Format 0x32313459 -> xv36le.
[AVHWDeviceContext @ 0x7fe48c030680] Format 0x36313459 -> unknown.
[AVHWDeviceContext @ 0x7fe48c030680] Format 0x50424752 -> unknown.
[AVHWDeviceContext @ 0x7fe48c030680] Format 0x50524742 -> unknown.
[AVHWDeviceContext @ 0x7fe48c030680] VAAPI driver: Intel iHD driver for 
Intel(R) Gen Graphics - 24.3.4 ().
[AVHWDeviceContext @ 0x7fe48c030680] Driver not found in known 
nonstandard list, using standard behaviour.
[AVHWFramesContext @ 0x7fe48c84c240] Created surface 0.
[AVHWFramesContext @ 0x7fe48c84c240] Direct mapping possible.
[hevc_vaapi @ 0x7fe48c039a40] Input surface format is nv12.
[hevc_vaapi @ 0x7fe48c039a40] Using VAAPI profile VAProfileHEVCMain (17).
[hevc_vaapi @ 0x7fe48c039a40] Using VAAPI entrypoint 
VAEntrypointEncSliceLP (8).
[hevc_vaapi @ 0x7fe48c039a40] Using VAAPI render target format YUV420 (0x1).
[hevc_vaapi @ 0x7fe48c039a40] Using CTU size 64x64, min CB size 8x8.
[hevc_vaapi @ 0x7fe48c039a40] Driver supports RC modes CQP, CBR, VBR, 
ICQ, QVBR.
[hevc_vaapi @ 0x7fe48c039a40] No quality level set; using default (25).
[hevc_vaapi @ 0x7fe48c039a40] RC mode: ICQ.
[hevc_vaapi @ 0x7fe48c039a40] Block Level bitrate control: OFF.
[hevc_vaapi @ 0x7fe48c039a40] RC quality: 25.
[hevc_vaapi @ 0x7fe48c039a40] RC framerate: 25/1 (25.00 fps).
[hevc_vaapi @ 0x7fe48c039a40] Driver does not support P-frames, 
replacing them with B-frames.
[hevc_vaapi @ 0x7fe48c039a40] Using intra and B-frames (supported 
references: 3 / 3).
[hevc_vaapi @ 0x7fe48c039a40] All wanted packed headers available 
(wanted 0xd, found 0x1f).
[hevc_vaapi @ 0x7fe48c039a40] Using nv12 as format of reconstructed frames.
[AVHWFramesContext @ 0x7fe48c84c300] Created surface 0x1.
[AVHWFramesContext @ 0x7fe48c84c300] Direct mapping possible.
[hevc_vaapi @ 0x7fe48c039a40] Using level 4.
[SWR @ 0x7fe48d78ddc0] Using fltp internally between filters
Transform tree:
     mdct_fwd_float_c - type: mdct_float, len: 1024, factors[2]: [2, 
any], flags: [unaligned, out_of_place, fwd_only]
         fft_sr_ns_float_avx2 - type: fft_float, len: 512, factor: 2, 
flags: [aligned, inplace, out_of_place, preshuf]
Transform tree:
     mdct_fwd_float_c - type: mdct_float, len: 128, factors[2]: [2, 
any], flags: [unaligned, out_of_place, fwd_only]
         fft_sr_ns_float_avx2 - type: fft_float, len: 64, factor: 2, 
flags: [aligned, inplace, out_of_place, preshuf]
Render::render_single: Session finished.
** rendered 5972 frames in 24.335 secs, 245.408 fps
audio0 pad 64 0 (64)
Total excess of backups: -50
Session time: 0:32:22
Cpu time: user: 0:01:19.691 sys: 0:00:12.896

-----------

ffprobe -hide_banner hdv09_04_hevc_vaapi.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'hdv09_04_hevc_vaapi.mp4':
   Metadata:
     major_brand     : isom
     minor_version   : 512
     compatible_brands: isomiso2mp41
     encoder         : Lavf61.1.100
   Duration: 00:03:58.88, start: 0.000000, bitrate: 11715 kb/s
   Stream #0:0[0x1](und): Video: hevc (Main) (hev1 / 0x31766568), 
yuv420p(tv, bt470bg/unknown/unknown, top coded first (swapped)), 
1440x1080 [SAR 4:3 DAR 16:9], 11580 kb/s, 25 fps, 25 tbr, 12800 tbn 
(default)
       Metadata:
         handler_name    : VideoHandler
         vendor_id       : [0][0][0][0]
   Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 
stereo, fltp, 129 kb/s (default)
       Metadata:
         handler_name    : SoundHandler
         vendor_id       : [0][0][0][0]






-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20241013/35ff921b/attachment-0001.htm>


More information about the Cin mailing list