сб, 26 апр. 2025 г., 22:34 Terje Hanssen <terjejhanssen@gmail.com>:


On 4/26/25 18:09, Andrew Randrianasulu wrote:
> On Sat, Apr 26, 2025 at 8:28 PM Terje Hanssen via Cin
> <cin@lists.cinelerra-gg.org> wrote:
>> 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!
>>
>> =====================

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

I am afraid I don't understand how to "link vulkan decode and filtering
via common naming?"
Could you possibly give me one or two examples to test with my code line?

It was note to myself on this part of ffmpeg command line I was missing/misusing in my attempts:

ffmpeg -hide_banner -init_hw_device vulkan=vk:0 -filter_hw_device vk -i file ....

so ot inits hw device of type vulkan and gives it name, vk:0 and then filter_hw_device uses same name.

I was getting error because I used only -init_hw_device vulkan without "=name" part.

But still similar filtering error. 

Now building ffmpeg.git to see if anything improved there ....





>
> 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$
>
>
>
>> Benchmarking works:
>>
>> ffmpeg -hide_banner -init_hw_device "vulkan=vk:0" -hwaccel vulkan
>> -hwaccel_output_format vulkan -i hdv09_04_h264_qsv_8b420.mp4 -f null -
>> -benchmark
>> 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) -> wrapped_avframe (native))
>>     Stream #0:1 -> #0:1 (aac (native) -> pcm_s16le (native))
>> Press [q] to stop, [?] for help
>> Output #0, null, to 'pipe:':
>>     Metadata:
>>       major_brand     : isom
>>       minor_version   : 512
>>       compatible_brands: isomiso2avc1mp41
>>       encoder         : Lavf61.7.100
>>     Stream #0:0(und): Video: wrapped_avframe, vulkan(pc,
>> smpte170m/unknown/unknown, progressive), 1440x1080 [SAR 4:3 DAR 16:9],
>> q=2-31, 200 kb/s, 25 fps, 25 tbn (default)
>>         Metadata:
>>           handler_name    : VideoHandler
>>           vendor_id       : [0][0][0][0]
>>           encoder         : Lavc61.19.101 wrapped_avframe
>>     Stream #0:1(eng): Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
>> (default)
>>         Metadata:
>>           handler_name    : SoundHandler
>>           vendor_id       : [0][0][0][0]
>>           encoder         : Lavc61.19.101 pcm_s16le
>>
>>
>>
>> --
>> Cin mailing list
>> Cin@lists.cinelerra-gg.org
>> https://lists.cinelerra-gg.org/mailman/listinfo/cin