[Cin] VAAPI supported Encoding formats
Terje J. Hanssen
terjejhanssen at gmail.com
Sat Nov 2 18:15:20 CET 2024
Den 01.11.2024 19:34, skrev Phyllis Smith:
> Terje, thank you for this comprehensive list of vaapi supported encodings.
>
> On Thu, Oct 31, 2024 at 5:38 PM Terje J. Hanssen via Cin
> <cin at lists.cinelerra-gg.org> wrote:
>
> In hope it may be of some use for Cingg next, I make a summary and
> supplement to the guide in
> https://trac.ffmpeg.org/wiki/Hardware/VAAPI#Encoding
> And instead of adding a tail to already too long recent threads, I
> start a new thread here.
>
> Two additional references are used
> Developer Reference: Media Capabilities Supported by Intel Hardware
> https://www.intel.com/content/www/us/en/docs/onevpl/developer-reference-media-intel-hardware/1-1/features-and-formats.html
> Supported Encoding Input Format and Max Resolution
> https://github.com/intel/media-driver/blob/master/docs/media_features.md#supported-encoding-input-format-and-max-resolution
>
> to clarify the Encode Features for my own Intel Arc A-series
> Discrete Graphics
>
> HEVC (fixed-function hardware + shader-based)
> 8-bit, 4:2:0 (NV12)
> 10-bit, 4:2:0 (P010)
> 8-bit, 4:2:2 (YUY2, Windows only)
> 10-bit, 4:2:2 (Y210)
>
> AV1
> 8-bit, 4:2:0 (NV12)
> 10-bit, 4:2:0 (P010)
>
>
> A short reminder:
> 8-bit vs 10-bit color depths is 256 vs 1024 color levels of each
> RGB color, or 16.7 mill. vs 1.0 bill colors.
> 4:2:0 vs 4:2:2 color sub-sampling is keeping 1/4 vs 1/2 of all
> 4:4:4 colors or the precision of color compression.
> https://fujifilm-x.com/en-us/series/the-filmmakers-handbook/8-bit-or-10-bit-video-color-explained/
>
>
>
> An important point to notice is that the VAAPI encoding 'formats'
> are based on those in the parentheses () above.
>
> Three simplified ffmpeg code lines with default bit-rates and
> without audio are used in the following three examples.
> Resulting fps encoding counts or speeds are the same in all cases;
> I don't know why.
>
>
> The input file used:
>
> ffprobe -hide_banner cfhd01.mkv
> Input #0, matroska,webm, from 'cfhd01.mkv':
> Metadata:
> ENCODER : Lavf61.1.100
> Duration: 00:01:11.24, start: 0.000000, bitrate: 393480 kb/s
> Stream #0:0(eng): Video: cfhd (CFHD / 0x44484643),
> yuv422p10le(tv, bt709, top coded first (swapped)), 1920x1080, SAR
> 1:1 DAR 16:9, 25 fps, 25 tbr, 1k tbn (default)
> Metadata:
> HANDLER_NAME : Apple Video Media Handler
> VENDOR_ID : appl
> ENCODER : Lavc61.3.100 cfhd
> DURATION : 00:01:11.240000000
>
>
> 1)
> 8-bit yuv420p hevc vaapi encoding using -vf 'format=nv12,hwupload'
> ------------------------------------------------------------------
> ffmpeg -hide_banner -vaapi_device /dev/dri/renderD128 -i
> cfhd01.mkv -vf 'format=nv12,hwupload' -c:v av1_vaapi
> cfhd01_av1_vaapi_format_nv12.mp4
> ............
> frame= 1781 fps= 46 q=-0.0 Lsize= 104132KiB time=00:01:11.24
> bitrate=11974.3kbits/s speed=1.83x
>
>
> ffprobe -hide_banner cfhd01_av1_vaapi_format_nv12.mp4
> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
> 'cfhd01_av1_vaapi_format_nv12.mp4':
> Metadata:
> major_brand : isom
> minor_version : 512
> compatible_brands: isomav01iso2mp41
> encoder : Lavf61.7.100
> Duration: 00:01:11.24, start: 0.000000, bitrate: 11974 kb/s
> Stream #0:0[0x1](eng): Video: av1 (libdav1d) (Main) (av01 /
> 0x31307661), yuv420p(tv, bt709, progressive), 1920x1080, 11973
> kb/s, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 12800 tbn (default)
> Metadata:
> handler_name : Apple Video Media Handler
> vendor_id : [0][0][0][0]
> encoder : Lavc61.19.100 av1_vaapi
>
>
> 2)
> 10-bit yuv420p10le hevc vaapi encoding using -vf
> 'format=p010,hwupload'
> -----------------------------------------------------------------------
> ffmpeg -hide_banner -vaapi_device /dev/dri/renderD128 -i
> cfhd01.mkv -vf 'format=p010,hwupload' -c:v av1_vaapi
> cfhd01_av1_vaapi_format_p010.mp4
> .............
> frame= 1781 fps= 46 q=-0.0 Lsize= 111924KiB time=00:01:11.24
> bitrate=12870.3kbits/s speed=1.82x
>
>
> ffprobe -hide_banner cfhd01_av1_vaapi_format_p010.mp4
> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
> 'cfhd01_av1_vaapi_format_p010.mp4':
> Metadata:
> major_brand : isom
> minor_version : 512
> compatible_brands: isomav01iso2mp41
> encoder : Lavf61.7.100
> Duration: 00:01:11.24, start: 0.000000, bitrate: 12870 kb/s
> Stream #0:0[0x1](eng): Video: av1 (libdav1d) (Main) (av01 /
> 0x31307661), yuv420p10le(tv, bt709, progressive), 1920x1080, 12869
> kb/s, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 12800 tbn (default)
> Metadata:
> handler_name : Apple Video Media Handler
> vendor_id : [0][0][0][0]
> encoder : Lavc61.19.100 av1_vaapi
>
> 3)
> 10-bit yuv422p10le hevc_vaapi encoding using -vf
> 'format=y210,hwupload'
> -----------------------------------------------------------------------
> ffmpeg -hide_banner -vaapi_device /dev/dri/renderD128 -i
> cfhd01.mkv -vf 'format=y210,hwupload' -c:v hevc_vaapi
> cfhd01_hevc_vaapi_format_y210.mp4
> frame= 1781 fps= 46 q=-0.0 Lsize= 105482KiB time=00:01:11.20
> bitrate=12136.3kbits/s speed=1.83x
>
>
> ffprobe -hide_banner cfhd01_hevc_vaapi_format_y210.mp4
> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
> 'cfhd01_hevc_vaapi_format_y210.mp4':
> Metadata:
> major_brand : isom
> minor_version : 512
> compatible_brands: isomiso2mp41
> encoder : Lavf61.7.100
> Duration: 00:01:11.24, start: 0.000000, bitrate: 12129 kb/s
> Stream #0:0[0x1](eng): Video: hevc (Rext) (hev1 / 0x31766568),
> yuv422p10le(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9],
> 12127 kb/s, 25 fps, 25 tbr, 12800 tbn (default)
> Metadata:
> handler_name : Apple Video Media Handler
> vendor_id : [0][0][0][0]
> encoder : Lavc61.19.100 hevc_vaapi
>
>
It was also interesting to standardize that the corresponding ffmpeg
syntax above works for both vaapi/qsv and hevc/av1:
- replace vaapi with qsv in 1) 2) and 3) above
- and if applicable: replace hevc with av1 in 1) and 2) above
The default bitrates used do vary a lot as seen on listed output file sizes:
19M cfhd01_hevc_qsv_format_nv12.mp4
92M cfhd01_hevc_vaapi_format_nv12.mp4
224M cfhd01_hevc_qsv_format_p010.mp4
90M cfhd01_hevc_vaapi_format_p010.mp4
270M cfhd01_hevc_qsv_format_y210.mp4
104M cfhd01_hevc_vaapi_format_y210.mp4
----------------
9,1M cfhd01_av1_qsv_format_nv12.mp4
102M cfhd01_av1_vaapi_format_nv12.mp4
9,1M cfhd01_av1_qsv_format_p010.mp4
110M cfhd01_av1_vaapi_format_p010.mp4
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20241102/334da587/attachment.htm>
More information about the Cin
mailing list