English 中文(简体)
RTP 溪流中的MPEG4/H264 I-Frame (IDR)
原标题:Detect MPEG4/H264 I-Frame (IDR) in RTP stream
  • 时间:2009-12-24 08:42:33
  •  标签:
  • rtp
  • rtsp

我需要探测RPG4 I-Frame在RPTP包装中。 我知道如何去除区域边界评估的头盔,使区域空间评估4框架进入其中,但我可以说明如何确定I-Frame。

它是否有具体签字/签字人?

最佳回答

因此,我对头264溪流进行了估算。

• 如何探测I-Frame:

  • remove RTP header
  • check the value of the first byte in h264 payload
  • if the value is 124 (0x7C) it is an I-Frame

我无法从MPEG4-ES 溪流中看出这一点。

www.un.org/Depts/DGACM/index_spanish.htm EDIT: H264 IDR

www.un.org/Depts/DGACM/index_french.htm 你只是穿透阵列,它代表通过区域TP收到的头264块碎片。 如果你想通过整个区域优惠制,仅更正RTPHeaderBytes,价值为skip RTP主管。 我总是拿到I-Frame,因为它是唯一可以支离破碎的框架,见here。 我在服务器上使用这部(简化)法典,它像一个harm! 如果I-Frame(IDR)不支离破碎,fragment_type将是5,那么该代码将退回true,用于支离破碎的IDRs。

public static bool isH264iFrame(byte[] paket)
    {
        int RTPHeaderBytes = 0;

        int fragment_type = paket[RTPHeaderBytes + 0] & 0x1F;
        int nal_type = paket[RTPHeaderBytes + 1] & 0x1F;
        int start_bit = paket[RTPHeaderBytes + 1] & 0x80;

        if (((fragment_type == 28 || fragment_type == 29) && nal_type == 5 && start_bit == 128) || fragment_type == 5)
        {
            return true;
        }

        return false;
   }

下表列出NAL单位类型:

 Type Name
    0 [unspecified]
    1 Coded slice
    2 Data Partition A
    3 Data Partition B
    4 Data Partition C
    5 IDR (Instantaneous Decoding Refresh) Picture
    6 SEI (Supplemental Enhancement Information)
    7 SPS (Sequence Parameter Set)
    8 PPS (Picture Parameter Set)
    9 Access Unit Delimiter
   10 EoS (End of Sequence)
   11 EoS (End of Stream)
   12 Filter Data
13-23 [extended]
24-31 [unspecified] 

<EDIT 2 MPEG4 I-VOP

我原打算对此加以更新。 Thanx to Che and

  1. VOP (Video Object Plane -- frame) starts with a code 000001B6(hex). It is the same for all MPEG4 frames (I,P,B)
  2. 其次,我不想在此作描述(见电离层电离层电离层电离层电离层电离层电离层电离层电离层),但仅(如 said)需要从以下沥青中增加2个轨道(在带值的电线之后的2个轨道)。 这2个轨道告诉你,VOP_ CODING_TYPE, see the table:

    VOP_CODING_TYPE (binary)  Coding method
                          00  intra-coded (I)
                          01  predictive-coded (P)
                          10  bidirectionally-predictive-coded (B)
                          11  sprite (S)
    

因此,为了找到I-Frame,从4英特字母000001B6开始的包装,并找到了下一个星号00上更高的两个比方。 这将在MPEG4的流体中找到一个简单的视频物体类型(不确保先进简单)。

对于任何其他问题,你可以检查所提供的文件(),你们都想知道MPEG4:

问题回答

据我所知,MPEG4-ES的流体碎片通常从MPEG4的起算法开始,这可以是:

  • 0x000001b0: visual_object_sequence_start_code (probably keyframe)
  • 0x000001b6: vop_start_code (keyframe, if the next two bits are zero)
  • 0x000001b3: group_of_vop_start_code, which contains three bytes and then hopefully a vop_start_code that may or may not belong to a keyframe (see above)
  • 0x00000120: video_object_layer_start_code (probably keyframe)
  • 0x00000100-0x0000011f: video_object_start_code (those look like keyframes as well)
  • something else (probably not a keyframe)

恐怕你需要把溪流 par起来,以确保:

This worked for me:
- Figure out the "payload type", for example: Payload type: DynamicRTP-Type-96 (96)
- Tell wireshark which stream is H264: File->preferences->protocols->H264. Enter 96 as payload type.
- Filter on slice_type:"h264.slice_type eq 7"

H264:

  1. Remove RTP header.
  2. If chunk NAL type (in first byte) is SPS (7) or PPS (8) mark the frame as IFrame (many cameras not use SPS and PPS (Axis included)).
  3. If chunk NAL type is #28 FU A (fragmentation unit A), check FU Header (next byte) if is NAL type IDR (5) (IDR (Instantaneous Decoding Refresh) Picture) is an IFrame.

实例:

nal_ref_idc: 3, nal type: 7 (0x07) descripcion: 7 (SPS)<br>
00000000  24 00 00 2B 80 60 22 ED 96 57 3E 68 57 F3 22 B5  $..+.`"í.W>hWó"µ<br>
00000010  67 64 00 1E AD 84 01 0C 20 08 61 00 43 08 02 18  gd..­... .a.C...

00000020  40 10 C2 00 84 2B 50 5A 09 34 DC 04 04 04 08  @.Â..+PZ.4Ü....<br>
nal_ref_idc: 3, nal type: 8 (0x08) descripcion: 8 (PPS)<br>
00000000  24 00 00 10 80 60 22 EE 96 57 3E 68 57 F3 22 B5  $....`"î.W>hWó"µ
00000010  68 EE 3C B0  hî<°

FU_A (fragmentation unit A) 
nal_ref_idc: 3, nal type: 5 (0x05) descripcion: 5 (IDR (Instantaneous Decoding Refresh) Picture)
00000000  24 00 05 96 80 60 22 F1 96 57 3E 68 57 F3 22 B5  $....`"ñ.W>hWó"µ
00000010  7C 05 A0 AA 2F 81 92 AB CA FE 9E 34 D8 06 AD 74  |. ª/..«Êþ.4Ø.­t
...

0x000001b6: vop_start_code (keyframe, if the next two bits are zero) this is correct way for MPEG-4





相关问题
h264 RTP timestamp

I have a confusion about the timestamp of h264 RTP packet. I know the wall clock rate of video is 90KHz which I defined in the SIP SDP. The frame rate of my encoder is not exactly 30 FPS, it is ...

How can I mux/demux RTP media from one stream?

Currently, I m finding a lib able to stream video from multiple sources through one RTP Stream (one connection). Anbody have sugesstion on it? Actually, I figured out that Opal 3.8 is VoIP lib, ...

Rtp on Java beginners help?

I have started playing around with RTP on Java in Android and was wondering if anyone could give me a bit of help or guidance. Here is the code I have started on: public void rtpTest() throws ...

H264 RTP packet parsing [closed]

I am looking for source code of RTP Payload Format for H.264 Video according to RFC(3984). It would be great if someone can point out it. Also I am looking for wireshark plugin which can show me the ...

Reasons to use RTP when streaming a pre-existing file?

The only reason I could think of for using RTP to transfer a pre-existing file is if you re trying to monitor the amount of time a user is streaming the file, like if you re running a time-based On-...

udp socket options for sendng RTP

I am opening socket on windows platform for sending RTP voice packets. The application is softphone. What preferable options should be set on this socket.

RTP 溪流中的MPEG4/H264 I-Frame (IDR)

我需要探测RPG4 I-Frame在RPTP包装中。 我知道如何去除区域边界评估的头盔,使区域空间评估4框架进入其中,但我可以说明如何确定I-Frame。

热门标签