Can H.264 stream in MP4 file contain Annex B startcode emulation?

1

MP4 file (actually it's HLS stream that uses MP4 format) contains H.264 stream in AVC format: [NALU length][NALU data]. H.264 decoder requires Annex B format: [startcode][NALU data]. In general startcode emulation can happen in AVC format (e.g. 0x00000001 can occur inside encoded data). Does this mean that MP4 file format also can contain H.264 NALUs with startcode emulation? Or should emulation prevention be applied before packaging into MP4?

video-streaming
mp4
h.264
http-live-streaming
asked on Stack Overflow Mar 28, 2019 by Andriy Tylychko • edited Mar 28, 2019 by Andriy Tylychko

1 Answer

2

Emulation prevention is always applied to remove 00 00 00-02 sequences from the encoded data (RBSP), so this is unrelated to Annex B: H.264 Annex B format is about start code prefixes prepending NAL units in byte-stream format as opposed to unit lengths.

A cheat sheet on this:

enter image description here

Emulation prevention is line 2 with 0x03 values, and Annex B is the bottom line on the image above.

answered on Stack Overflow Mar 29, 2019 by Roman R.

User contributions licensed under CC BY-SA 3.0