[FFmpeg-devel] h264.c avcC file reading error on PPS with trailing zeros, with tiny patch attached
Michael Niedermayer
michaelni
Thu Aug 14 01:05:28 CEST 2008
On Wed, Aug 13, 2008 at 03:41:05PM -0400, Francois Oligny-Lemieux wrote:
> Hi,
>
> In .mp4 files are saved the SPS and PPS. When ffmpeg decodes the .mp4 video
> extradata, it should allow trailing zeros at the end of those NAL units.
>
> In original code, the SPS is decoded, then the PPS
>
> // Decode sps from avcC
> cnt = *(p+5) & 0x1f; // Number of sps
> p += 6;
> for (i = 0; i < cnt; i++) {
> nalsize = AV_RB16(p) + 2;
> if(decode_nal_units(h, p, nalsize) < 0) {
> av_log(avctx, AV_LOG_ERROR, "Decoding sps %d from avcC
> failed\n", i);
> return -1;
> }
> p += nalsize;
> }
> // Decode pps from avcC
> cnt = *(p++); // Number of pps
> for (i = 0; i < cnt; i++) {
> nalsize = AV_RB16(p) + 2;
> if(decode_nal_units(h, p, nalsize) != nalsize) {
> av_log(avctx, AV_LOG_ERROR, "Decoding pps %d from avcC
> failed\n", i);
> return -1;
> }
> p += nalsize;
> }
>
> The SPS part is OK because it just checks if decode_nal_units didn't fail.
> The second part is different and less flexible because it requires that
> decode_nal_unit consumes the same amount of bytes that were passed. I don't
> know why both part were not coded the same. The problem is that this doesn't
> pass when there are trailing zeros. So just making the second part's check
> like the first one allows the decoding of .mp4 that have trailing zeros in
> PPS (like the file I uploaded on
> upload.mplayerhq.hu/MPlayer/incoming/HD4ED_au_720p60.03.mp4). Note
> that QuickTime is able to
> decode it, while FFmpeg fails; but with the patch, FFmpeg succeeds.
patch ok (not that i think that a file needing it would be valid) but its
more robust with the patch
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080814/55f9715c/attachment.pgp>
More information about the ffmpeg-devel
mailing list