<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <br>
    <br>
    <br>
    <div class="moz-cite-prefix">Den 03.11.2024 00:52, skrev Terje J.
      Hanssen:<br>
    </div>
    <blockquote type="cite"
      cite="mid:02c6fa06-daba-45fe-be46-957134cb3673@gmail.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <br>
      <br>
      <br>
      <div class="moz-cite-prefix">Den 03.11.2024 00:09, skrev Andrew
        Randrianasulu:<br>
      </div>
      <blockquote type="cite"
cite="mid:CA+rFky5AsO1E16um=pBCDHBtwuM0A3QFNCCpBw2n24Ln+rgu8g@mail.gmail.com">
        <meta http-equiv="content-type"
          content="text/html; charset=UTF-8">
        <div dir="ltr">
          <div dir="ltr"><br>
          </div>
          <br>
          <div class="gmail_quote">
            <div dir="ltr" class="gmail_attr">On Sat, Nov 2, 2024 at
              8:15 PM Terje J. Hanssen via Cin <<a
                href="mailto:cin@lists.cinelerra-gg.org"
                moz-do-not-send="true" class="moz-txt-link-freetext">cin@lists.cinelerra-gg.org</a>>
              wrote:<br>
            </div>
            <blockquote class="gmail_quote"
style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
              <div> <br>
                <div>Den 01.11.2024 19:34, skrev Phyllis Smith:<br>
                </div>
                <blockquote type="cite">
                  <div dir="ltr">
                    <div style="font-size:small">Terje, thank you for
                      this comprehensive list of vaapi supported
                      encodings.<br>
                    </div>
                  </div>
                  <br>
                  <div class="gmail_quote">
                    <div dir="ltr" class="gmail_attr">On Thu, Oct 31,
                      2024 at 5:38 PM Terje J. Hanssen via Cin <<a
                        href="mailto:cin@lists.cinelerra-gg.org"
                        target="_blank" moz-do-not-send="true"
                        class="moz-txt-link-freetext">cin@lists.cinelerra-gg.org</a>>
                      wrote:<br>
                    </div>
                    <blockquote class="gmail_quote"
style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
                      <div> In hope it may be of some use for Cingg
                        next, I make a summary and supplement to the
                        guide in <a
href="https://trac.ffmpeg.org/wiki/Hardware/VAAPI#Encoding"
                          target="_blank" moz-do-not-send="true"
                          class="moz-txt-link-freetext">https://trac.ffmpeg.org/wiki/Hardware/VAAPI#Encoding</a>
                        <br>
                        And instead of adding a tail to already too long
                        recent threads, I start a new thread here. <br>
                        <br>
                        <font face="Courier New, Courier, monospace">Two
                          additional references are used<br>
                          Developer Reference: Media Capabilities
                          Supported by Intel Hardware<br>
                          <a
href="https://www.intel.com/content/www/us/en/docs/onevpl/developer-reference-media-intel-hardware/1-1/features-and-formats.html"
                            target="_blank" moz-do-not-send="true"
                            class="moz-txt-link-freetext">https://www.intel.com/content/www/us/en/docs/onevpl/developer-reference-media-intel-hardware/1-1/features-and-formats.html</a><br>
                          Supported Encoding Input Format and Max
                          Resolution<br>
                          <a
href="https://github.com/intel/media-driver/blob/master/docs/media_features.md#supported-encoding-input-format-and-max-resolution"
                            target="_blank" moz-do-not-send="true"
                            class="moz-txt-link-freetext">https://github.com/intel/media-driver/blob/master/docs/media_features.md#supported-encoding-input-format-and-max-resolution</a><br>
                          <br>
                          to clarify the Encode Features for my own
                          Intel Arc A-series Discrete Graphics<br>
                          <br>
                          HEVC (fixed-function hardware + shader-based)<br>
                           8-bit, 4:2:0 (NV12)<br>
                          10-bit, 4:2:0 (P010)<br>
                           8-bit, 4:2:2 (YUY2, Windows only)<br>
                          10-bit, 4:2:2 (Y210)<br>
                          <br>
                          AV1<br>
                           8-bit, 4:2:0 (NV12)<br>
                          10-bit, 4:2:0 (P010)<br>
                          <br>
                          <br>
                          A short reminder:<br>
                          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.<br>
                          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. <br>
                          <a
href="https://fujifilm-x.com/en-us/series/the-filmmakers-handbook/8-bit-or-10-bit-video-color-explained/"
                            target="_blank" moz-do-not-send="true"
                            class="moz-txt-link-freetext">https://fujifilm-x.com/en-us/series/the-filmmakers-handbook/8-bit-or-10-bit-video-color-explained/</a>
                          <br>
                          <br>
                          <br>
                          An important point to notice is that the VAAPI
                          encoding 'formats' are based on those in the
                          parentheses () above.<br>
                          <br>
                          Three simplified ffmpeg code lines with
                          default bit-rates and without audio are used
                          in the following three examples.<br>
                          Resulting fps encoding counts or speeds are
                          the same in all cases; I don't know why.<br>
                          <br>
                          <br>
                          The input file used:<br>
                          <br>
                          ffprobe -hide_banner cfhd01.mkv<br>
                          Input #0, matroska,webm, from 'cfhd01.mkv':<br>
                            Metadata:<br>
                              ENCODER         : Lavf61.1.100<br>
                            Duration: 00:01:11.24, start: 0.000000,
                          bitrate: 393480 kb/s<br>
                            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)<br>
                                Metadata:<br>
                                  HANDLER_NAME    : Apple Video Media
                          Handler<br>
                                  VENDOR_ID       : appl<br>
                                  ENCODER         : Lavc61.3.100 cfhd<br>
                                  DURATION        : 00:01:11.240000000<br>
                          <br>
                          <br>
                          1)<br>
                          8-bit yuv420p hevc vaapi encoding using -vf
                          'format=nv12,hwupload'<br>
------------------------------------------------------------------<br>
                          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<br>
                          ............<br>
                          frame= 1781 fps= 46 q=-0.0 Lsize=  104132KiB
                          time=00:01:11.24 bitrate=11974.3kbits/s
                          speed=1.83x <br>
                          <br>
                          <br>
                          ffprobe -hide_banner
                          cfhd01_av1_vaapi_format_nv12.mp4<br>
                          Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
                          'cfhd01_av1_vaapi_format_nv12.mp4':<br>
                            Metadata:<br>
                              major_brand     : isom<br>
                              minor_version   : 512<br>
                              compatible_brands: isomav01iso2mp41<br>
                              encoder         : Lavf61.7.100<br>
                            Duration: 00:01:11.24, start: 0.000000,
                          bitrate: 11974 kb/s<br>
                            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)<br>
                                Metadata:<br>
                                  handler_name    : Apple Video Media
                          Handler<br>
                                  vendor_id       : [0][0][0][0]<br>
                                  encoder         : Lavc61.19.100
                          av1_vaapi<br>
                          <br>
                          <br>
                          2)<br>
                          10-bit yuv420p10le hevc vaapi encoding using
                          -vf 'format=p010,hwupload'<br>
-----------------------------------------------------------------------<br>
                          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<br>
                          .............<br>
                          frame= 1781 fps= 46 q=-0.0 Lsize=  111924KiB
                          time=00:01:11.24 bitrate=12870.3kbits/s
                          speed=1.82x <br>
                          <br>
                          <br>
                          ffprobe -hide_banner
                          cfhd01_av1_vaapi_format_p010.mp4<br>
                          Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
                          'cfhd01_av1_vaapi_format_p010.mp4':<br>
                            Metadata:<br>
                              major_brand     : isom<br>
                              minor_version   : 512<br>
                              compatible_brands: isomav01iso2mp41<br>
                              encoder         : Lavf61.7.100<br>
                            Duration: 00:01:11.24, start: 0.000000,
                          bitrate: 12870 kb/s<br>
                            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)<br>
                                Metadata:<br>
                                  handler_name    : Apple Video Media
                          Handler<br>
                                  vendor_id       : [0][0][0][0]<br>
                                  encoder         : Lavc61.19.100
                          av1_vaapi<br>
                          <br>
                          3)<br>
                          10-bit yuv422p10le hevc_vaapi encoding using
                          -vf 'format=y210,hwupload'<br>
-----------------------------------------------------------------------<br>
                          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<br>
                          frame= 1781 fps= 46 q=-0.0 Lsize=  105482KiB
                          time=00:01:11.20 bitrate=12136.3kbits/s
                          speed=1.83x <br>
                          <br>
                          <br>
                          ffprobe -hide_banner
                          cfhd01_hevc_vaapi_format_y210.mp4<br>
                          Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
                          'cfhd01_hevc_vaapi_format_y210.mp4':<br>
                            Metadata:<br>
                              major_brand     : isom<br>
                              minor_version   : 512<br>
                              compatible_brands: isomiso2mp41<br>
                              encoder         : Lavf61.7.100<br>
                            Duration: 00:01:11.24, start: 0.000000,
                          bitrate: 12129 kb/s<br>
                            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)<br>
                                Metadata:<br>
                                  handler_name    : Apple Video Media
                          Handler<br>
                                  vendor_id       : [0][0][0][0]<br>
                                  encoder         : Lavc61.19.100
                          hevc_vaapi   <br>
                          <br>
                        </font><br>
                      </div>
                    </blockquote>
                  </div>
                </blockquote>
                <br>
                <br>
                <font face="Courier New, Courier, monospace">It was also
                  interesting to standardize that the corresponding
                  ffmpeg syntax above works for both vaapi/qsv and
                  hevc/av1:<br>
                  <br>
                  - replace vaapi with qsv in 1) 2) and 3) above<br>
                  - and if applicable: replace hevc with av1 in 1) and
                  2) above  <br>
                  <br>
                  <br>
                  The default bitrates used do vary a lot as seen on
                  listed output file sizes:<br>
                </font>
                <blockquote><font face="Courier New, Courier, monospace">19M   
                    cfhd01_hevc_qsv_format_nv12.mp4</font><br>
                  <font face="Courier New, Courier, monospace">92M   
                    cfhd01_hevc_vaapi_format_nv12.mp4</font><br>
                  <br>
                  <font face="Courier New, Courier, monospace">224M  
                    cfhd01_hevc_qsv_format_p010.mp4</font><br>
                  <font face="Courier New, Courier, monospace">90M   
                    cfhd01_hevc_vaapi_format_p010.mp4</font><br>
                  <br>
                  <font face="Courier New, Courier, monospace">270M  
                    cfhd01_hevc_qsv_format_y210.mp4</font><br>
                  <font face="Courier New, Courier, monospace">104M  
                    cfhd01_hevc_vaapi_format_y210.mp4</font><br>
                  <font face="Courier New, Courier, monospace">----------------<br>
                    <br>
                  </font><font face="Courier New, Courier, monospace">9,1M  
                    cfhd01_av1_qsv_format_nv12.mp4</font><br>
                  <font face="Courier New, Courier, monospace">102M  
                    cfhd01_av1_vaapi_format_nv12.mp4</font><br>
                  <br>
                  <font face="Courier New, Courier, monospace">9,1M  
                    cfhd01_av1_qsv_format_p010.mp4</font><br>
                  <font face="Courier New, Courier, monospace">110M  
                    cfhd01_av1_vaapi_format_p010.mp4</font><br>
                </blockquote>
                <font face="Courier New, Courier, monospace"><br>
                </font></div>
            </blockquote>
            <div><br>
            </div>
            <div>yes, last four lines seem say that qsv and vaapi AV1
              encoders use  <b> wildly</b> different defaults for
              bitrate ....<br>
            </div>
            <div> <br>
            </div>
          </div>
        </div>
      </blockquote>
      <br>
      Yes, and it looks like especially av1_qsv is highly optimized,
      because it is not bad to look at. The 10x larger av1_vaapi is at
      bit sharper and smoother at pan/tilt movements (I used tripod for
      the original source camcording to a HDMI connected BD hyperdeck
      shuttle. Later I transcoded this test file to cfhd as intermediate
      format with ffmpeg).<br>
      Another thing I mentioned in my first post here, is that the
      encoding speed in all these cases independent of bitrate, looks to
      be about the same 45-46 fps<br>
      <br>
      I add here the ffprobe outputs to compare for the two latter
      lines:<br>
      <br>
      <font face="Courier New, Courier, monospace">9,1M  
        cfhd01_av1_qsv_format_p010.mp4<br>
        ffprobe -hide_banner cfhd01_av1_qsv_format_p010.mp4<br>
        Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
        'cfhd01_av1_qsv_format_p010.mp4':<br>
          Metadata:<br>
            major_brand     : isom<br>
            minor_version   : 512<br>
            compatible_brands: isomav01iso2mp41<br>
            encoder         : Lavf61.7.100<br>
          Duration: 00:01:11.24, start: 0.000000, bitrate: 1062 kb/s<br>
          Stream #0:0[0x1](eng): Video: av1 (libdav1d) (Main) (av01 /
        0x31307661), yuv420p10le(tv, bt709, progressive), 1920x1080,
        1061 kb/s, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 12800 tbn (default)<br>
              Metadata:<br>
                handler_name    : Apple Video Media Handler<br>
                vendor_id       : [0][0][0][0]<br>
                encoder         : Lavc61.19.100 av1_qsv<br>
        -----------------<br>
        <br>
        110M   cfhd01_av1_vaapi_format_p010.mp4<br>
        ffprobe -hide_banner cfhd01_av1_vaapi_format_p010.mp4<br>
        Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
        'cfhd01_av1_vaapi_format_p010.mp4':<br>
          Metadata:<br>
            major_brand     : isom<br>
            minor_version   : 512<br>
            compatible_brands: isomav01iso2mp41<br>
            encoder         : Lavf61.7.100<br>
          Duration: 00:01:11.24, start: 0.000000, bitrate: 12870 kb/s<br>
          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)<br>
              Metadata:<br>
                handler_name    : Apple Video Media Handler<br>
                vendor_id       : [0][0][0][0]<br>
                encoder         : Lavc61.19.100 av1_vaapi<br>
        <br>
        <br>
      </font></blockquote>
    <br>
    <br>
    <font face="Courier New, Courier, monospace">Some quality option
      notices from the ffmpeg encoding outputs:<br>
      <br>
      [hevc_vaapi@ 0x558fd14e9740] No quality level set; using default
      (25).<br>
      <br>
      [av1_vaapi @ 0x559d44056740] No quality level set; using default
      (25).<br>
      <br>
      -----------<br>
      <br>
      [hevc_qsv @ 0x55834b200500] Using the constant quantization
      parameter (CQP) by default. Please use the global_quality option
      and other options for a quality-based mode or the b option and
      other options for a bitrate-based mode if the default is not the
      desired choice.<br>
      <br>
      [av1_qsv @ 0x558ed655f400] Using the constant quantization
      parameter (CQP) by default. Please use the global_quality option
      and other options for a quality-based mode or the b option and
      other options for a bitrate-based mode if the default is not the
      desired choice.<br>
      <br>
      <br>
      And by listing other related parameter options from the ffmpeg
      help:<br>
      <br>
      ffmpeg -hide_banner -h encoder=hevc_vaapi | egrep -i
      'quality|global_quality|bitrate|profile|preset'<br>
           CQP             1            E..V....... Constant-quality<br>
           CBR             2            E..V....... Constant-bitrate<br>
           VBR             3            E..V....... Variable-bitrate<br>
           ICQ             4            E..V....... Intelligent
      constant-quality<br>
           QVBR            5            E..V....... Quality-defined
      variable-bitrate<br>
           AVBR            6            E..V....... Average
      variable-bitrate<br>
        -blbrc             <boolean>    E..V....... Block level
      based bitrate control (default false)<br>
        -profile           <int>        E..V....... Set profile
      (general_profile_idc) (from -99 to 255) (default -99)<br>
      <br>
      ffmpeg -hide_banner -h encoder=av1_vaapi | egrep -i
      'quality|global_quality|bitrate|profile|preset'<br>
           CQP             1            E..V....... Constant-quality<br>
           CBR             2            E..V....... Constant-bitrate<br>
           VBR             3            E..V....... Variable-bitrate<br>
           ICQ             4            E..V....... Intelligent
      constant-quality<br>
           QVBR            5            E..V....... Quality-defined
      variable-bitrate<br>
           AVBR            6            E..V....... Average
      variable-bitrate<br>
        -blbrc             <boolean>    E..V....... Block level
      based bitrate control (default false)<br>
        -profile           <int>        E..V....... Set profile
      (seq_profile) (from -99 to 255) (default -99)<br>
      <br>
      --------------<br>
      <br>
      ffmpeg -hide_banner -h encoder=hevc_qsv | egrep -i
      'quality|global_quality|bitrate|profile|preset'<br>
        -preset            <int>        E..V....... (from 0 to 7)
      (default 0)<br>
        -mbbrc             <int>        E..V....... MB level
      bitrate control (from -1 to 1) (default -1)<br>
        -extbrc            <int>        E..V....... Extended
      bitrate control (from -1 to 1) (default -1)<br>
        -profile           <int>        E..V....... (from 0 to
      INT_MAX) (default unknown)<br>
      <br>
      ffmpeg -hide_banner -h encoder=av1_qsv | egrep -i
      'quality|global_quality|bitrate|profile|preset'<br>
        -preset            <int>        E..V....... (from 0 to 7)
      (default 0)<br>
        -extbrc            <int>        E..V....... Extended
      bitrate control (from -1 to 1) (default -1)<br>
        -profile           <int>        E..V....... (from 0 to
      INT_MAX) (default unknown)<br>
      <br>
      <br>
      <br>
      <br>
      <br>
      <br>
    </font><br>
    <br>
  </body>
</html>