Playing RTP stream from embedded device using sockets
I'm writing an application on an embedded device which receives an RTP stream which carries G.729, PCM or H.264. The packets arrive to my application as a char* to the RTP packet.开发者_运维百科 I would like to be able to see or listen to the stream (as a test), but on this device I don't have player. I thought I may forward this stream to a socket and play the RTP stream somewhere else, like on a Linux machine running a player. Would this be possible? I don't have RTSP, only RTP. Is VLC, for instance, a possible way to do this? Can I simply send the RTP packets to the socket to play them on the other side? Thanks!
example of SDP that contains H.264 stream:
Server: rtsp server
Content-type: application/sdp
Content-base: rtsp://[some URL]
Content-length: 505
v=0
o=rtsp 1295996924 1590699491 IN IP4 0.0.0.0
s=RTSP Session
i=rtsp server
c=IN IP4 192.168.1.2
t=0 0
a=control:*
m=audio 0 RTP/AVP 97
a=rtpmap: 97 mpeg4-generic/8000/1
a=fmtp: 97 streamtype=5; profile-level-id=15; objectType=2; mode=AAC-hbr;
a=range:npt=now-
a=control:trackID=0
m=video 0 RTP/AVP 96
a=rtpmap:96 H264/90000
a=fmtp:96 profile-level-id=42E015; sprop-parameter-sets=Z0LgFdoHgtE=,aM4wpIA=; packetization-mode=1
a=range:npt=now-
a=framesize:96 480-352
a=control:trackID=1
no, you cannot. simple RTP doesn't contain any info about the stream format etc., only info about the packet itself: sequence number, timestamp, additional synchronization info. the simplest way to stream RTP is RTP/MPEG TS (MPEG Transport Stream).
unfortunately I don't know ready to use solution. VLC can stream (and play) such streams over UDP from a file, so it takes required info from file container format. Such solution could take external stream description in SDP format and your actual RTP packets
[EDIT] btw, it's weird that you receive just RTP stream w/o any description of its format, usually its description is provided somehow by RTSP, MPEG-TS or something else
You can forward RTP packets over a UDP socket.
精彩评论