чт, 4 дек. 2025 г., 18:22 Terje J. Hanssen <[email protected]>:

>
>
> Den 03.12.2025 23:44, skrev Andrew Randrianasulu:
>
>
>
> ср, 3 дек. 2025 г., 23:07 Terje J. Hanssen <[email protected]>:
>
>>
>> Den 03.12.2025 17:05, skrev Andrew Randrianasulu:
>>
>>
>>
>> ср, 3 дек. 2025 г., 18:18 Terje J. Hanssen <[email protected]>:
>>
>>>
>>> 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]> <[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
>>>
>>> .....snip
>>>
>> [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
>>>
>>
>> Looking at speed I think ffmpeg 7.1 just demuxes, without even trying to
>> decode? Can you test with some light -c:v like again mpeg2 or mpeg4 ?
>>
>>
>> This is using ffmpeg-7. Please correct my code lines. I can try again
>> using ffmpeg-8
>>
>> ffmpeg -hide_banner -init_hw_device "vulkan=vk:0" -hwaccel vulkan
>> -hwaccel_output_format vulkan -i hdv09_04.m2t -c:v h264_vulkan
>> hdv09_04_h264_vulkan.mp4
>> ...............
>> Impossible to convert between the formats supported by the filter
>> 'Parsed_null_0' and the filter 'auto_scale_0'
>>
>
> may be try to add -noautoscale ?
>
>> I think it might fail without hwdownload,format=yuv420p filters in this
>> case ... But I suspect it will abort earlier?
>>
>> May be ffmpeg 8.0 (at least as build for SuSE ) just complain at decoding
>> moment, instead of just silently demuxing without decoding anything?
>>
>> What happen if you set hwaccel to none or vaapi ? I guess ot should
>> decode in sw or via vaapi  in such cases, so there will be more realistic
>> decoding benchmark.
>>
>>
>> I think it should be -hwaccel none" , not just hwaccel.
>
> Just try to drop that part of cmd line? Ffmpeg should use software decoder
> in this case ....
>
> I have cleaned away some previous output and testet again with same errors
> below:
>
> Try -noautoscale
>
> ffmpeg -hide_banner -init_hw_device "vulkan=vk:0" -hwaccel vulkan
> -hwaccel_output_format vulkan -i hdv09_04.m2t -noautoscale -y -c:v
> h264_vulkan hdv09_04_h264_vulkan.mp4
> .........
> Impossible to convert between the formats supported by the filter
> 'Parsed_null_0' and the filter 'auto_scale_0'
> [vf#0:0 @ 0x561882873200] Error reinitializing filters!
> [vf#0:0 @ 0x561882873200] Task finished with error code: -38 (Function not
> implemented)
> [vf#0:0 @ 0x561882873200] Terminating thread with return code -38
> (Function not implemented)
> [vost#0:0/h264_vulkan @ 0x5618828af640] Could not open encoder before EOF
> [vost#0:0/h264_vulkan @ 0x5618828af640] Task finished with error code: -22
> (Invalid argument)
> [vost#0:0/h264_vulkan @ 0x5618828af640] Terminating thread with return
> code -22 (Invalid argument)
> [out#0/mp4 @ 0x561882938cc0] 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 @ 0x5618828a3880] Qavg: 435.976
> Conversion failed!
> ---------
>

then it was not it ....



> Try -hwaccel none
>
> ffmpeg -hide_banner -init_hw_device "vulkan=vk:0" -hwaccel none  -i
> hdv09_04.m2t -vf "hwdownload,format=yuv420p" -c:v h264_vulkan
> hdv09_04_h264_vulkan.mp4
>



I think you need hwupload,format=vulkan, so ffmpeg will decode in software,
then Upload result to vulkan device, formatted as vulkan driver (?) need.


See my other examples with ffv1_vulkan (I tested with *.mts file you send
me earlier, it worked with -vf hwupload,format=vulkan" even if hwaccel was
set to vulkan for input file.)

ffmpeg -init_hw_device vulkan -i 20081103140154.m2t -an -vf
hwupload,format=vulkan  -level 4 -strict -2 -c:v ffv1_vulkan -frames 200
v.mkv



So I think this part (decoding in software if hwaccel failed to contain
codec) works ok ...

There was specialized Vulkan encoding example at:

https://github.com/nvpro-samples/vk_video_samples/commits/main/

may be try to compile encoder part and see if it fares better than ffmpeg?


.........
> 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 @ 0x55cf0b990dc0] Error reinitializing filters!
> [vf#0:0 @ 0x55cf0b990dc0] Task finished with error code: -38 (Function not
> implemented)
> [vf#0:0 @ 0x55cf0b990dc0] Terminating thread with return code -38
> (Function not implemented)
> [vost#0:0/h264_vulkan @ 0x55cf0c535100] Could not open encoder before EOF
> [vost#0:0/h264_vulkan @ 0x55cf0c535100] Task finished with error code: -22
> (Invalid argument)
> [vost#0:0/h264_vulkan @ 0x55cf0c535100] Terminating thread with return
> code -22 (Invalid argument)
> [out#0/mp4 @ 0x55cf0b9d2880] 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 @ 0x55cf0b9ce900] Qavg: 431.170
> Conversion failed!
> -------------
>
> Just try to drop the -hwaccel part of cmd line? Ffmpeg should use software
> decoder in this case ....
>
> ffmpeg -hide_banner -init_hw_device "vulkan=vk:0" -i hdv09_04.m2t -vf
> "hwdownload,format=yuv420p" -c:v h264_vulkan hdv09_04_h264_vulkan.mp4
> ......
> 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 @ 0x55bbd08acbc0] Error reinitializing filters!
> [vf#0:0 @ 0x55bbd08acbc0] Task finished with error code: -38 (Function not
> implemented)
> [vf#0:0 @ 0x55bbd08acbc0] Terminating thread with return code -38
> (Function not implemented)
> [vost#0:0/h264_vulkan @ 0x55bbd0972240] Could not open encoder before EOF
> [vost#0:0/h264_vulkan @ 0x55bbd0972240] Task finished with error code: -22
> (Invalid argument)
> [vost#0:0/h264_vulkan @ 0x55bbd0972240] Terminating thread with return
> code -22 (Invalid argument)
> [out#0/mp4 @ 0x55bbd145fd80] 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 @ 0x55bbd096fac0] Qavg: 430.072
> Conversion failed!
>
> ----------------
>
> try to drop the "-init_hw_device "vulkan=vk:0"-hwaccel part" of cmd line?
> Ffmpeg should use software decoder in this case ....
>
> ffmpeg -hide_banner -i hdv09_04.m2t -vf "hwdownload,format=yuv420p" -c:v
> h264_vulkan hdv09_04_h264_vulkan.mp4
> ..........
> 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 @ 0x55ce82016ec0] Error reinitializing filters!
> [vf#0:0 @ 0x55ce82016ec0] Task finished with error code: -38 (Function not
> implemented)
> [vf#0:0 @ 0x55ce82016ec0] Terminating thread with return code -38
> (Function not implemented)
> [vost#0:0/h264_vulkan @ 0x55ce821dc780] Could not open encoder before EOF
> [vost#0:0/h264_vulkan @ 0x55ce821dc780] Task finished with error code: -22
> (Invalid argument)
> [vost#0:0/h264_vulkan @ 0x55ce821dc780] Terminating thread with return
> code -22 (Invalid argument)
> [out#0/mp4 @ 0x55ce82041940] 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 @ 0x55ce82045040] Qavg: 432.921
> Conversion failed!
>
> ----------------
>
> I have just partly tested with
> "hwupload_vulkan,format=yuv420p,auto_scale_0,hwdownload,format=yuv420p"
> with(out) "-pix_fmt yuv420p*" *according to a google-ai search for
> ....
> vulkan Impossible to convert between the formats supported by the filter
> 'Parsed_null_0' and the filter 'auto_scale_0'
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *Link 'Parsed_null_0.default' -> 'auto_scale_0.default':   src: yuv420p
> dst: yuv420p The error message "Impossible to convert between the formats
> supported by the filter 'Parsed_null_0' and the filter 'auto_scale_0'"
> typically occurs when using hardware acceleration (hwaccel) with FFmpeg and
> a software filter is implicitly called, or when there is a mismatch in the
> expected and actual pixel formats, even if both are ostensibly yuv420p.
> The core issue is that hardware decoders/encoders often only support a
> limited set of pixel formats or require explicit instructions (filters) to
> move data between the GPU and CPU memory spaces.  Common Causes and
> Solutions     Missing hwupload or hwdownload filters:       When using
> hardware acceleration, the video frames reside in the GPU's memory. If a
> software filter (like an implicit auto_scale) is used, the data needs to be
> transferred to system RAM (CPU accessible) using hwdownload and potentially
> back to the GPU using hwupload.  This is a common requirement when mixing
> hardware and software filters.         Solution:           Explicitly add
> hwupload and hwdownload to your filter chain in your FFmpeg command. The
> exact filter name depends on the specific hardware (e.g., hwupload_vulkan,
> hwupload_cuda, etc.).         Example (Conceptual with Vulkan):
>       ffmpeg -hwaccel vulkan -i input.mp4 -vf
> "hwupload_vulkan,format=yuv420p,auto_scale_0,hwdownload,format=yuv420p"
> -c:v <vulkan_encoder> output.mp4     (Note: the specific filter names might
> need adjustment based on your FFmpeg version and hardware) Implicit
> Scaling:  The error mentions auto_scale_0, which implies FFmpeg is trying
> to automatically scale the video for some reason (perhaps the output
> resolution is different from the input, or another filter requires a
> specific resolution). Hardware scaling filters should be used instead of
> the generic software scale filter when staying on the GPU.     Solution:
>    Use the hardware-accelerated scaling filter relevant to your platform
> (e.g., scale_vulkan, scale_cuda, scale_qsv) and ensure the output
> resolution is explicitly defined if needed. Incorrect Pixel Format
> Specification:  Specifying -pix_fmt yuv420p manually might conflict with
> the default pixel format the hardware decoder or encoder is using (which is
> often nv12 or p010le for 10-bit content when using hardware acceleration).
> Even if the name is the same, the memory layout on the GPU can be
> different.     Solution:       Try removing the -pix_fmt yuv420p argument
> and let FFmpeg automatically negotiate the best format, or explicitly set
> the pixel format compatible with your hardware (e.g., -pix_fmt nv12).
> Driver Issues:  Ensure you have the latest drivers for your graphics card
> that fully support the Vulkan video extensions.  Steps to Fix To provide a
> precise command fix, the original FFmpeg command you are using is needed.
> In the meantime, the general approach is:     Remove redundant -pix_fmt
> flags.     Ensure all filters in the chain are compatible with the hardware
> context or use explicit hwupload/hwdownload to move data.     Use
> hardware-specific filters (like scale_vulkan or similar) instead of generic
> filters if possible.*
>
> -----------------------------
>
>
>> --------
>>
>> My previous VAAPI example (25/5-2025)
>>
>> ffmpeg -hide_banner -init_hw_device vaapi -i hdv09_04.m2t -vf
>> format=nv12,hwupload -c:v hevc_vaapi -y hdv09_04_hevc_vaapi_nv12.mp4
>> ......
>> [mpegts @ 0x5562fa5b1a80] PES packet size mismatch0:03:54.80
>> bitrate=11682.6kbits/s speed=23.5x
>> [mpegts @ 0x5562fa5b1a80] Packet corrupt (stream = 1, dts = 258142320).
>> [mpeg2video @ 0x5562fa5f5840] ac-tex damaged at 10 61
>> [mpeg2video @ 0x5562fa5f5840] Warning MVs not available
>> [mpeg2video @ 0x5562fa5f5840] concealing 630 DC, 630 AC, 630 MV errors in
>> P frame
>> [vist#0:0/mpeg2video @ 0x5562fa5e4280] [dec:mpeg2video @ 0x5562fa750f80]
>> corrupt decoded frame
>> [out#0/mp4 @ 0x5562fa721b40] video:335894KiB audio:3774KiB subtitle:0KiB
>> other streams:0KiB global headers:0KiB muxing overhead: 0.048351%
>>
>> frame= 5963 fps=586 q=-0.0 Lsize=  339832KiB time=00:03:58.77
>> bitrate=11659.1kbits/s speed=23.5x
>> [aac @ 0x5562fa5e7640] Qavg: 488.890
>>
>
> Yeah, 586 fps sounds more accurate ...
>
>
>>
>> It sort of sad even h264 does not transcode via Vulkan only. You can try
>> to isolate was it (vulkan) decoder or vulkan encoder problem by forcing
>> hwaccel to none while keeping -c:v at Vulkan encoder. Look out for
>> hwdownload/hwupload and format filters, they still not inserted
>> automatically,  as far as I can see.
>>
>> Sorry if it sounds like too much work, as you noted this is a bit of
>> bleeding edge so surprises happen.
>>
>>
>>>> ------
>>>>
>>>> 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 ...
>>>
>>>
>>>
_______________________________________________
ffmpeg-user mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to