I'm using R开发者_运维问答TP TS (Payload 33) to stream some video files in MPEG-2 and MPEG-4, and then perform some tasks over them.
How could I know what type of video (MPEG-2 o MPEG-4) is inside the RTP stream I receive?
Is there any header or field which indicates the one it is?
Thanks for your help.
If you use the rtsp protocol recive streaming you can check the video format of SDP(Session Description Protocol). ex: a=rtpmap:96 MP4 (96 means the payload type)
96 in decade is 1100000 in binary so if the last 7 bits of the second byte of RTP header is 1100000 , that is point!
I just recive MPEG4 streaming so the MPEG2 you can try it use the same way.
Alternatively if you don't have SDP, you can parse the packets.
If you process the PAT and PMT, you can retrieve the stream id for your PID from the PES header.
精彩评论