1

I am working on a C++ application in which my application is receiving H265 frames from an external application and stores it on disk whenever required, but the storing needs to be start only from I-frame because if it starts from P frame, those frames would be meaningless. So how do I identify the I-frame from it?

I am new to video encoding and decoding and I am aware of following:

  • 00 00 00 01 is start of NAL unit
  • SPS starts with 67
  • PPS starts with 68

1 Answers1

4

Here are some of the NAL unit types for H.265:

  • IDR = 19 or 20
  • SPS = 33
  • PPS = 34

So your assumption about SPS, PPS values is incorrect.

NAL Unit structure:

"StartCode" "Byte" "Payload"

To get the NAL unit type you have to do (Byte >> 1) & 0x3f.

You need to look for an IDR frame (instant decoder refresh; type 19 or 20).

Markus Schumann
  • 7,636
  • 1
  • 21
  • 27
  • Yes. Later I figured out the sps and pps start byte I know is only of h264. After some experiments and research I was able to figure out the exact way for it. It has to be ```(byte >> 1) & 0x3F``` – K_peanutButter Mar 23 '23 at 05:19
  • Excellent - if I have answered your question - please mark my answer accordingly - thanks. – Markus Schumann Mar 23 '23 at 13:43