Breif Description of nal_ref_idc Value in H.246 NALU

I am so sorry for my late update because of my study!
A quite update of myself: I have actually stopped working on H.264 and MP4 for some time but I hope my articles can help some of the beginners.

As in the article Introduction to H.264: (1) NAL Unit, Suji Mani asked what is the exact meaning of different values in nal_ref_idc. In fact, nal_ref_idc is base on “Start Code Value” and represents the priority of the current frame (i.e. how important of the frame – the higher the value, the more important the frame). Here is a list of nal_ref_idc values with the corresponding Start Code Type:

Start Code Type  nal_ref_idc values (in binary)  nal_ref_idc values (in decimal)
 Sequence header  11  3
 Picture header of I-frame  11  3
 Slice data of I-frame  11  3
 Picture header of P-frame  10  2
 Slice data of P-frame  10  2
 Picture header of B-frame  01  1
 Slice data of B-frame  01  1
 Video extension start code  00  0
 User data start code  00  0
 Video edit start code  00  0


Let me clarify a bit. nal_ref_idc is actually telling you what is the type of the current frame, which implies that what information you could get in this frame.

The example in Introduction to H.264: (1) NAL Unit is the beginning of a H.246 raw data. Let’s check the example again.

A sample of raw H.264 in byte stream format

Figure 1: A sample of raw H.264 in byte stream format

Hex Binary
0x67 0110 0111

forbidden_zero_bit = 0,
nal_ref_idc = 3,
nal_unit_type = 7 (Sequence Parameter Set, SPS)

As this is the beginning of a h.264 raw data, it is reasonable to say the first frame is a SPS (i.e. Start Code Type is Sequence Header). Hence, we have nal_rel_idc = 3.

I hope this may help you a bit.




  1. Peter

    Hi Yumi,

    I am new in H.264 so actually I’m studying the structure of the H.264 NALUs.
    I took a lot of samples of transport streams coming from satellite and terrestrial platforms. Full many a time there are no IDR pictures in the streams at all (NALU=0x65)!
    Why is it? In this case how can the decoders find the entry point?


    1. Yumi Chan (Post author)

      Hi Peter,
      For NALU=0x65, the binary is 01100101 and nal_unit_type = 5 which is an IDR frame. Please check this table:

      1. Peter

        Hi Yumi,
        Do you mean that 0x65, 0x45, 0x25 are all IDR frames? Ok, but what is the difference between them? And what about the statement that nal_ref_idc represents the current priority of the frame? What is the difference between these IDR frames from the decoding aspect?

        1. Yumi Chan (Post author)

          Do you mean that 0x65, 0x45, 0x25 are all IDR frames?
          -> Yes, or No.
          If you just check the last 5 bits, then Yes.

          However, from my understanding, 0x45 & 0x25 should never exist because I-frame should always have nal_ref_idc = 3. And since I-frame is a key frame, it makes sense to have nal_ref_idc = 3.

          Have you ever seen 0x45 & 0x25 so you have such doubt?

          1. Peter

            I took a sample of the Hungarian terrestrial transmission MUX and in some services I found only 00 00 01 45 …. sequence but never 00 00 01 65 …. (H.264 1440 x 1080 HD video).

            1. Yumi Chan (Post author)

              I read the standard again. For the whole doc, it seems that it only cares about whether nal_ref_idc is 0. So, I guess a slice can be successfully decoded, no matter it is 1 or 3. It may just give extra information to the decoder saying that some reference frame is more important than the others, but does not affect the decoding process.

              I haven’t encounter such problem yet so I can’t tell.

              I wonder if you can find any slice with nal_ref_idc = 3, says 0x6X / 0x7X?

              1. Peter

                I found 00 00 00 01 61 in the sample. Is it an I farme?

                1. Yumi Chan (Post author)

                  No, it isn’t

  2. 33Noella

    I must say it was hard to find your site in search results.

    You write great articles but you should rank your page higher in search engines.
    If you don’t know how to do it search on youtube: how to rank a website Marcel’s way

    1. Yumi Chan (Post author)

      Thank you for your support and suggestion!
      I will do better SEO when I am free =)


    For interpretation of SEI messages, the values of the parameters of the picture parameter set and sequence parameter set that are active for the operation of the decoding process for the VCL NAL units of the primary coded picture in the same access unit shall be considered in effect unless otherwise specified in the SEI message semantics.

  4. Suresh

    Hey what i was trying to do is try to differ the non reference frames from the reference frames . I wanted to take all the data required for the non reference frames . Store them in a defenite structures and then use this data later for decoding these frames. Any guidance on how I should go about this whole situation . What data should i be storing so that it can be reused for decoding of these non reference pictures. I am new to the h264 decoder and have worked only on the VP9 codec so if you could tell me where and what to look for would save me a lot of research time.

    1. Yumi Chan (Post author)

      Hi Suresh,

      I recommend you to have a look on the specification, which can be downloaded here:

      It tells you the details of every item in h.264. Hope I can help you!

  5. Bettina

    It’s easier than Forex. It’s not sheer luck, though! $ 151 430 Paid to our traders yesterday. $ 152 810 Paid to our traders yesterday. Register now and get 10.000 virtual FUNDS in case of right forecast! This is FREE! далее тут

    1. Vaibhav Jadhav

      Hi yumi.
      I am totally newbie for H.264.

      Can you please tell me how to decode this SPS data. I am not able to decode SPS data after level_idc(1f).

  6. Vaibhav Jadhav

    Hi yumi.
    I am totally newbie for H.264.

    Can you please tell me how to decode this SPS data. I am not able to decode SPS data after level_idc(1f).

Comments are closed.