开发者

VLC streaming using RTP

I am video streaming using RTP.

At the receiver side I am getting packets like this...

(I am printing 1 by开发者_Go百科te value(int))

Packet 1: 128-161-26-121-188-65 -147-141-132-103-00-00-71-00-70-18......

Packet 2: 128-161-26-122-188-144-229-107-132-103-00-00-71-64-71-48.......

I need to know where the IDR of I frame starts. I know that first 12 bytes are of RTP header. But I dont know what does 71(12th byte) and other value represents.

Is it NAL header?

Any Idea?

Thank you


After the 12-byte header, the RTP payload starts.

The first byte of the payload is the NAL unit header. It contains three parts:

+---------------+
|0|1|2|3|4|5|6|7|
+-+-+-+-+-+-+-+-+
|F|NRI|  Type   |
+---------------+

From RFC 3984:

F: 1 bit forbidden_zero_bit. The H.264 specification declares a value of 1 as a syntax violation.

NRI: 2 bits nal_ref_idc. A value of 00 indicates that the content of the NAL unit is not used to reconstruct reference pictures for inter picture prediction. Such NAL units can be discarded without risking the integrity of the reference pictures. Values greater than 00 indicate that the decoding of the NAL unit is required to maintain the integrity of the reference pictures.

Type: 5 bits nal_unit_type. This component specifies the NAL unit payload type as defined in table 7-1 of 1, and later within this memo. For a reference of all currently defined NAL unit types and their semantics, please refer to section 7.4.1 in 1.

The 32 possible values of the payload type, defined by the least significant 5 bits, are listed in Table 1:

  Type   Packet    Type name                        Section
  ---------------------------------------------------------
  0      undefined                                    -
  1-23   NAL unit  Single NAL unit packet per H.264   5.6
  24     STAP-A    Single-time aggregation packet     5.7.1
  25     STAP-B    Single-time aggregation packet     5.7.1
  26     MTAP16    Multi-time aggregation packet      5.7.2
  27     MTAP24    Multi-time aggregation packet      5.7.2
  28     FU-A      Fragmentation unit                 5.8
  29     FU-B      Fragmentation unit                 5.8
  30-31  undefined                                    -

Both of the two packets you mentioned are P-frames. For I-frames, the NAL unit type should be 5, so the 12th byte, in your case, would be 0x75. The NAL unit type for P-frames is 1.


I am assuming you are streaming H264 media. With RTP header being 12 bytes, the NAL starts from the 13th byte onwards. You should parse the headers as mentioned in the RFC 3984 and pass the payload to the decoder.

You can look at some of the implementations for reference such as FFMpeg's source code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜