I was trying to learn a bit about h264 by looking at the bitstream of a video file with a hex editor. I found here the start codes for a video object planes (0x000001b6) and for i-frames (0x000001b600).
But I can't find many of those bytes in video files. Most of the time those start codes appear at the beginning of a file with only a few bites in between. I expected them to show up very regularly, in equal distance all over the file!?
Is is even ok to look at a file with a hex editor this way? What other start codes exist and how is a h264 file organised?
The 0x000001b6
start code applies to mpeg-4 part 2 video which is the simple profile. This corresponds to codecs such as XVID and DIVX. H.264 is mpeg-4 part 10 which is the advanced video coding profile. H.264 uses different start codes.
I am not as familiar with part 10 as I am with part 2, but a brief look through the standard (ISO 14496-10) shows that the bitstream is broken into sections called NAL units. These units have the 24 bit code 0x000001
preceding them for synchronization as per section B.1.1. The following byte is made up of the fields forbidden_zero_bit
, nal_ref_idc
, and nal_unit_type
as per section 7.3.1.
I am not sure whether these NAL units are separated on frame boundaries or not. You may just have to get a hold of the standard that lays out all of the bitstream syntax.