Den 02.12.2025 21:18, skrev Andrew Randrianasulu:


вт, 2 дек. 2025 г., 22:45 Terje J. Hanssen <[email protected]>:



    Den 02.12.2025 15:48, skrev Andrew Randrianasulu:
    On Tue, Dec 2, 2025 at 5:11 PM Terje J. Hanssen via ffmpeg-user
    <[email protected]> <mailto:[email protected]> wrote:
    Hello list members

    Any ideas and suggestions to how to get ffmpeg vulkan video transcoding
    to work?
    All my attempts so far are unsuccessful and finish with Conversion failed!
    Below is one code line with verbose output.

    Terje J. Hanssen

    --------

    My system and hardware
        Kernel: 6.12.59-1-longterm arch: x86_64 bits: 64
        Desktop: GNOME v: 49.1 Distro: openSUSE Tumbleweed-Slowroll 20251106
    Graphics:   Device-1: Intel DG2 [Arc A750] driver: i915 v: kernel

    with
    Vulkan v. 25.2.6, Mesa  v. 25.2.6 and system ffmpeg-8 v. 8.0 (from Packman)

    I can verify the following ffmpeg Vulkan video support:

    ffmpeg -hide_banner -encoders | grep vulkan
       V....D av1_vulkan           AV1 (Vulkan) (codec av1)
       V....D ffv1_vulkan          FFmpeg video codec #1 (Vulkan) (codec ffv1)
       V....D h264_vulkan          H.264/AVC (Vulkan) (codec h264)
       V....D hevc_vulkan          H.265/HEVC (Vulkan) (codec hevc)

    And by enabling both Vulkan video decode and encode support in the ANV
    driver via the following environment variable

              export ANV_DEBUG="video-decode,video-encode"

    I can verify the following Vulkan Video Encode support:

    vulkaninfo | grep -i encode
          VK_KHR_video_encode_h264                      : extension revision 14
          VK_KHR_video_encode_h265                      : extension revision 14
          VK_KHR_video_encode_queue                     : extension revision 12
              queueFlags                  = QUEUE_VIDEO_DECODE_BIT_KHR |
    QUEUE_VIDEO_ENCODE_BIT_KHR
                      VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR
                      VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR

    --------

    ffmpeg -hide_banner -v verbose -init_hw_device "vulkan=vk:0" -hwaccel
    vulkan -hwaccel_output_format vulkan -i hdv09_04.m2t -c:v h264_vulkan -y
    hdv09_04_h264_vulkan.mp4
    I *suspect* mpeg2 decoding is not supported by Vulkan video ? Unless
    someone reesurrect Mesa shaders that used to work at some point as
    vulkan compute shaders ?

    Try different (h264, h265, vp9, av1) input file ?

    What I can tell is that ffmpeg vulkan decoding benchmarks using
    mpeg2 seemingly has worked better for a long time according to
    https://trac.ffmpeg.org/wiki/HWAccelIntro#Vulkan

    ffmpeg -hide_banner -init_hw_device "vulkan=vk:0" -hwaccel vulkan
    -hwaccel_output_format vulkan -i hdv09_04.m2t -f null - -benchmark
    .........snip
    [mpegts @ 0x563c726901c0] PES packet size mismatch.88 bitrate=N/A
    speed= 145x elapsed=0:00:01.50
    [mpegts @ 0x563c726901c0] Packet corrupt (stream = 1, dts =
    258142320).
    [mpeg2video @ 0x563c72653500] ac-tex damaged at 10 61
    [mpeg2video @ 0x563c72653500] Warning MVs not available
    [mpeg2video @ 0x563c72653500] concealing 630 DC, 630 AC, 630 MV
    errors in P frame
    [vist#0:0/mpeg2video @ 0x563c726e3b00] [dec:mpeg2video @
    0x563c726d4e40] corrupt decoded frame
    [out#0/null @ 0x563c726d5140] video:2422KiB audio:44770KiB
    subtitle:0KiB other streams:0KiB global headers:0KiB muxing
    overhead: unknown
    frame= 5963 fps=3635 q=-0.0 Lsize=N/A time=00:03:58.77 bitrate=N/A
    speed= 146x elapsed=0:00:01.64
    bench: utime=19.196s stime=0.323s rtime=1.641s
    bench: maxrss=185604KiB


Strange, may be some software decoding fallback patch now gets broken in ffmpeg? URL dies not list MPEG2 as Vulkan decodeable ...

Do you have older ffmpeg (7.0, 7.1) around?



I reinstalled ffmpeg-7 v. 7.1  (Packman version) and retested the same mpeg2video (hdv1080i50.m2t) video file using the Vulkan decoding benchmark.

First, the normal output seemingly looks better than the previous ffmpeg-8 test:

ffmpeg -hide_banner -init_hw_device "vulkan=vk:0" -hwaccel vulkan -hwaccel_output_format vulkan -i hdv09_04.m2t -f null - -benchmark

[mpeg2video @ 0x55b810cb0f80] Invalid frame dimensions 0x0.
    Last message repeated 3 times
[mpegts @ 0x55b810d2c180] PES packet size mismatch
[mpegts @ 0x55b810d2c180] Packet corrupt (stream = 1, dts = 258142320).
[mpegts @ 0x55b810d2c180] Could not find codec parameters for stream 2 (Unknown: none ([160][0][0][0] / 0x00A0)): unknown codec Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options [mpegts @ 0x55b810d2c180] Could not find codec parameters for stream 3 (Unknown: none ([161][0][0][0] / 0x00A1)): unknown codec Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options

Input #0, mpegts, from 'hdv09_04.m2t':
  Duration: 00:03:59.06, start: 2629.496000, bitrate: 26110 kb/s
  Program 100
  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
      Side data:
        cpb: bitrate max/min/avg: 25000000/0/0 buffer size: 7340032 vbv_delay: N/A   Stream #0:1[0x814]: Audio: mp2 (mp3float) ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 384 kb/s
  Stream #0:2[0x815]: Unknown: none ([160][0][0][0] / 0x00A0)
  Stream #0:3[0x811]: Unknown: none ([161][0][0][0] / 0x00A1)
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video (native) -> wrapped_avframe (native))
  Stream #0:1 -> #0:1 (mp2 (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help

Output #0, null, to 'pipe:':
  Metadata:
    encoder         : Lavf61.7.100
  Stream #0:0: Video: wrapped_avframe, yuv420p(tv, bt709, top coded first (swapped)), 1440x1080 [SAR 4:3 DAR 16:9], q=2-31, 200 kb/s, 25 fps, 25 tbn
      Metadata:
        encoder         : Lavc61.19.101 wrapped_avframe
  Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
      Metadata:
        encoder         : Lavc61.19.101 pcm_s16le

[mpegts @ 0x55b810d2c180] PES packet size mismatch.00 bitrate=N/A speed= 148x
[mpegts @ 0x55b810d2c180] Packet corrupt (stream = 1, dts = 258142320).
[mpeg2video @ 0x55b810cf0940] ac-tex damaged at 10 61
[mpeg2video @ 0x55b810cf0940] Warning MVs not available
[mpeg2video @ 0x55b810cf0940] concealing 630 DC, 630 AC, 630 MV errors in P frame [vist#0:0/mpeg2video @ 0x55b811857440] [dec:mpeg2video @ 0x55b8118595c0] corrupt decoded frame [out#0/null @ 0x55b811864f80] video:2562KiB audio:44770KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknown

frame= 5963 fps=3693 q=-0.0 Lsize=N/A time=00:03:58.77 bitrate=N/A speed= 148x
bench: utime=18.656s stime=0.245s rtime=1.615s
bench: maxrss=197916KiB

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

So, the ffmpeg 7.1 decoding benchmark with verbose output, which possibly tell more what really happends:

ffmpeg -hide_banner -v verbose -init_hw_device "vulkan=vk:0" -hwaccel vulkan -hwaccel_output_format vulkan -i hdv09_04.m2t -f null - -benchmark

[AVHWDeviceContext @ 0x557c5b0e6140] Supported layers:
[AVHWDeviceContext @ 0x557c5b0e6140] VK_LAYER_MESA_device_select
[AVHWDeviceContext @ 0x557c5b0e6140]    VK_LAYER_MESA_overlay
[AVHWDeviceContext @ 0x557c5b0e6140] VK_LAYER_KHRONOS_validation
[AVHWDeviceContext @ 0x557c5b0e6140] Using instance extension VK_KHR_portability_enumeration
[AVHWDeviceContext @ 0x557c5b0e6140] GPU listing:
[AVHWDeviceContext @ 0x557c5b0e6140]     0: Intel(R) Arc(tm) A750 Graphics (DG2) (discrete) (0x56a1) [AVHWDeviceContext @ 0x557c5b0e6140]     1: llvmpipe (LLVM 21.1.6, 256 bits) (software) (0x0) [AVHWDeviceContext @ 0x557c5b0e6140] Device 0 selected: Intel(R) Arc(tm) A750 Graphics (DG2) (discrete) (0x56a1) [AVHWDeviceContext @ 0x557c5b0e6140] Using device extension VK_KHR_push_descriptor [AVHWDeviceContext @ 0x557c5b0e6140] Using device extension VK_EXT_descriptor_buffer [AVHWDeviceContext @ 0x557c5b0e6140] Using device extension VK_EXT_physical_device_drm [AVHWDeviceContext @ 0x557c5b0e6140] Using device extension VK_EXT_shader_atomic_float [AVHWDeviceContext @ 0x557c5b0e6140] Using device extension VK_KHR_cooperative_matrix [AVHWDeviceContext @ 0x557c5b0e6140] Using device extension VK_KHR_video_maintenance1 [AVHWDeviceContext @ 0x557c5b0e6140] Using device extension VK_KHR_external_memory_fd [AVHWDeviceContext @ 0x557c5b0e6140] Using device extension VK_EXT_external_memory_dma_buf [AVHWDeviceContext @ 0x557c5b0e6140] Using device extension VK_EXT_image_drm_format_modifier [AVHWDeviceContext @ 0x557c5b0e6140] Using device extension VK_KHR_external_semaphore_fd [AVHWDeviceContext @ 0x557c5b0e6140] Using device extension VK_EXT_external_memory_host [AVHWDeviceContext @ 0x557c5b0e6140] Using device extension VK_KHR_video_queue [AVHWDeviceContext @ 0x557c5b0e6140] Using device extension VK_KHR_video_encode_queue [AVHWDeviceContext @ 0x557c5b0e6140] Using device extension VK_KHR_video_decode_queue [AVHWDeviceContext @ 0x557c5b0e6140] Using device extension VK_KHR_video_encode_h264 [AVHWDeviceContext @ 0x557c5b0e6140] Using device extension VK_KHR_video_decode_h264 [AVHWDeviceContext @ 0x557c5b0e6140] Using device extension VK_KHR_video_encode_h265 [AVHWDeviceContext @ 0x557c5b0e6140] Using device extension VK_KHR_video_decode_h265 [AVHWDeviceContext @ 0x557c5b0e6140] Using device extension VK_KHR_video_decode_av1
[AVHWDeviceContext @ 0x557c5b0e6140] Queue families:
[AVHWDeviceContext @ 0x557c5b0e6140]     0: graphics compute transfer sparse (queues: 1)
[AVHWDeviceContext @ 0x557c5b0e6140]     1: encode decode (queues: 2)
[AVHWDeviceContext @ 0x557c5b0e6140] Using device: Intel(R) Arc(tm) A750 Graphics (DG2)
[AVHWDeviceContext @ 0x557c5b0e6140] Alignments:
[AVHWDeviceContext @ 0x557c5b0e6140]  optimalBufferCopyRowPitchAlignment: 128 [AVHWDeviceContext @ 0x557c5b0e6140]     minMemoryMapAlignment:           4096
[AVHWDeviceContext @ 0x557c5b0e6140]     nonCoherentAtomSize:           64
[AVHWDeviceContext @ 0x557c5b0e6140]  minImportedHostPointerAlignment:    4096 [AVHWDeviceContext @ 0x557c5b0e6140] Using queue family 0 (queues: 1) for graphics compute transfers [AVHWDeviceContext @ 0x557c5b0e6140] Using queue family 1 (queues: 2) for encode decode

[mpegts @ 0x557c5b1d7280] parser not found for codec none, packets or times may be invalid.
    Last message repeated 3 times
[mpeg2video @ 0x557c5b15be00] Invalid frame dimensions 0x0.
    Last message repeated 3 times
[mpegts @ 0x557c5b1d7280] PES packet size mismatch
[mpegts @ 0x557c5b1d7280] Packet corrupt (stream = 1, dts = 258142320).
[mpegts @ 0x557c5b1d7280] Could not find codec parameters for stream 2 (Unknown: none ([160][0][0][0] / 0x00A0)): unknown codec Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options [mpegts @ 0x557c5b1d7280] Could not find codec parameters for stream 3 (Unknown: none ([161][0][0][0] / 0x00A1)): unknown codec Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options

Input #0, mpegts, from 'hdv09_04.m2t':
  Duration: 00:03:59.06, start: 2629.496000, bitrate: 26110 kb/s
  Program 100
  Stream #0:0[0x810]: Video: mpeg2video (Main), 1 reference frame ([2][0][0][0] / 0x0002), yuv420p(tv, bt709, top first, left), 1440x1080 [SAR 4:3 DAR 16:9], 25000 kb/s, 25 fps, 25 tbr, 90k tbn
      Side data:
        cpb: bitrate max/min/avg: 25000000/0/0 buffer size: 7340032 vbv_delay: N/A   Stream #0:1[0x814]: Audio: mp2 (mp3float) ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 384 kb/s
  Stream #0:2[0x815]: Unknown: none ([160][0][0][0] / 0x00A0)
  Stream #0:3[0x811]: Unknown: none ([161][0][0][0] / 0x00A1)
[out#0/null @ 0x557c5bfc8b80] No explicit maps, mapping streams automatically... [vost#0:0/wrapped_avframe @ 0x557c5b22a480] Created video stream from input stream 0:0 [aost#0:1/pcm_s16le @ 0x557c5b18fc40] Created audio stream from input stream 0:1
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video (native) -> wrapped_avframe (native))
  Stream #0:1 -> #0:1 (mp2 (native) -> pcm_s16le (native))
[vost#0:0/wrapped_avframe @ 0x557c5b22a480] Starting thread...
[aost#0:1/pcm_s16le @ 0x557c5b18fc40] Starting thread...
[vf#0:0 @ 0x557c5bdf2f00] Starting thread...
[af#0:1 @ 0x557c5bfb15c0] Starting thread...
[vist#0:0/mpeg2video @ 0x557c5b115cc0] [dec:mpeg2video @ 0x557c5b19bd40] Starting thread... [aist#0:1/mp2 @ 0x557c5b21bf40] [dec:mp2 @ 0x557c5b226c40] Starting thread...
[in#0/mpegts @ 0x557c5b0eed00] Starting thread...
Press [q] to stop, [?] for help
[graph_-1_in_0:1 @ 0x7fdb7c004480] tb:1/48000 samplefmt:s16p samplerate:48000 chlayout:stereo [format_out_#0:1 @ 0x7fdb7c004e40] auto-inserting filter 'auto_aresample_0' between the filter 'Parsed_anull_0' and the filter 'format_out_#0:1' [auto_aresample_0 @ 0x7fdb7c005840] ch:2 chl:stereo fmt:s16p r:48000Hz -> ch:2 chl:stereo fmt:s16 r:48000Hz [graph -1 input from stream 0:0 @ 0x7fdb6c004500] w:1440 h:1080 pixfmt:yuv420p tb:1/90000 fr:25/1 sar:4/3 csp:bt709 range:tv [graph -1 input from stream 0:0 @ 0x7fdb6c004500] video frame properties congruent with link at pts_time: 0.464

Output #0, null, to 'pipe:':
  Metadata:
    encoder         : Lavf61.7.100
  Stream #0:0: Video: wrapped_avframe, 1 reference frame, yuv420p(tv, bt709, top coded first (swapped), left), 1440x1080 [SAR 4:3 DAR 16:9], q=2-31, 200 kb/s, 25 fps, 25 tbn
      Metadata:
        encoder         : Lavc61.19.101 wrapped_avframe
  Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
      Metadata:
        encoder         : Lavc61.19.101 pcm_s16le

[out#0/null @ 0x557c5bfc8b80] Starting thread...
[mpegts @ 0x557c5b1d7280] PES packet size mismatch.20 bitrate=N/A speed= 144x
[mpegts @ 0x557c5b1d7280] Packet corrupt (stream = 1, dts = 258142320).
[in#0/mpegts @ 0x557c5b0eed00] EOF while reading input
[in#0/mpegts @ 0x557c5b0eed00] Terminating thread with return code 0 (success) [aist#0:1/mp2 @ 0x557c5b21bf40] [dec:mp2 @ 0x557c5b226c40] Decoder thread received EOF packet [aist#0:1/mp2 @ 0x557c5b21bf40] [dec:mp2 @ 0x557c5b226c40] Decoder returned EOF, finishing [aist#0:1/mp2 @ 0x557c5b21bf40] [dec:mp2 @ 0x557c5b226c40] Terminating thread with return code 0 (success)
[af#0:1 @ 0x557c5bfb15c0] Filtergraph returned EOF, finishing
[af#0:1 @ 0x557c5bfb15c0] All consumers returned EOF
[aost#0:1/pcm_s16le @ 0x557c5b18fc40] Encoder thread received EOF
[aost#0:1/pcm_s16le @ 0x557c5b18fc40] Terminating thread with return code 0 (success)
[af#0:1 @ 0x557c5bfb15c0] Terminating thread with return code 0 (success)
[mpeg2video @ 0x557c5b19a140] ac-tex damaged at 10 61
[mpeg2video @ 0x557c5b19a140] Warning MVs not available
[mpeg2video @ 0x557c5b19a140] concealing 630 DC, 630 AC, 630 MV errors in P frame [vist#0:0/mpeg2video @ 0x557c5b115cc0] [dec:mpeg2video @ 0x557c5b19bd40] Decoder thread received EOF packet [vist#0:0/mpeg2video @ 0x557c5b115cc0] [dec:mpeg2video @ 0x557c5b19bd40] corrupt decoded frame [vist#0:0/mpeg2video @ 0x557c5b115cc0] [dec:mpeg2video @ 0x557c5b19bd40] Decoder returned EOF, finishing [vist#0:0/mpeg2video @ 0x557c5b115cc0] [dec:mpeg2video @ 0x557c5b19bd40] Terminating thread with return code 0 (success)
[vf#0:0 @ 0x557c5bdf2f00] Filtergraph returned EOF, finishing
[vf#0:0 @ 0x557c5bdf2f00] All consumers returned EOF
[vost#0:0/wrapped_avframe @ 0x557c5b22a480] Encoder thread received EOF
[vost#0:0/wrapped_avframe @ 0x557c5b22a480] Terminating thread with return code 0 (success)
[out#0/null @ 0x557c5bfc8b80] All streams finished
[out#0/null @ 0x557c5bfc8b80] Terminating thread with return code 0 (success)
[vf#0:0 @ 0x557c5bdf2f00] Terminating thread with return code 0 (success)
[out#0/null @ 0x557c5bfc8b80] Output file #0 (pipe:):
[out#0/null @ 0x557c5bfc8b80]   Output stream #0:0 (video): 5963 frames encoded; 5963 packets muxed (2623720 bytes); [out#0/null @ 0x557c5bfc8b80]   Output stream #0:1 (audio): 9949 frames encoded (11461248 samples); 9949 packets muxed (45844992 bytes);
[out#0/null @ 0x557c5bfc8b80]   Total: 15912 packets (48468712 bytes) muxed
[out#0/null @ 0x557c5bfc8b80] video:2562KiB audio:44770KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknown

frame= 5963 fps=3617 q=-0.0 Lsize=N/A time=00:03:58.77 bitrate=N/A speed= 145x
bench: utime=18.876s stime=0.243s rtime=1.649s
bench: maxrss=195040KiB
[in#0/mpegts @ 0x557c5b0eed00] Input file #0 (hdv09_04.m2t):
[in#0/mpegts @ 0x557c5b0eed00]   Input stream #0:0 (video): 5969 packets read (746102570 bytes); 5963 frames decoded; 0 decode errors; [in#0/mpegts @ 0x557c5b0eed00]   Input stream #0:1 (audio): 9949 packets read (11460450 bytes); 9949 frames decoded; 0 decode errors (11461248 samples); [in#0/mpegts @ 0x557c5b0eed00]   Total: 15918 packets (757563020 bytes) demuxed
[AVIOContext @ 0x557c5b1d7880] Statistics: 786109728 bytes read, 3 seeks

==========



    ------

    I have tried some other input files, here one mp4 that doesn't
    have the same errors, but also terminate with Conversion failed!

    ffmpeg -hide_banner -init_hw_device "vulkan=vk:0" -hwaccel vulkan
    -hwaccel_output_format vulkan -i
    mp4-example-video-download-full-hd-1920x1080.mp4 -c:v h264_vulkan
    -y mp4-example-video-download-full-hd-1920x1080_h264_vulkan.mp4
    ..........snip
    [h264_vulkan @ 0x556fed400d40] Unable to perform query:
    VK_ERROR_DEVICE_LOST!psed=0:00:01.00



wow, never saw this one! I am afraid something in kernel driver or ANV driver was upset ... With less Intel developers around I am not sure if such error will be diagnosed quickly ....

You probably can try mesa3d issue tracker, may be it will get some developer attention this way ...


I did the same transcode test using ffmpeg-7, even I'm not sure 7.1 ever supported Vulkan video encoding. Similar errors and Conversion Failed for both the mpeg2 and mp4 video files as with ffmpeg-8.


    [h264_vulkan @ 0x556fed400d40] Output failed: -542398533.
    [vost#0:0/h264_vulkan @ 0x556fed400ac0] [enc:h264_vulkan @
    0x556fed402240] Error submitting video frame to the encoder
    [vost#0:0/h264_vulkan @ 0x556fed400ac0] [enc:h264_vulkan @
    0x556fed402240] Error encoding a frame: Generic error in an
    external library
    [vost#0:0/h264_vulkan @ 0x556fed400ac0] Task finished with error
    code: -542398533 (Generic error in an external library)
    [vost#0:0/h264_vulkan @ 0x556fed400ac0] Terminating thread with
    return code -542398533 (Generic error in an external library)
    [h264 @ 0x556fed4ced40] [vk @ 0x7f117c046280] Unable to submit
    command buffer: VK_ERROR_DEVICE_LOST
    [h264 @ 0x556fed4c9400] hardware accelerator failed to decode picture
    [h264 @ 0x556fed4ced40] [vk @ 0x7f117c046280] Unable to submit
    command buffer: VK_ERROR_DEVICE_LOST
    [h264 @ 0x556fee17bb40] hardware accelerator failed to decode picture
    [out#0/mp4 @ 0x556fed3ff900] video:0KiB audio:36KiB subtitle:0KiB
    other streams:0KiB global headers:0KiB muxing overhead: 2.718802%
    frame=    0 fps=0.0 q=0.0 Lsize=      37KiB time=N/A bitrate=N/A
    speed=N/A elapsed=0:00:01.33
    [aac @ 0x556feef206c0] Qavg: 168.210
    Conversion failed!

_______________________________________________
ffmpeg-user mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to