<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">чт, 20 июн. 2024 г., 01:02 Terje J. Hanssen <<a href="mailto:terjejhanssen@gmail.com">terjejhanssen@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>

  
    
  
  <div>
    <br>
    <br>
    <div>On 6/19/24 02:44, Andrew Randrianasulu
      wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="auto">
        <div>------------ skip<br>
          <div class="gmail_quote">
            <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div><font face="Courier New, Courier, monospace"> <br>
                  -------------<br>
                  <br>
                  In short, I have tested the same SD-DV 576i and HDV
                  1080i video files as with SVT-AV1 (CPU based) in
                  another resent post.<br>
                  <br>
                </font>
                <blockquote><font face="Courier New, Courier, monospace">ffmpeg
                    -hide_banner -hwaccel qsv -qsv_device
                    /dev/dri/renderD128 -i dv01_07.dv -c:v av1_qsv
                    -preset 4 dv01_07_av1_qsv_pr4.webm</font><br>
                  <font face="Courier New, Courier, monospace">frame=
                    2832 fps=2106 q=-0.0 Lsize=   10554KiB
                    time=00:01:53.24 bitrate= 763.5kbits/s
                    speed=84.2x    </font><br>
                  <br>
                  <font face="Courier New, Courier, monospace">fmpeg
                    -hide_banner -hwaccel qsv -qsv_device
                    /dev/dri/renderD128 -i hdv09_04.m2t -c:v av1_qsv
                    -preset 4 hdv09_04.m2t_av1_qsv_pr4.webm</font><br>
                  <font face="Courier New, Courier, monospace">frame=
                    5913 fps=700 q=-0.0 Lsize=   48022KiB
                    time=00:03:58.77 bitrate=1647.6kbits/s dup=0 drop=4
                    speed=28.3x    </font><br>
                </blockquote>
                <font face="Courier New, Courier, monospace">....skip</font><font face="Courier New, Courier, monospace"><br>
                </font></div>
            </blockquote>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    <blockquote type="cite">
      <div dir="auto">
        <div>
          <div class="gmail_quote">
            <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div><font face="Courier New, Courier, monospace"> A
                  warning output in both command lines is:<br>
                </font>
                <blockquote><font face="Courier New, Courier, monospace">[vist#0:0/dvvideo
                    @ 0x556a3f679100] WARNING: defaulting
                    hwaccel_output_format to qsv for compatibility with
                    old commandlines. This behaviour is DEPRECATED and
                    will be removed in the future. Please explicitly set
                    "-hwaccel_output_format qsv".</font><br>
                </blockquote>
                <font face="Courier New, Courier, monospace">I tried to
                  add this without success, so suggestion is welcome !?<br>
                </font></div>
            </blockquote>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    <font face="Courier New, Courier, monospace">I got this succesful
      now and avoided this warning, see command lines below<br>
      <br>
    </font>
    <blockquote type="cite">
      <div dir="auto">
        <div>
          <div class="gmail_quote">
            <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div><font face="Courier New, Courier, monospace"> <br>
                  <br>
                  And possibly suggestions regarding the more seriously
                  errors "Cannot allocate memory" that arised from the
                  second command transcoding the hdv file?<br>
                </font></div>
            </blockquote>
          </div>
        </div>
        <div dir="auto"><br>
        </div>
        <div dir="auto"><br>
        </div>
        <div dir="auto">well, you tried to add -<font face="courier new, courier, monospace">extra_hw_frames 16
            for example to your ffmpeg line? I think mpeg2 is not most
            popular input codec nowadays ....</font></div>
      </div>
    </blockquote>
    <br>
    Yes, thank you. This worked, see below (not unlike previous
    extending the bufsize for transcoding to mpg(2) for DVD)<br>
     <br>
    <br>
    <blockquote type="cite">
      <div dir="auto">.<font face="Courier New, Courier, monospace">I
          attach also the "complete" ffmpeg output FWIW for both files,
          though skipping repeated error lines:</font>
        <div dir="auto">
          <div class="gmail_quote">
            <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div><font face="Courier New, Courier, monospace"> <br>
                </font>
                <blockquote><font face="Courier New, Courier, monospace">ffmpeg
                    -hide_banner -hwaccel qsv -qsv_device
                    /dev/dri/renderD128 -i dv01_07.dv -c:v av1_qsv
                    -preset 4 dv01_07_av1_qsv_pr4.webm</font><br>
                  <font face="Courier New, Courier, monospace">........skip</font><br>
                </blockquote>
              </div>
            </blockquote>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    <blockquote type="cite">
      <div dir="auto">
        <div dir="auto">
          <div class="gmail_quote">
            <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div>
                <blockquote> <font face="Courier New, Courier, monospace">frame= 2832
                    fps=2106 q=-0.0 Lsize=   10554KiB time=00:01:53.24
                    bitrate= 763.5kbits/s speed=84.2x   </font></blockquote>
              </div>
            </blockquote>
          </div>
        </div>
        <div dir="auto"><span style="font-family:"courier new",courier,monospace">bitrate=
            763.5kbits/s</span><br>
        </div>
        <div dir="auto"><span style="font-family:"courier new",courier,monospace"><br>
          </span></div>
        <div dir="auto"><span style="font-family:"courier new",courier,monospace">sounds a
            bit low even for av1, so may be try to set -b to some higher
            value as suggested?</span></div>
      </div>
    </blockquote>
    <br>
    As suggested where?  <span style="font-family:"courier new",courier,monospace">bitrate=
      763.5kbits/s</span> was for SD-DV  which was viewable and not
    quite bad in my eyes.</div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">guess my guess was outdated (based on xvid days?)</div><div dir="auto"><br></div><div dir="auto">sorry!</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div> <br>
    <br>
    <blockquote type="cite">
      <div dir="auto">
        <div dir="auto"><span style="font-family:"courier new",courier,monospace"><br>
          </span></div>
        <div dir="auto"><span style="font-family:"courier new",courier,monospace">====</span></div>
        <div dir="auto"><span style="font-family:"courier new",courier,monospace"><br>
          </span></div>
        <div dir="auto"><span style="font-family:"courier new",courier,monospace">av1_qsv @
            0x556a3f653040] 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.</span><span style="font-family:"courier new",courier,monospace"><br>
          </span></div>
        <div dir="auto"><span style="font-family:"courier new",courier,monospace">====</span></div>
        <div dir="auto"><br>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
    <br>
    To make a direct speed performance comparison between this GPU
    -Hwaccel AV1_QSV encoding and my previou CPU based SVT-AV1 encoding,
    I have used the same ffmpeg command line  parameters and preset 4,
    and iterated similar bitrate and file size as follows:<br>
    <br>
    <font face="Courier New, Courier, monospace">SD-DV -> AV1<br>
      ------------<br>
    </font>
    <blockquote><font face="Courier New, Courier, monospace">SVT-AV1:</font><br>
      <font face="Courier New, Courier, monospace">ffmpeg -hide_banner
        -i dv01_07.dv -c:v libsvtav1 -preset 4 -crf 35 -c:a libvorbis
        dv01_07_svt-av1_pr4.webm</font><br>
      <font face="Courier New, Courier, monospace">frame= 2832 fps= 50
        q=35.0 Lsize=   24159KiB time=00:01:53.24 bitrate=1747.7kbits/s
        speed=   2x </font><br>
      <br>
      <font face="Courier New, Courier, monospace">AV1_QSV:</font><br>
      <font face="Courier New, Courier, monospace">ffmpeg -hide_banner
        -hwaccel_output_format qsv -qsv_device /dev/dri/renderD128 -i
        dv01_07.dv -c:v av1_qsv -preset 4 -b:v 1570k -crf 35 -c:a
        libvorbis dv01_07_av1_qsv_pr4_b1570k.webm</font><br>
      <font face="Courier New, Courier, monospace">frame= 2832 fps=1891
        q=-0.0 Lsize=   24166KiB time=00:01:53.24 bitrate=1748.2kbits/s
        speed=75.6x  </font><br>
    </blockquote>
    <br>
    That is, AV1_QSV DV transcoding speed 75.6x/2x ~ 38x or fps 1891/50
    ~ 38 faster than corresponding with SVT-AV1.<br>
    <br>
    File sizes:<br>
    <blockquote><font face="Courier New, Courier, monospace">389M   
        dv01_07.dv<br>
        24M    dv01_07_svt-av1_pr4.webm<br>
        24M    dv01_07_av1_qsv_pr4_b1557k.webm</font><br>
    </blockquote>
    <br>
    <font face="Courier New, Courier, monospace">HDV -> AV1<br>
      ----------<br>
    </font>
    <blockquote><font face="Courier New, Courier, monospace">SVT-AV1:</font><br>
      <font face="Courier New, Courier, monospace">ffmpeg -hide_banner
        -i hdv09_04.m2t -c:v libsvtav1 -preset 4 -crf 35 -c:a libvorbis
        hdv09_04_svt-av1_pr4.webm</font><br>
      <font face="Courier New, Courier, monospace">frame= 5963 fps= 24
        q=35.0 Lsize=  113663KiB time=00:03:58.77 bitrate=3899.6kbits/s
        speed=0.948x </font><br>
      <br>
      <font face="Courier New, Courier, monospace">AV1_QSV:</font><br>
      <font face="Courier New, Courier, monospace">ffmpeg -hide_banner
        -hwaccel_output_format qsv -qsv_device /dev/dri/renderD128
        -extra_hw_frames 16 -i hdv09_04.m2t -c:v av1_qsv -preset 4 -b:v
        3700k hdv09_04_av1_qsv_pr4_bv3700k.webm</font><br>
      <font face="Courier New, Courier, monospace">frame= 5963 fps=482
        q=-0.0 Lsize=  113271KiB time=00:03:58.77 bitrate=3886.1kbits/s
        speed=19.3x    </font><br>
    </blockquote>
    <br>
    That is, AV1_QSV HDV transcoding speed 19.3x/0.948x ~ 20x or fps
    482/24 ~ 20 faster than corresponding with SVT-AV1</div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">impressive!</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><font face="Courier New, Courier, monospace"><br>
    </font>
    <font face="Courier New, Courier, monospace"><br>
      File sizes:<br>
    </font>
    <blockquote><font face="Courier New, Courier, monospace">745M   
        hdv09_04.m2t<br>
        111M    hdv09_04_svt-av1_pr4.webm<br>
        111M    hdv09_04_av1_qsv_pr4_bv3700k.webm<br>
        <br>
      </font>
    </blockquote>
    ------------------<br></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">I also hope quality is "good enough" for final/delivery transcode ...</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>
    <br>
    FFmpeg output for the latest QSV_AV1 transcoding follows.<br>
    As seen the error messages messages are gone, though not quite clean
    as there are still some "disturbing" mpeg2video messages. <br>
    <br>
    SD-DV -> AV1<br>
    <font face="Courier New, Courier, monospace">----------</font><br>
    <font face="Courier New, Courier, monospace">ffmpeg -hide_banner
      -hwaccel_output_format qsv -qsv_device /dev/dri/renderD128 -i
      dv01_07.dv -c:v av1_qsv -preset 4 -b:v 1570k -crf 35 -c:a
      libvorbis dv01_07_av1_qsv_pr4_b1570k.webm<br>
      <br>
      libva info: VA-API version 1.21.0<br>
      libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so<br>
      libva info: Found init function __vaDriverInit_1_20<br>
      libva info: va_openDriver() returns 0<br>
      libva info: VA-API version 1.21.0<br>
      libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so<br>
      libva info: Found init function __vaDriverInit_1_20<br>
      libva info: va_openDriver() returns 0<br>
      [dv @ 0x5614ce553080] Estimating duration from bitrate, this may
      be inaccurate<br>
      Input #0, dv, from 'dv01_07.dv':<br>
        Metadata:<br>
          timecode        : 01:09:35:09<br>
        Duration: 00:01:53.28, start: 0.000000, bitrate: 28800 kb/s<br>
        Stream #0:0: Video: dvvideo, yuv420p, 720x576 [SAR 16:15 DAR
      4:3], 28800 kb/s, 60k fps, 25 tbr, 60k tbn<br>
        Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s<br>
      [out#0/webm @ 0x5614ce3ea640] Codec AVOption crf (Select the
      quality for constant quality mode) has not been used for any
      stream. The most likely reason is either wrong type (e.g. a video
      option with no video streams) or that it is a private option of
      some encoder which was not actually used for any stream.<br>
      Stream mapping:<br>
        Stream #0:0 -> #0:0 (dvvideo (native) -> av1 (av1_qsv))<br>
        Stream #0:1 -> #0:1 (pcm_s16le (native) -> vorbis
      (libvorbis))<br>
      Press [q] to stop, [?] for help<br>
      Output #0, webm, to 'dv01_07_av1_qsv_pr4_b1570k.webm':<br>
        Metadata:<br>
          timecode        : 01:09:35:09<br>
          encoder         : Lavf61.1.100<br>
        Stream #0:0: Video: av1, nv12(bottom coded first (swapped)),
      720x576 [SAR 16:15 DAR 4:3], q=2-31, 1570 kb/s, 25 fps, 1k tbn<br>
            Metadata:<br>
              encoder         : Lavc61.3.100 av1_qsv<br>
        Stream #0:1: Audio: vorbis, 48000 Hz, stereo, fltp<br>
            Metadata:<br>
              encoder         : Lavc61.3.100 libvorbis<br>
      [out#0/webm @ 0x5614ce3ea640] video:22613KiB audio:1495KiB
      subtitle:0KiB other streams:0KiB global headers:4KiB muxing
      overhead: 0.244968%<br>
      frame= 2832 fps=1891 q=-0.0 Lsize=   24166KiB time=00:01:53.24
      bitrate=1748.2kbits/s speed=75.6x  <br>
      <br>
      <br>
      HDV->AV1<br>
      ---------<br>
      ffmpeg -hide_banner -hwaccel_output_format qsv -qsv_device
      /dev/dri/renderD128 -extra_hw_frames 16 -i hdv09_04.m2t -c:v
      av1_qsv -preset 4 -b:v 3700k hdv09_04_av1_qsv_pr4_bv3700k.webm<br>
      <br>
      libva info: VA-API version 1.21.0<br>
      libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so<br>
      libva info: Found init function __vaDriverInit_1_20<br>
      libva info: va_openDriver() returns 0<br>
      libva info: VA-API version 1.21.0<br>
      libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so<br>
      libva info: Found init function __vaDriverInit_1_20<br>
      libva info: va_openDriver() returns 0<br>
      [mpeg2video @ 0x5607564ea600] Invalid frame dimensions 0x0.<br>
          Last message repeated 3 times<br>
      [mpegts @ 0x56075643ee00] PES packet size mismatch<br>
      [mpegts @ 0x56075643ee00] Packet corrupt (stream = 1, dts =
      258142320).<br>
      [mpegts @ 0x56075643ee00] Could not find codec parameters for
      stream 2 (Unknown: none ([160][0][0][0] / 0x00A0)): unknown codec<br>
      Consider increasing the value for the 'analyzeduration' (0) and
      'probesize' (5000000) options<br>
      [mpegts @ 0x56075643ee00] Could not find codec parameters for
      stream 3 (Unknown: none ([161][0][0][0] / 0x00A1)): unknown codec<br>
      Consider increasing the value for the 'analyzeduration' (0) and
      'probesize' (5000000) options<br>
      Input #0, mpegts, from 'hdv09_04.m2t':<br>
        Duration: 00:03:59.06, start: 2629.496000, bitrate: 26110 kb/s<br>
        Program 100 <br>
        Stream #0:0[0x810]: Video: mpeg2video (Main) ([2][0][0][0] /
      0x0002), yuv420p(tv, bt709, top first), 1440x1080 [SAR 4:3 DAR
      16:9], 25000 kb/s, 25 fps, 25 tbr, 90k tbn<br>
            Side data:<br>
              cpb: bitrate max/min/avg: 25000000/0/0 buffer size:
      7340032 vbv_delay: N/A<br>
        Stream #0:1[0x814]: Audio: mp2 (mp3float) ([3][0][0][0] /
      0x0003), 48000 Hz, stereo, fltp, 384 kb/s<br>
        Stream #0:2[0x815]: Unknown: none ([160][0][0][0] / 0x00A0)<br>
        Stream #0:3[0x811]: Unknown: none ([161][0][0][0] / 0x00A1)<br>
      Stream mapping:<br>
        Stream #0:0 -> #0:0 (mpeg2video (native) -> av1 (av1_qsv))<br>
        Stream #0:1 -> #0:1 (mp2 (native) -> opus (libopus))<br>
      Press [q] to stop, [?] for help<br>
      [libopus @ 0x560756595f80] No bit rate set. Defaulting to 96000
      bps.<br>
      Output #0, webm, to 'hdv09_04_av1_qsv_pr4_bv3700k.webm':<br>
        Metadata:<br>
          encoder         : Lavf61.1.100<br>
        Stream #0:0: Video: av1, nv12(tv, bt709, top coded first
      (swapped)), 1440x1080 [SAR 4:3 DAR 16:9], q=2-31, 3700 kb/s, 25
      fps, 1k tbn<br>
            Metadata:<br>
              encoder         : Lavc61.3.100 av1_qsv<br>
        Stream #0:1: Audio: opus, 48000 Hz, stereo, s16, 96 kb/s<br>
            Metadata:<br>
              encoder         : Lavc61.3.100 libopus<br>
      [mpegts @ 0x56075643ee00] PES packet size mismatch0:03:51.36
      bitrate=3834.3kbits/s speed=19.3x    <br>
      [mpegts @ 0x56075643ee00] Packet corrupt (stream = 1, dts =
      258142320).<br>
      [mpeg2video @ 0x560756595500] ac-tex damaged at 10 61<br>
      [mpeg2video @ 0x560756595500] Warning MVs not available<br>
      [mpeg2video @ 0x560756595500] concealing 630 DC, 630 AC, 630 MV
      errors in P frame<br>
      [vist#0:0/mpeg2video @ 0x5607564f6940] [dec:mpeg2video @
      0x560756440480] corrupt decoded frame<br>
      [out#0/webm @ 0x5607565b2040] video:110669KiB audio:2490KiB
      subtitle:0KiB other streams:0KiB global headers:0KiB muxing
      overhead: 0.098391%<br>
      frame= 5963 fps=482 q=-0.0 Lsize=  113271KiB time=00:03:58.77
      bitrate=3886.1kbits/s speed=19.3x    <br>
      </font></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto">so, may be after whole setup was verified to function correctly at least in bare ffmpeg we can iterate back to vaapi for creating  cingg profile  ? (if I understand correctly qsv adds additional layer/library on top of vaapi driver - not something I wish to deal with in appimage packaging ....)</div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><font face="Courier New, Courier, monospace"><br>
    </font><br>
    <br>
  </div>

</blockquote></div></div></div>