0

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

Suku P K
  • 31
  • 2
  • 4

1 Answers1

4

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

kgbook
  • 388
  • 4
  • 16
szatmary
  • 29,969
  • 8
  • 44
  • 57
  • I cannot open the blog post. Could you please give me the newest link to the document? – TOP Jan 18 '16 at 05:34
  • Can you have a look at my new question here? http://stackoverflow.com/questions/34851457/how-to-calculate-the-delta-decoding-time-of-each-nal-unit-from-its-bitstream-pay – TOP Jan 18 '16 at 09:48
  • The **NALU type** of the sequence `00 00 00 01 67 ... ` is **SPS**, but you said the 3-7 bit is NALU type, it's not true. It's not **Filler data** (0x67 & 0xF1) but **SPS** (0x67 & 0x1F). – kgbook Oct 28 '18 at 05:57