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?
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:
Emulation prevention is line 2 with 0x03 values, and Annex B is the bottom line on the image above.