MPEG4 frame parsing from rtp packets

I am trying to parse various mpeg4 frames from an rtp stream coming from an axial camera and transfer packets to the ffmpeg library using the avcodec_decode_video function. here are the steps that I am doing 1. the rtsp stream is initialized 2. the rtp stream starts to flow in 3. The first packet that I receive starts with 000001b0 ... and the configuration data follows, and after that frame starts with 000001b6 .. the second payload rtp will be different until I get the rtp packet where the marker bit is set. after that I get a packet starting with 000001b6 and goes for about 5-10 RTT packets. This pattern is repeated.

what do I do if I detect 000001b0 / b6 - I will accumulate all packets coming after and feed a larger buffer to the avcodec_decode_video libavcodec function, after the decoder context is correctly initialized.

But I get a crappy image here, with the uppermost part, a horizontal strip - a crystal clear image, and the rest is crappy. I’m not sure why he behaves like this. Please help me

The data that I receive in the rtp package is dynamic-96.

indicate that: when I transfer iframes and p frames that are absorbed in the propositional protocol of some other manufacturer, ffmpeg can parse and give very good things.

Any help is appreciated.

+3
source share
1 answer

MPEG4 IP- AXIS. / , :

  • : SIMPLE
  • [x] ISMA
  • GOV: IP

, "" " " ( , , , ).

, ...

, , MPEG4 RTP. ( , ):

  • " " ( " Visual Object" ) 000001B0 (hex). , . , , VOP, . , AXIS SDP ( DESCRIBE RTSP), : a=fmtp:96 profile-level-id=245; config=000001B0F5000001B5891300000100000001200086C40FA28A021E0A21. , , SDP, VOS ... , .

  • (I-VOP, P-VOP, B-VOP) 000001B6. GOV 10, - "IP", 1 I-Frame (I-VOP) 9 P-VOP-s, 000001B6. BITS FIFTH. , VOP, :

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

, , VOS , I-VOP. , RTP ... I-VOP 10000B, MTU - 1400B, . , AXIS I-VOP BIG- FRAGMENTS, RTP RTP-, MTU. - ():

  • 10000B MTU ( 1400B MTU 8x [1400B] 1x [200B] ).
  • RTP MARKER BIT, 0
  • RTP MARKER BIT, 1,

, , , 10KB FRAME, . , MTU , , , . ...

:

  • 000001B6 000001B0 RTP MARKER, 0. MARKER 1, , , ! 0, ...
  • , , MARKER BIT, 1. , .
  • , !

, , ...:)

+9

Source: https://habr.com/ru/post/1772733/


All Articles