<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <br>
    <div class="moz-cite-prefix">Den 26.04.2025 18:09, skrev Andrew
      Randrianasulu:<br>
    </div>
    <blockquote type="cite"
cite="mid:CA+rFky7wQwNeT3zutDahvVrT65Kb3mmwtNNvpsUCAWJ8vxJ+Sw@mail.gmail.com">
      <pre wrap="" class="moz-quote-pre">On Sat, Apr 26, 2025 at 8:28 PM Terje Hanssen via Cin
<a class="moz-txt-link-rfc2396E" href="mailto:cin@lists.cinelerra-gg.org"><cin@lists.cinelerra-gg.org></a> wrote:
</pre>
      <blockquote type="cite">
        <pre wrap="" class="moz-quote-pre">
I have yet to get my system ffmpeg vulkan video transcoding to work on
my machines, while benchmarking works.
Therefore I hope get verified if my code line is correct, and how to fix
possible syntax errors.

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

Dell XPS 13-9370 ultrabook

ffmpeg version 7.1.1 built with gcc 14 (SUSE Linux)

inxi -CGSz
System:
   Kernel: 6.12.24-1.0.2.sr20250402-longterm arch: x86_64 bits: 64
   Desktop: GNOME v: 48.0 Distro: openSUSE Tumbleweed-Slowroll 20250402
CPU:
   Info: quad core model: Intel Core i7-8550U bits: 64 type: MT MCP cache:
     L2: 1024 KiB
   Speed (MHz): avg: 900 min/max: 400/4000 cores: 1: 900 2: 900 3: 900
4: 900
     5: 900 6: 900 7: 900 8: 900
Graphics:
   Device-1: Intel UHD Graphics 620 driver: i915 v: kernel
   Device-2: Realtek Integrated_Webcam_HD driver: uvcvideo type: USB
   Display: wayland server: X.org v: 1.21.1.15 with: Xwayland v: 24.1.6
     compositor: gnome-shell driver: gpu: i915 resolution: 3840x2160~60Hz
   API: OpenGL v: 4.6 vendor: intel mesa v: 25.0.3 renderer: Mesa Intel UHD
     Graphics 620 (KBL GT2)
   API: Vulkan v: 1.4.309 drivers: N/A surfaces: xcb,xlib,wayland
   API: EGL Message: EGL data requires eglinfo. Check --recommends.
   Info: Tools: api: glxinfo,vulkaninfo x11: xprop,xrandr

=========================

export VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/intel_icd.x86_64.json
export ANV_VIDEO_DECODE=1
export ANV_VIDEO_ENCODE=1


Transcoding fails:

ffmpeg -hide_banner -init_hw_device vulkan=vk:0 -filter_hw_device vk -i
hdv09_04_h264_qsv_8b420.mp4 -c:v hevc_vulkan test_hevc.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'hdv09_04_h264_qsv_8b420.mp4':
   Metadata:
     major_brand     : isom
     minor_version   : 512
     compatible_brands: isomiso2avc1mp41
     encoder         : Lavf61.1.100
   Duration: 00:03:58.88, start: 0.000000, bitrate: 7671 kb/s
   Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661),
yuvj420p(pc, smpte170m/unknown/unknown, progressive), 1440x1080 [SAR 4:3
DAR 16:9], 7536 kb/s, 25 fps, 25 tbr, 12800 tbn (default)
       Metadata:
         handler_name    : VideoHandler
         vendor_id       : [0][0][0][0]
   Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, fltp, 129 kb/s (default)
       Metadata:
         handler_name    : SoundHandler
         vendor_id       : [0][0][0][0]
Stream mapping:
   Stream #0:0 -> #0:0 (h264 (native) -> hevc (hevc_vulkan))
   Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
Impossible to convert between the formats supported by the filter
'Parsed_null_0' and the filter 'auto_scale_0'
[vf#0:0 @ 0x561e923dd540] Error reinitializing filters!
[vf#0:0 @ 0x561e923dd540] Task finished with error code: -38 (Function
not implemented)
[vf#0:0 @ 0x561e923dd540] Terminating thread with return code -38
(Function not implemented)
[vost#0:0/hevc_vulkan @ 0x561e9243b200] Could not open encoder before EOF
[vost#0:0/hevc_vulkan @ 0x561e9243b200] Task finished with error code:
-22 (Invalid argument)
[vost#0:0/hevc_vulkan @ 0x561e9243b200] Terminating thread with return
code -22 (Invalid argument)
[out#0/mp4 @ 0x561e924a7a00] Nothing was written into output file,
because at least one of its streams received no packets.
frame=    0 fps=0.0 q=0.0 Lsize=       0KiB time=N/A bitrate=N/A speed=N/A
[aac @ 0x561e92cc4f80] Qavg: 208.809
Conversion failed!

=====================
</pre>
      </blockquote>
      <pre wrap="" class="moz-quote-pre">

ah, syntax was slightly different, you apparently need to "link"
vulcan decode and filtering via common naming?

My line fails in similar way:

./bin/ffmpeg711-vulkan  -init_hw_device vulkan=vk:0 -filter_hw_device
vk  -hwaccel vaapi -hwaccel_output_format vaapi -i
~/K38_sdcard1/Documents/iPhone11_4K-recorder_59.940HDR10.mov -vf
libplacebo=colorspace=bt709:color_primaries=bt709:color_trc=bt709:range=tv
-c:a copy -c:v hevc_vulkan  -f avi  /dev/null
ffmpeg version 7.1.1 Copyright (c) 2000-2025 the FFmpeg developers
  built with gcc 11.2.0 (GCC)
  configuration: --enable-opencl --disable-debug --enable-libx265
--enable-libx264 --enable-gpl --enable-libplacebo --enable-vulkan
--enable-libshaderc --enable-libzimg --enable-libaom --enable-libdav1d
--enable-libsoxr --enable-libfontconfig --enable-libfreetype
--enable-libfribidi --enable-gnutls --enable-libass --enable-libbluray
--enable-libcdio --enable-frei0r --enable-libgsm --enable-openal
--enable-libopus --enable-librtmp --enable-libsnappy --enable-libspeex
--enable-libssh --enable-libtheora --enable-libtwolame
--enable-libv4l2 --enable-libvidstab --enable-libvorbis
--enable-libvpx --enable-libwebp
  libavutil      59. 39.100 / 59. 39.100
  libavcodec     61. 19.101 / 61. 19.101
  libavformat    61.  7.100 / 61.  7.100
  libavdevice    61.  3.100 / 61.  3.100
  libavfilter    10.  4.100 / 10.  4.100
  libswscale      8.  3.100 /  8.  3.100
  libswresample   5.  3.100 /  5.  3.100
  libpostproc    58.  3.100 / 58.  3.100
[aist#0:1/pcm_s16le @ 0xc4c4740] Guessed Channel Layout: stereo
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
'/home/guest/K38_sdcard1/Documents/iPhone11_4K-recorder_59.940HDR10.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 0
    compatible_brands: qt
    creation_time   : 2020-12-18T22:20:29.000000Z
    com.apple.quicktime.creationdate: 2020-12-18T17:20:29-0500
    com.apple.quicktime.location.ISO6709: +33.4233-084.5802/
  Duration: 00:00:19.16, start: 0.000000, bitrate: 69140 kb/s
  Stream #0:0[0x1](und): Video: hevc (Main 10) (hvc1 / 0x31637668),
yuv420p10le(pc, bt2020nc/bt2020/smpte2084), 3840x2160, 64166 kb/s,
59.92 fps, 59.94 tbr, 600 tbn (default)
      Metadata:
        creation_time   : 2020-12-18T22:20:29.000000Z
        handler_name    : Core Media Video
        vendor_id       : [0][0][0][0]
        encoder         : HEVC
  Stream #0:1[0x2](und): Audio: pcm_s16le (lpcm / 0x6D63706C), 48000
Hz, stereo, s16, 1536 kb/s (default)
      Metadata:
        creation_time   : 2020-12-18T22:20:29.000000Z
        handler_name    : Core Media Audio
        vendor_id       : [0][0][0][0]
File '/dev/null' already exists. Overwrite? [y/N] y
Stream mapping:
  Stream #0:0 -> #0:0 (hevc (native) -> hevc (hevc_vulkan))
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
Impossible to convert between the formats supported by the filter
'graph -1 input from stream 0:0' and the filter 'auto_scale_0'
[vf#0:0 @ 0xc4e1a00] Error reinitializing filters!
[vf#0:0 @ 0xc4e1a00] Task finished with error code: -38 (Function not
implemented)
[vf#0:0 @ 0xc4e1a00] Terminating thread with return code -38 (Function
not implemented)
[vost#0:0/hevc_vulkan @ 0xc43b780] Could not open encoder before EOF
[vost#0:0/hevc_vulkan @ 0xc43b780] Task finished with error code: -22
(Invalid argument)
[vost#0:0/hevc_vulkan @ 0xc43b780] Terminating thread with return code
-22 (Invalid argument)
[out#0/avi @ 0xc43be00] Nothing was written into output file, because
at least one of its streams received no packets.
frame=    0 fps=0.0 q=0.0 Lsize=       0KiB time=N/A bitrate=N/A speed=N/A
Conversion failed!
bash-5.1$

</pre>
    </blockquote>
    <br>
    I am still struggling to get vulkan transcoding to work on Intel
    i7-12700KF with<br>
    <blockquote>API: OpenGL v: 4.6 compat-v: 4.5 vendor: intel mesa v:
      25.0.5<br>
          renderer: Mesa Intel Arc A750 Graphics (DG2)<br>
        API: Vulkan v: 1.4.309 drivers: N/A surfaces: xcb,xlib<br>
    </blockquote>
    Because the corresponding ffmpeg syntax works fine using "vaapi"
    instead of "vulkan", I hope to get a modified syntax for vulkan to
    try:<br>
    <br>
    <font face="monospace">ffmpeg -hide_banner -init_hw_device vulkan -i
      hdv09_04.m2t -vf format=nv12,hwupload -c:v hevc_vulkan -y
      hdv09_04_hevc_vulkan_nv12.mp4<br>
      <br>
      [mpeg2video @ 0x563224f43f00] Invalid frame dimensions 0x0.<br>
          Last message repeated 3 times<br>
      [mpegts @ 0x563224f22240] PES packet size mismatch<br>
      [mpegts @ 0x563224f22240] Packet corrupt (stream = 1, dts =
      258142320).<br>
      [mpegts @ 0x563224f22240] 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 @ 0x563224f22240] 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>
      <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) -> hevc
      (hevc_vulkan))<br>
        Stream #0:1 -> #0:1 (mp2 (native) -> aac (native))<br>
      Press [q] to stop, [?] for help<br>
      [hevc_vulkan @ 0x563224f1fa80] No rate control settings specified,
      using fixed QP = 18<br>
      <br>
      Output #0, mp4, to 'hdv09_04_hevc_vulkan_nv12.mp4':<br>
        Metadata:<br>
          encoder         : Lavf61.7.100<br>
        Stream #0:0: Video: hevc (Main) (hev1 / 0x31766568), vulkan(tv,
      bt709, top coded first (swapped)), 1440x1080 [SAR 4:3 DAR 16:9],
      q=2-31, 25 fps, 12800 tbn<br>
            Metadata:<br>
              encoder         : Lavc61.19.101 hevc_vulkan<br>
        Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
      stereo, fltp, 128 kb/s<br>
            Metadata:<br>
              encoder         : Lavc61.19.101 aac<br>
      <br>
      [hevc_vulkan @ 0x563224f1fa80] Encode failed: -167801120.<br>
      [vost#0:0/hevc_vulkan @ 0x563224f62500] Error submitting video
      frame to the encoder<br>
      [vost#0:0/hevc_vulkan @ 0x563224f62500] Error encoding a frame:
      Error number -167801120 occurred<br>
      [vost#0:0/hevc_vulkan @ 0x563224f62500] Task finished with error
      code: -167801120 (Error number -167801120 occurred)<br>
      [vost#0:0/hevc_vulkan @ 0x563224f62500] Terminating thread with
      return code -167801120 (Error number -167801120 occurred)<br>
      Unable to submit command buffer: VK_ERROR_DEVICE_LOST<br>
      [hwupload @ 0x7f05d4004440] Failed to upload frame: -542398533.<br>
      [vf#0:0 @ 0x563224f3f8c0] Error while filtering: Generic error in
      an external library<br>
      [vf#0:0 @ 0x563224f3f8c0] Task finished with error code:
      -542398533 (Generic error in an external library)<br>
      [vf#0:0 @ 0x563224f3f8c0] Terminating thread with return code
      -542398533 (Generic error in an external library)<br>
      [out#0/mp4 @ 0x563224f41d80] video:0KiB audio:21KiB subtitle:0KiB
      other streams:0KiB global headers:0KiB muxing overhead: 5.119681%<br>
      frame=    0 fps=0.0 q=0.0 Lsize=      22KiB time=N/A bitrate=N/A
      speed=N/A    <br>
      [aac @ 0x563224f4a6c0] Qavg: 179.018<br>
      Conversion failed!<br>
    </font><br>
    <br>
    <br>
  </body>
</html>