MPEG4 extract from RTP payload

穿精又带淫゛_ 提交于 2020-01-02 09:19:37

问题


I'm trying to extract mpeg4 from an rtp payload , format of the rtsp media (video) is MP4V-ES but I'm not able to extract the mp4 from the payload . when I dump the extract into a raw file and use ffmpeg to convert it into .avi or .mpg its not working. I don't know what I'm missing here. the code is written in java. I want to extract each video frame from the rtp and save that in a file or retransmit it.

Thanks

Question UPDATED..... Thanks for the inputs, actually I'm able to extract bytes from 000001b6 and sent it to ffmpeg , but it complains about not header information and then I constructed a header with 000001b0 00000000 and 000001B5 00000005 and sent that to the ffmpeg but no luck. can you help me here, because what I'm getting from RTP is 000001b6 [data] and again 000001b6 [data] I even followed 'Cipi' to just add 000001 but not working. am I missing something here ! and also want to know whether I need to decode/encode as what I get from the RTP is the actual mpeg4 data right then I don't know why to decode it , can I just save it a file and open with quicktime or VLC and it shoud show one frame right.


回答1:


MPEG-4 Video RTP payload is described in RTP Payload Format for MPEG-4 Audio/Visual Streams.

See also How to process raw UDP packets so that they can be decoded by a decoder filter in a directshow source filter with a brief description of steps you need to reconstruct the MPEG-4 video stream.

Update: You might need to look for B0 and B5 in your session descriptor. So that you know where to look for, here is an example of MPEG-4 RTSP/SDP response:

RTSP/1.0 200 OK
CSeq: 2
Content-Base: rtsp://192.168.0.57/webcam/
Content-Type: application/sdp
Content-Length: 320

v=0
o=- 1 1 IN IP4 127.0.0.1
s=Test
a=type:broadcast
t=0 0
c=IN IP4 0.0.0.0
m=video 0 RTP/AVP 96
a=rtpmap:96 MP4V-ES/90000
a=fmtp:96 profile-level-id=1;config=000001B003000001B509000001000000012000C488BA9850584121463F
a=control:track0
m=audio 0 RTP/AVP 97
a=rtpmap:97 AMR/8000/1
a=fmtp:97
a=control:track1


来源:https://stackoverflow.com/questions/7887922/mpeg4-extract-from-rtp-payload

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!