[FFmpeg-trac] #9713(avcodec:new): Hardware accelerated decoding fails on M1 macs for certain videos encoded with h264
FFmpeg
trac at avcodec.org
Sat May 14 02:24:05 EEST 2022
#9713: Hardware accelerated decoding fails on M1 macs for certain videos encoded
with h264
-------------------------------------+-------------------------------------
Reporter: mikffmpeg | Owner: (none)
Type: defect | Status: new
Priority: normal | Component: avcodec
Version: git-master | Resolution:
Keywords: avcodec; | Blocked By:
m1; mac; h264 |
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
Comment (by Alex Agranovsky):
This seems to happen, when the bitstream provided for decoding doesn't
contain SPS/PPS.
For example, using the provided `m1_not_decodable_with_acceleration.ts`:
{{{
ffmpeg -i m1_not_decodable_with_acceleration.ts -vcodec copy
m1_not_decodable_with_acceleration.h264
ffmpeg -hwaccel videotoolbox -i m1_not_decodable_with_acceleration.h264 -v
debug /tmp/img%05d.jpg
}}}
will still fail, but
{{{
ffmpeg -i m1_not_decodable_with_acceleration.ts -vcodec copy
m1_not_decodable_with_acceleration.mkv
ffmpeg -hwaccel videotoolbox -i m1_not_decodable_with_acceleration.mkv -v
debug /tmp/img%05d.jpg
}}}
works. The difference seems to be what is fed into the decoder:
{{{
Broken with .h264 (and .ts):
SPS-init - begin >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
67 4d 00 2a 9d a8 1e 00 89 f9 70 06 e0 20 20 28
00 00 00 08 00 00 01 94 20
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< SPS-init - end
PPS-init - begin >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
68 ee 3c
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< PPS-init - end
decoding - begin >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
00 02 04 b7 65 b8 00 00 0e ab 00 cf f7 49 24 77
Working with .mkv:
SPS-init - begin >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
67 4d 00 2a 9d a8 1e 00 89 f9 70 06 e0 20 20 28
00 00 00 08 00 00 01 94 20
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< SPS-init - end
PPS-init - begin >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
68 ee 3c
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< PPS-init - end
decoding - begin >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
00 00 00 02 09 f0 00 00 00 1b 67 4d 00 2a 9d a8
1e 00 89 f9 70 06 e0 20 20 28 00 00 03 00 08 00
00 03 01 94 20 00 00 00 04 68 ee 3c 80 00 00 00
05 06 e5 01 41 80 00 02 04 b7 65 b8 00 00 0e ab
00 cf f7 49 24 77 ... matches after this
}}}
As you see, there are SPS/PPS NALUs present in the bitstream provided when
reading from mkv -- and that seems to make Apple gods happy.
On Intel Mac, of course things work in all the above scenarios.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/9713#comment:5>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list