使用套接字从嵌入式设备播放 RTP 流
我正在嵌入式设备上编写一个应用程序,该设备接收携带 G.729、PCM 或 H.264 的 RTP 流。数据包作为 RTP 数据包的 char* 到达我的应用程序。我希望能够看到或收听流(作为测试),但在此设备上我没有播放器。我想我可以将此流转发到套接字并在其他地方播放 RTP 流,例如在运行播放器的 Linux 机器上。这可能吗?我没有RTSP,只有RTP。例如,VLC 是一种可能的方法吗?我可以简单地将 RTP 数据包发送到套接字以在另一端播放它们吗? 谢谢!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
包含 H.264 流的 SDP 示例:
example of SDP that contains H.264 stream:
不,你不能。简单 RTP 不包含任何有关流格式等的信息,仅包含有关数据包本身的信息:序列号、时间戳、附加同步信息。传输 RTP 的最简单方法是 RTP/MPEG TS (MPEG 传输流)。
不幸的是我不知道准备使用解决方案。 VLC 可以通过 UDP 从文件流式传输(并播放)此类流,因此它从文件容器格式获取所需信息。这样的解决方案可以采用 SDP 格式的外部流描述和您的实际 RTP 数据包
[编辑] 顺便说一句,它是奇怪的是,您只收到 RTP 流,没有对其格式的任何描述,通常其描述是由 RTSP、MPEG-TS 或其他内容以某种方式提供的
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
您可以通过 UDP 套接字转发 RTP 数据包。
You can forward RTP packets over a UDP socket.