K_peanutButter
K_peanutButter

Reputation: 186

How do I indentify an I-frame in H265 stream?

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:

Upvotes: 2

Views: 2471

Answers (1)

Markus Schumann
Markus Schumann

Reputation: 8264

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).

Upvotes: 5

Related Questions