[FFmpeg-user] h264_vulkan and hevc_vulkan Encode failed on Intel
Dennis Mungai
dmngaie at gmail.com
Fri Dec 13 23:16:58 EET 2024
On Sat, 14 Dec 2024 at 00:14, Dennis Mungai <dmngaie at gmail.com> wrote:
> On Fri, 13 Dec 2024 at 15:47, Terje J. Hanssen <terjejhanssen at gmail.com>
> wrote:
>
>> While decode benchmarks test seemingly works on Intel, encode failed as
>> shown below.
>> If here are some missing steps or something wrong with the ffmpeg
>> command lines used, I would be happy to hear back and test alternatives?
>>
>> ls /usr/share/vulkan/icd.d
>> intel_hasvk_icd.x86_64.json intel_icd.x86_64.json lvp_icd.x86_64.json
>>
>> export VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/intel_icd.x86_64.json
>> export ANV_VIDEO_DECODE=1
>> export ANV_VIDEO_ENCODE=1
>>
>>
>> vulkaninfo | egrep -i 'decode|encode'
>> VK_KHR_video_decode_h264 : extension revision 9
>> VK_KHR_video_decode_h265 : extension revision 8
>> VK_KHR_video_decode_queue : extension revision 8
>> 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
>> VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR
>> VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR
>>
>>
>> vulkaninfo --summary
>> ==========
>> VULKANINFO
>> ==========
>>
>> Vulkan Instance Version: 1.3.296
>>
>>
>> Instance Extensions: count = 24
>> -------------------------------
>> VK_EXT_acquire_drm_display : extension revision 1
>> VK_EXT_acquire_xlib_display : extension revision 1
>> VK_EXT_debug_report : extension revision 10
>> VK_EXT_debug_utils : extension revision 2
>> VK_EXT_direct_mode_display : extension revision 1
>> VK_EXT_display_surface_counter : extension revision 1
>> VK_EXT_headless_surface : extension revision 1
>> VK_EXT_surface_maintenance1 : extension revision 1
>> VK_EXT_swapchain_colorspace : extension revision 5
>> VK_KHR_device_group_creation : extension revision 1
>> VK_KHR_display : extension revision 23
>> VK_KHR_external_fence_capabilities : extension revision 1
>> VK_KHR_external_memory_capabilities : extension revision 1
>> VK_KHR_external_semaphore_capabilities : extension revision 1
>> VK_KHR_get_display_properties2 : extension revision 1
>> VK_KHR_get_physical_device_properties2 : extension revision 2
>> VK_KHR_get_surface_capabilities2 : extension revision 1
>> VK_KHR_portability_enumeration : extension revision 1
>> VK_KHR_surface : extension revision 25
>> VK_KHR_surface_protected_capabilities : extension revision 1
>> VK_KHR_wayland_surface : extension revision 6
>> VK_KHR_xcb_surface : extension revision 6
>> VK_KHR_xlib_surface : extension revision 6
>> VK_LUNARG_direct_driver_loading : extension revision 1
>>
>> Instance Layers: count = 3
>> --------------------------
>> VK_LAYER_KHRONOS_validation Khronos Validation Layer 1.3.296 version 1
>> VK_LAYER_MESA_device_select Linux device selection layer 1.3.211 version 1
>> VK_LAYER_MESA_overlay Mesa Overlay layer 1.3.211 version 1
>>
>> Devices:
>> ========
>> GPU0:
>> apiVersion = 1.3.296
>> driverVersion = 24.3.0
>> vendorID = 0x8086
>> deviceID = 0x56a1
>> deviceType = PHYSICAL_DEVICE_TYPE_DISCRETE_GPU
>> deviceName = Intel(R) Arc(tm) A750 Graphics (DG2)
>> driverID = DRIVER_ID_INTEL_OPEN_SOURCE_MESA
>> driverName = Intel open-source Mesa driver
>> driverInfo = Mesa 24.3.0
>> conformanceVersion = 1.3.6.0
>> deviceUUID = 8680a156-0800-0000-0300-000000000000
>> driverUUID = b3041234-0ed8-a53d-ceb8-4ffd54a9fd93
>>
>> #######################
>>
>> inxi -CGSz
>> System:
>> Kernel: 6.6.63-1-longterm arch: x86_64 bits: 64
>> Console: pty pts/0 Distro: openSUSE Tumbleweed-Slowroll 20241202
>> CPU:
>> Info: 12-core (8-mt/4-st) model: 12th Gen Intel Core i7-12700KF bits:
>> 64
>> type: MST AMCP cache: L2: 12 MiB
>> Speed (MHz): avg: 800 min/max: 800/4900:5000:3800 cores: 1: 800 2: 800
>> 3: 800 4: 800 5: 800 6: 800 7: 800 8: 800 9: 800 10: 800 11: 800
>> 12: 800
>> 13: 800 14: 800 15: 800 16: 800 17: 800 18: 800 19: 800 20: 800
>> Graphics:
>> Device-1: Intel DG2 [Arc A750] driver: i915 v: kernel
>> Device-2: Microdia Camera driver: snd-usb-audio,uvcvideo type: USB
>> Display: unspecified server: X.org v: 1.21.1.14 with: Xwayland v:
>> 24.1.4
>> driver: X: loaded: modesetting unloaded: vesa dri: iris gpu: i915
>> resolution: 2560x1440~60Hz
>> API: EGL v: 1.5 drivers: iris,swrast platforms:
>> gbm,x11,surfaceless,device
>> API: OpenGL v: 4.6 compat-v: 4.5 vendor: intel mesa v: 24.3.0
>> renderer: Mesa Intel Arc A750 Graphics (DG2)
>> API: Vulkan v: 1.3.296 drivers: N/A surfaces: xcb,xlib
>>
>> ====================
>>
>> ffmpeg version 7.1 Copyright (c) 2000-2024 the FFmpeg developers
>> built with gcc 14 (SUSE Linux)
>>
>> ffmpeg -hide_banner -encoders | grep vulkan
>> V....D h264_vulkan H.264/AVC (Vulkan) (codec h264)
>> V....D hevc_vulkan H.265/HEVC (Vulkan) (codec hevc)
>>
>> ######################
>>
>> ffmpeg -hide_banner -init_hw_device vulkan -i hdv09_04.m2t -vf
>> "format=nv12,hwupload" -c:v h264_vulkan -y hdv09_04_h264_vulkan_nv12.mp4
>>
>> [mpeg2video @ 0x55db4fe22d80] Invalid frame dimensions 0x0.
>> Last message repeated 3 times
>> [mpegts @ 0x55db4fe042c0] PES packet size mismatch
>> [mpegts @ 0x55db4fe042c0] Packet corrupt (stream = 1, dts = 258142320).
>> [mpegts @ 0x55db4fe042c0] 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 @ 0x55db4fe042c0] 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) -> h264 (h264_vulkan))
>> Stream #0:1 -> #0:1 (mp2 (native) -> aac (native))
>> Press [q] to stop, [?] for help
>> [h264_vulkan @ 0x55db4fe236c0] No rate control settings specified, using
>> fixed QP = 18
>> Output #0, mp4, to 'hdv09_04_h264_vulkan_nv12.mp4':
>> Metadata:
>> encoder : Lavf61.7.100
>> Stream #0:0: Video: h264 (High) (avc1 / 0x31637661), vulkan(tv,
>> bt709, top coded first (swapped)), 1440x1080 [SAR 4:3 DAR 16:9], q=2-31,
>> 25 fps, 12800 tbn
>> Metadata:
>> encoder : Lavc61.19.100 h264_vulkan
>> Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo,
>> fltp, 128 kb/s
>> Metadata:
>> encoder : Lavc61.19.100 aac
>>
>> [h264_vulkan @ 0x55db4fe236c0] Encode failed: -729850096.
>> [vost#0:0/h264_vulkan @ 0x55db4fe5d480] Error submitting video frame to
>> the encoder
>> [vost#0:0/h264_vulkan @ 0x55db4fe5d480] Error encoding a frame: Error
>> number -729850096 occurred
>> [vost#0:0/h264_vulkan @ 0x55db4fe5d480] Task finished with error code:
>> -729850096 (Error number -729850096 occurred)
>> [vost#0:0/h264_vulkan @ 0x55db4fe5d480] Terminating thread with return
>> code -729850096 (Error number -729850096 occurred)
>> Unable to submit command buffer: VK_ERROR_DEVICE_LOST
>> [hwupload @ 0x7ff7c0004440] Failed to upload frame: -542398533.
>> [vf#0:0 @ 0x55db4fd17100] Error while filtering: Generic error in an
>> external library
>> [vf#0:0 @ 0x55db4fd17100] Task finished with error code: -542398533
>> (Generic error in an external library)
>> [vf#0:0 @ 0x55db4fd17100] Terminating thread with return code -542398533
>> (Generic error in an external library)
>> [out#0/mp4 @ 0x55db4fd198c0] video:0KiB audio:19KiB subtitle:0KiB other
>> streams:0KiB global headers:0KiB muxing overhead: 5.515885%
>> frame= 0 fps=0.0 q=0.0 Lsize= 20KiB time=N/A bitrate=N/A speed=N/A
>> [aac @ 0x55db4fe069c0] Qavg: 1286.721
>> Conversion failed!
>>
>> ========================
>>
>> ffmpeg -hide_banner -init_hw_device vulkan=vkdev:0 -filter_hw_device
>> vkdev -i h264_8bit_yuv420p.mp4 -filter:v "format=nv12,hwupload" -c:v
>> hevc_vulkan hevc_vulkan_8b420.mp4
>>
>> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'h264_8bit_yuv420p.mp4':
>> Metadata:
>> major_brand : isom
>> minor_version : 512
>> compatible_brands: isomiso2avc1mp41
>> encoder : Lavf61.1.100
>> Duration: 00:01:11.20, start: 0.000000, bitrate: 8464 kb/s
>> Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661),
>> yuvj420p(pc, smpte170m/unknown/unknown, top first), 1920x1080 [SAR 1:1
>> DAR 16:9], 8462 kb/s, 25 fps, 25 tbr, 12800 tbn (default)
>> Metadata:
>> handler_name : VideoHandler
>> vendor_id : [0][0][0][0]
>> File 'hevc_vulkan_8b420.mp4' already exists. Overwrite? [y/N] y
>> Stream mapping:
>> Stream #0:0 -> #0:0 (h264 (native) -> hevc (hevc_vulkan))
>> Press [q] to stop, [?] for help
>> [swscaler @ 0x7f0aa0014b00] deprecated pixel format used, make sure you
>> did set range correctly
>> [hevc_vulkan @ 0x5583b890fdc0] No rate control settings specified, using
>> fixed QP = 18
>> Output #0, mp4, to 'hevc_vulkan_8b420.mp4':
>> Metadata:
>> major_brand : isom
>> minor_version : 512
>> compatible_brands: isomiso2avc1mp41
>> encoder : Lavf61.7.100
>> Stream #0:0(und): Video: hevc (Main) (hev1 / 0x31766568), vulkan(pc,
>> smpte170m/unknown/unknown, top coded first (swapped)), 1920x1080 [SAR
>> 1:1 DAR 16:9], q=2-31, 25 fps, 12800 tbn (default)
>> Metadata:
>> handler_name : VideoHandler
>> vendor_id : [0][0][0][0]
>> encoder : Lavc61.19.100 hevc_vulkan
>>
>> [hevc_vulkan @ 0x5583b890fdc0] Encode failed: -1744827296.
>> [vost#0:0/hevc_vulkan @ 0x5583b890aec0] Error submitting video frame to
>> the encoder
>> [vost#0:0/hevc_vulkan @ 0x5583b890aec0] Error encoding a frame: Error
>> number -1744827296 occurred
>> [vost#0:0/hevc_vulkan @ 0x5583b890aec0] Task finished with error code:
>> -1744827296 (Error number -1744827296 occurred)
>> [vost#0:0/hevc_vulkan @ 0x5583b890aec0] Terminating thread with return
>> code -1744827296 (Error number -1744827296 occurred)
>> [out#0/mp4 @ 0x5583b883ecc0] video:0KiB audio:0KiB subtitle:0KiB other
>> streams:0KiB global headers:0KiB muxing overhead: unknown
>> [out#0/mp4 @ 0x5583b883ecc0] Output file is empty, nothing was
>> encoded(check -ss / -t / -frames parameters if used)
>> frame= 0 fps=0.0 q=0.0 Lsize= 0KiB time=N/A bitrate=N/A speed=N/A
>> Conversion failed!
>>
>
>
> A similar ticket on this issue: https://trac.ffmpeg.org/ticket/11219
>
And also reported to mesa upstream, specifically regarding the state of
Intel's ANV's Vulkan video:
https://gitlab.freedesktop.org/mesa/mesa/-/issues/11969
More information about the ffmpeg-user
mailing list