[FFmpeg-devel] h264 bitstream corruption in videotoolbox encoder with a53cc=1

Richard Kern kernrj at gmail.com
Wed Feb 8 16:28:31 EET 2017

On February 6, 2017 at 8:39:30 PM, Aman Gupta (ffmpeg at tmm1.net) wrote:

Last October, kernrj and I commited a series of patches to add a53cc
support to the videotoolbox encoder.

In using that feature over the past few months, I've discovered that the
generated streams can sometimes contain random/intermittent errors. This
only appears to occur on some Macs and not others.

These corrupted files cause errors when used with any of Apple's decoders,
including Safari, Quicktime, and mediastreamvalidator. The file can be
decoded with ffmpeg, although it prints out the following error when
encountering the corruption:

[NULL @ 0x7fbcce800600] sps_id 32 out of range
[h264 @ 0x7fbcd0000000] sps_id 32 out of range

Here are two sequential sample segments generated by the videotoolbox
encoder (when used with -f hls). They were generated one after the other
from the same source; the first is fine, but the second contains the


I'd like to fix this bug, but have been stuck trying to narrow it down.
Hoping someone can point me in the right direction.

I’ll take a look this weekend.


More information about the ffmpeg-devel mailing list