[Mp4-tech] h264 byte stream format question

Gary Sullivan garysull windows.microsoft.com
Wed Jan 23 10:53:14 EST 2008


See Annex B of the standard.  Start codes (0x000001) prefixed by at least one zero-valued byte (i.e. a total length of 4 bytes in the pattern 0x00000001) are required between the last NAL unit of one access unit and the first NAL unit of the next access unit.  Additional zero-valued bytes may also be present.
Between NAL units within the access unit, the minimum number of bytes is 3 rather than 4 (the three-byte pattern 0x000001).  However, additional zero-valued bytes may be present.
Exact conditions under which the minimum length is 4 rather than 3 bytes are as follows (quoting):
When any of the following conditions are fulfilled, the zero_byte syntax element shall be present.
-          the nal_unit_type within the nal_unit( ) is equal to 7 (sequence parameter set) or 8 (picture parameter set)
-          the byte stream NAL unit syntax structure contains the first NAL unit of an access unit in decoding order, as specified by subclause 7.4.1.2.3.
Best Regards,
Gary Sullivan
________________________________
From: mp4-tech-bounces lists.mpegif.org [mailto:mp4-tech-bounces lists.mpegif.org] On Behalf Of Victor lyamtsev
Sent: Wednesday, January 23, 2024 7:29 AM
To: mp4-tech lists.mpegif.org
Subject: [Mp4-tech] h264 byte stream format question
Hello,
I have to parse H264 files to read NAL units. I found that there's always 4 bytes offset
between end marker of one NAL and start of another.  The file can't be  decoded if I try to remove  those offsets - I see "codec not found" error when I run decoder on the "reduced" file. Aren't NAL's supposed to be self contained? Do those 4 bytes contain some meaningful information, or just provided for alignment? If so, how should the NAL's be re- aligned when I read them from file?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/mp4-tech/attachments/20080123/7f956bb9/attachment.html


More information about the Mp4-tech mailing list