0
votes

Please guide me to resolve this issue.

I have parsed the h264 video stream and identified the frames[I/P/B]. I have followed the below steps.

• NAL Units start code: 00 00 01 X Y • X = IDR Picture NAL Units (25, 45, 65) • Y = Non IDR Picture NAL Units (01, 21, 41, 61) ; 01 = b-frames, 41 = p-frames

Now my question is how to know the length of individual frames so that i can write each frames to a file. Please give some help.

Regards, Spk

1
Have you found the answer yet? Is szatmary's answer accepted?TOP
Non IDR Picture NAL Units 21, 61: what are they?TOP

1 Answers

3
votes

Ok, so your source is an annex-b formated elementary stream. Basically every NALu begins with a start code (2 or more 0x00 bytes followed by a 0x01 byte). The next byte contains the type (the first 5 bits). The rest is payload. The NALU ends when the next start code in encountered, or you reach the end of the stream. So, to get the length, you must look for the next start code and subtract.

You will likely find this post useful. Possible Locations for Sequence/Picture Parameter Set(s) for H.264 Stream