сб, 26 окт. 2024 г., 17:39 Terje J. Hanssen <terjejhanssen@gmail.com>:



Den 26.10.2024 02:12, skrev Andrew Randrianasulu:


сб, 26 окт. 2024 г., 03:06 Terje J. Hanssen via Cin <cin@lists.cinelerra-gg.org>:
  An overview over the system FFmpeg 7.1 supported QSV pixel formats and profiles:


ffmpeg -hide_banner -encoders | grep qsv
 V..... av1_qsv              AV1 (Intel Quick Sync Video acceleration) (codec av1)
 V..... h264_qsv             H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (Intel Quick Sync Video acceleration) (codec h264)
 V..... hevc_qsv             HEVC (Intel Quick Sync Video acceleration) (codec hevc)
 V..... mjpeg_qsv            MJPEG (Intel Quick Sync Video acceleration) (codec mjpeg)
 V..... mpeg2_qsv            MPEG-2 video (Intel Quick Sync Video acceleration) (codec mpeg2video)
 V..... vp9_qsv              VP9 video (Intel Quick Sync Video acceleration) (codec vp9)


ffmpeg -hide_banner -h encoder=av1_qsv | egrep 'Supported|profile|main|high|professional'
    Supported hardware devices: qsv qsv qsv
    Supported pixel formats: nv12 p010le qsv
  -profile           <int>        E..V....... (from 0 to INT_MAX) (default unknown)
     main            1            E..V.......


ffmpeg -hide_banner -h encoder=hevc_qsv | egrep 'Supported|profile|main|high|professional'
    Supported hardware devices: qsv qsv qsv
    Supported pixel formats: nv12 p010le p012le yuyv422 y210le qsv bgra x2rgb10le vuyx xv30le
  -profile           <int>        E..V....... (from 0 to INT_MAX) (default unknown)
     main            1            E..V.......
     main10          2            E..V.......
     mainsp          3            E..V.......
  -tier              <int>        E..V....... Set the encoding tier (only level >= 4 can support high tier) (from 0 to 256) (default high)
     main            0            E..V.......
     high            256          E..V.......


ffmpeg -hide_banner -h encoder=h264_qsv | egrep 'Supported|profile|main|high|professional'
    Supported hardware devices: qsv qsv qsv
    Supported pixel formats: nv12 qsv
  -profile           <int>        E..V....... (from 0 to INT_MAX) (default unknown)
     main            77           E..V.......
     high            100          E..V.......


from this we can conclude av1/hevc should have 10bit option  ...

probably writing down numerical values for profiles (high, main...) for each codec is also good idea.


A reference and overview table for QSV capabilties for each iGPU and dGPU generation is here
https://en.wikipedia.org/wiki/Intel_Quick_Sync_Video#Hardware_decoding_and_encoding

And finally, after much trying and failing, I was able to prove that true 10bit 422 color depth hevc_qsv encoding is possible with my system ffmpeg 7.1
.
While pixel format p010le results in "just" 10bit yuv420p, the clue is to to use either (trying this for av1_qsv, auto- switch to 8bit nv12):
-pix_fmt y210le
or
-v format=yuv422p010le
Code example:

ffmpeg -hide_banner -hwaccel_output_format qsv -i cfhd01.mkv -c:v hevc_qsv -pix_fmt y210le cfhd01_hevc_qsv_pxfmt_y210le.mp4

Input file:

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

Output file:

ffprobe -hide_banner cfhd01_hevc_qsv_pxfmt_y210le.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'cfhd01_hevc_qsv_pxfmt_y210le.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf61.7.100
  Duration: 00:01:11.24, start: 0.000000, bitrate: 31770 kb/s
  Stream #0:0[0x1](eng): Video: hevc (Rext) (hev1 / 0x31766568), yuv422p10le(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 31767 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_qsv


Good to know.

Hopefully if we on the right track with "just" 10bit yuv420 encoding we will find way to stuff more complex cases in there too ....


Does it work with vaapi encoder (system ffmpeg as cli application) too?