чт, 4 дек. 2025 г., 21:04 Terje J. Hanssen <[email protected]>:
Den 04.12.2025 17:03, skrev Andrew Randrianasulu:
чт, 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]> <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
.....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 ...
ffv1_vulkan works fine for me too - here with ffmpeg-8 and also
without export variables set(!?)
Because it uses Vulkan compute shaders, not dedicated media engines ....
ffmpeg -hide_banner -init_hw_device vulkan -i 20081103140154.m2t
-vf hwupload,format=vulkan -level 4 -strict -2 -c:v ffv1_vulkan
-y -frames 200 20081103140154_m2t_ffv1_vulkan.mkv
[mpegts @ 0x5582928a53c0] stream 0 : no PTS found at end of file,
duration not set
[mpegts @ 0x5582928a53c0] 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 @ 0x5582928a53c0] 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 '20081103140154.m2t':
Duration: 00:00:13.44, start: 1042.400000, bitrate: 26598 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, start 1042.480000
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, start 1042.400000
Stream #0:2[0x815]: Unknown: none ([160][0][0][0] / 0x00A0),
start 1042.400000
Stream #0:3[0x811]: Unknown: none ([161][0][0][0] / 0x00A1),
start 1042.400000
[aost#0:1/libopus @ 0x55829286b880] Applying unspecific -frames to
non video streams, maybe you meant -vframes ?
Stream mapping:
Stream #0:0 -> #0:0 (mpeg2video (native) -> ffv1 (ffv1_vulkan))
Stream #0:1 -> #0:1 (mp2 (native) -> opus (libopus))
Press [q] to stop, [?] for help
[libopus @ 0x55829286bb00] No bit rate set. Defaulting to 96000 bps.
[ffv1_vulkan @ 0x5582928f5b00] Async buffers: 2MiB per context,
2MiB total, depth: 1
Output #0, matroska, to '20081103140154_m2t_ffv1_vulkan.mkv':
Metadata:
encoder : Lavf62.3.100
Stream #0:0: Video: ffv1 (FFV1 / 0x31564646), vulkan(tv, bt709,
top coded first (swapped)), 1440x1080 [SAR 4:3 DAR 16:9], q=2-31,
200 kb/s, 25 fps, 1k tbn
Metadata:
encoder : Lavc62.11.100 ffv1_vulkan
Stream #0:1: Audio: opus ([255][255][255][255] / 0xFFFFFFFF),
48000 Hz, stereo, s16, 96 kb/s
Metadata:
encoder : Lavc62.11.100 libopus
[out#0/matroska @ 0x5582933d5b80] video:74790KiB audio:39KiB
subtitle:0KiB other streams:0KiB global headers:0KiB muxing
overhead: 0.008941%
frame= 100 fps= 27 q=-0.0 Lsize= 74835KiB time=00:00:04.00
bitrate=153263.1kbits/s speed= 1.1x elapsed=0:00:03.63
----------------------
But why not the equivalent cmd with h264_vulkan? Had to set export
variables here:
ffmpeg -hide_banner -init_hw_device vulkan -i hdv09_04.m2t -vf
hwupload,format=vulkan -c:v h264_vulkan -y hdv09_04_h264_vulkan.mp4
[mpeg2video @ 0x556d16801180] Invalid frame dimensions 0x0.
Last message repeated 3 times
[mpegts @ 0x556d1687c280] PES packet size mismatch
[mpegts @ 0x556d1687c280] Packet corrupt (stream = 1, dts =
258142320).
[mpegts @ 0x556d1687c280] 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 @ 0x556d1687c280] 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, start 2629.680000
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, start 2629.496000
Stream #0:2[0x815]: Unknown: none ([160][0][0][0] / 0x00A0),
start 2629.496000
Stream #0:3[0x811]: Unknown: none ([161][0][0][0] / 0x00A1),
start 2629.496000
Stream mapping:
Stream #0:0 -> #0:0 (mpeg2video (native) -> h264 (h264_vulkan))
Stream #0:1 -> #0:1 (mp2 (native) -> aac (native))
Press [q] to stop, [?] for help
[h264_vulkan @ 0x556d16840700] No rate control settings specified,
using fixed QP = 18
[h264_vulkan @ 0x556d16840700] Pixel format yuv420p of input
frames not supported!
Oh, it failed to convert pixelformat? May be rearrange hwupload and
format, so format goes first? Or even surround hwupload by two
format=vulkan filters?
At least now it tries to initialize Vulkan h264 encoder ...
You can also try to add -profile:v main so encoder hopefully will try
something relatively common first ?