[FFmpeg-devel] [PATCH] Ordering of PPS/SPS in h264_mp4toannexb_bsf

Graham Booker gbooker at cod3r.com
Tue Mar 25 02:30:03 CET 2014


First time submitting a patch here, so bear with me.

I've encountered corrupt video in bitstream copies used in plex to copy
from an MKV to TS.  I traced the problem down to h264_mp4toannexb_bsf.  The
frames in question have an PPS or SPS (or both) NAL of their own,
and h264_mp4toannexb_bsf would insert the PPS/SPS from extra after the ones
in the frame.

The original would insert the PPS/SPS before type 5 (Independent slice)
NALs only, and so the included patch would examine the frame for a type 5
NAL, and if present insert the PPS/SPS from extra at the beginning of the
frame.  I only understand so much about H.264 in TS, so there may be a
better solution to this problem; I simply tried to replicate the existing
behavior as much as possible.

This patch corrects the corruption I see in a stream copy from MKV to TS.
 I can provide a sample if desired, but since I've only seen this on my BD
rips (no transcode), and a 25 second sample is about 100MB.

For the curious: My best test case is to run MakeMKV on Star Trek IV and
stream copy to TS, then watch around 00:03:15 to 00:04:00

Thanks.

- Graham
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-PPS-and-SPS-in-extra-to-before-those-in-frame.patch
Type: application/octet-stream
Size: 3648 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140324/9f30b2a0/attachment.obj>


More information about the ffmpeg-devel mailing list