Opened 17 months ago
Last modified 17 months ago
#11510 open defect
Hardware accelerator failed to decode picture - Videotoolbox HEVC
| Reported by: | David Franco | Owned by: | |
|---|---|---|---|
| Priority: | normal | Component: | undetermined |
| Version: | git-master | Keywords: | |
| Cc: | Blocked By: | ||
| Blocking: | Reproduced by developer: | no | |
| Analyzed by developer: | no |
Description
Summary of the bug:
This bug can be reproduced in both the 5.4 and the latest ffmpeg version.
While trying to decode the video decode_gpu.mov, the videotoolbox decoder fails to decode certain frames.
While this video is clearly corrupted, VLC was able to perform gpu decoding without issues for this video so there might be something we can do.
A similar issue was reported for H264 videos in the past (already fixed) and it might be related:
https://trac.ffmpeg.org/ticket/9713
The video specs are:
- HEVC
- 1920x1080
- yuv420p
My system specs are:
- Mac Book Pro 2022
- Apple M2
- 16GB
- Sonoma 14.1
Download video:
https://drive.google.com/file/d/17JgTQPkXQ2y1zG1HDBhIK0k9Udw9fFjI/view?usp=sharing
How to reproduce:
./ffmpeg -hwaccel videotoolbox -i decode_gpu.mov -f null -
ffmpeg version 7.1 Copyright (c) 2000-2024 the FFmpeg developers
built with Apple clang version 13.1.6 (clang-1316.0.21.2.5)
configuration: --prefix=/Volumes/tempdisk/sw --extra-cflags=-fno-stack-check --arch=arm64 --cc=/usr/bin/clang --enable-gpl --enable-libvmaf --enable-libopenjpeg --enable-libopus --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libvpx --enable-libwebp --enable-libass --enable-libfreetype --enable-fontconfig --enable-libtheora --enable-libvorbis --enable-libsnappy --enable-libaom --enable-libvidstab --enable-libzimg --enable-libsvtav1 --enable-libharfbuzz --enable-libkvazaar --pkg-config-flags=--static --enable-ffplay --enable-postproc --enable-neon --enable-runtime-cpudetect --disable-indev=qtkit --disable-indev=x11grab_xcb
libavutil 59. 39.100 / 59. 39.100
libavcodec 61. 19.100 / 61. 19.100
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
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'decode_gpu.mov':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
creation_time : 2025-02-27T21:38:08.000000Z
Angles.custom.TS.metadata: {
: "created_by" : "Angles"
: }
Duration: 00:00:47.51, start: 0.000000, bitrate: 8163 kb/s
Stream #0:0[0x1](und): Video: hevc (Main) (hvc1 / 0x31637668), yuv420p(tv, bt709), 1920x1080, 7807 kb/s, 24.45 fps, 25 tbr, 2500 tbn (default)
Metadata:
creation_time : 2025-02-27T21:38:08.000000Z
handler_name : Core Media Video
vendor_id : [0][0][0][0]
encoder : HEVC
Stream mapping:
Stream #0:0 -> #0:0 (hevc (native) -> wrapped_avframe (native))
Press [q] to stop, [?] for help
Output #0, null, to 'pipe:':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
Angles.custom.TS.metadata: {
: "created_by" : "Angles"
: }
encoder : Lavf61.7.100
Stream #0:0(und): Video: wrapped_avframe, nv12(tv, bt709, progressive), 1920x1080, q=2-31, 200 kb/s, 25 fps, 25 tbn (default)
Metadata:
creation_time : 2025-02-27T21:38:08.000000Z
handler_name : Core Media Video
vendor_id : [0][0][0][0]
encoder : Lavc61.19.100 wrapped_avframe
[hevc @ 0x141f3af10] Duplicate POC in a sequence: 944.itrate=N/A speed=8.91x
[hevc @ 0x141f3af10] Skipping invalid undecodable NALU: 21
[hevc @ 0x141f077c0] vt decoder cb: output image buffer is null: -12909
[hevc @ 0x141f42390] hardware accelerator failed to decode picture
[hevc @ 0x141f077c0] vt decoder cb: output image buffer is null: -17694
[hevc @ 0x141f077c0] hardware accelerator failed to decode picture
[hevc @ 0x141f077c0] vt decoder cb: output image buffer is null: -17694
[hevc @ 0x141f0f410] hardware accelerator failed to decode picture
[hevc @ 0x141f077c0] vt decoder cb: output image buffer is null: -17694
[hevc @ 0x141f16890] hardware accelerator failed to decode picture
[hevc @ 0x141f077c0] vt decoder cb: output image buffer is null: -17694
[hevc @ 0x141f1dd10] hardware accelerator failed to decode picture
[null @ 0x141f04b30] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 244 >= 243
[hevc @ 0x141f077c0] vt decoder cb: output image buffer is null: -17694
[hevc @ 0x141f25190] hardware accelerator failed to decode picture
[hevc @ 0x141f077c0] vt decoder cb: output image buffer is null: -17694
[hevc @ 0x141f2c610] hardware accelerator failed to decode picture
[hevc @ 0x141f077c0] vt decoder cb: output image buffer is null: -17694
[hevc @ 0x141f33a90] hardware accelerator failed to decode picture
[vist#0:0/hevc @ 0x141f04fe0] [dec:hevc @ 0x141f06a40] Error submitting packet to decoder: Unknown error occurred
[hevc @ 0x141f077c0] vt decoder cb: output image buffer is null: -17694
[hevc @ 0x141f3af10] hardware accelerator failed to decode picture
[vist#0:0/hevc @ 0x141f04fe0] [dec:hevc @ 0x141f06a40] Error submitting packet to decoder: Unknown error occurred
[hevc @ 0x141f077c0] vt decoder cb: output image buffer is null: -17694
[hevc @ 0x141f42390] hardware accelerator failed to decode picture
[vist#0:0/hevc @ 0x141f04fe0] [dec:hevc @ 0x141f06a40] Error submitting packet to decoder: Unknown error occurred
[hevc @ 0x141f077c0] vt decoder cb: output image buffer is null: -17694
[hevc @ 0x141f077c0] hardware accelerator failed to decode picture
[vist#0:0/hevc @ 0x141f04fe0] [dec:hevc @ 0x141f06a40] Error submitting packet to decoder: Unknown error occurred
[hevc @ 0x141f077c0] vt decoder cb: output image buffer is null: -17694
[hevc @ 0x141f0f410] hardware accelerator failed to decode picture
[vist#0:0/hevc @ 0x141f04fe0] [dec:hevc @ 0x141f06a40] Error submitting packet to decoder: Unknown error occurred
[hevc @ 0x141f077c0] vt decoder cb: output image buffer is null: -17694
[hevc @ 0x141f16890] hardware accelerator failed to decode picture
[vist#0:0/hevc @ 0x141f04fe0] [dec:hevc @ 0x141f06a40] Error submitting packet to decoder: Unknown error occurred
[hevc @ 0x141f077c0] vt decoder cb: output image buffer is null: -17694
[hevc @ 0x141f1dd10] hardware accelerator failed to decode picture
[vist#0:0/hevc @ 0x141f04fe0] [dec:hevc @ 0x141f06a40] Error submitting packet to decoder: Unknown error occurred
[hevc @ 0x141f077c0] vt decoder cb: output image buffer is null: -17694
[hevc @ 0x141f25190] hardware accelerator failed to decode picture
[vist#0:0/hevc @ 0x141f04fe0] [dec:hevc @ 0x141f06a40] Error submitting packet to decoder: Unknown error occurred
[hevc @ 0x141f077c0] vt decoder cb: output image buffer is null: -17694
[hevc @ 0x141f2c610] hardware accelerator failed to decode picture
[vist#0:0/hevc @ 0x141f04fe0] [dec:hevc @ 0x141f06a40] Error submitting packet to decoder: Unknown error occurred
[hevc @ 0x141f077c0] vt decoder cb: output image buffer is null: -17694
[hevc @ 0x141f33a90] hardware accelerator failed to decode picture
[vist#0:0/hevc @ 0x141f04fe0] [dec:hevc @ 0x141f06a40] Decoding error: Unknown error occurred
[hevc @ 0x141f077c0] vt decoder cb: output image buffer is null: -17694
[hevc @ 0x141f3af10] hardware accelerator failed to decode picture
[hevc @ 0x141f07020] No frame decoded?
[vist#0:0/hevc @ 0x141f04fe0] [dec:hevc @ 0x141f06a40] Error submitting packet to decoder: Generic error in an external library
[vist#0:0/hevc @ 0x141f04fe0] [dec:hevc @ 0x141f06a40] Error submitting packet to decoder: Unknown error occurred
[vist#0:0/hevc @ 0x141f04fe0] [dec:hevc @ 0x141f06a40] A decoder returned an unexpected error code. This is a bug, please report it.
[vist#0:0/hevc @ 0x141f04fe0] [dec:hevc @ 0x141f06a40] Error processing packet in decoder: Internal bug, should not have happened
[vist#0:0/hevc @ 0x141f04fe0] [dec:hevc @ 0x141f06a40] Task finished with error code: -558323010 (Internal bug, should not have happened)
[vist#0:0/hevc @ 0x141f04fe0] [dec:hevc @ 0x141f06a40] Terminating thread with return code -558323010 (Internal bug, should not have happened)
[out#0/null @ 0x600002c30000] video:104KiB audio:0KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknown
frame= 243 fps=186 q=-0.0 Lsize=N/A time=00:00:09.88 bitrate=N/A speed=7.56x
[hevc @ 0x141f077c0] vt decoder cb: output image buffer is null: -17694
[hevc @ 0x141f42390] hardware accelerator failed to decode picture
Conversion failed!



The issue is complex than I thought. It can be workarounded by
-advanced_editlist 0ffmpeg -hwaccel videotoolbox -advanced_editlist 0 -i foo.mp4 -f null -
My patchset
https://ffmpeg.org/pipermail/ffmpeg-devel/2025-March/341305.html