使用Live555将H.264视频通过RTP流媒体传输到VLC

7

如果您能帮我解决我已经努力解决了几周的H264流媒体问题,我将不胜感激。

我需要从Live555(在Linux机器上)向VLC Media Player(在Windows机器上)流式传输H264视频。 使用RTSP非常好用,但我需要使用RTP而不是RTSP,并且使用RTP时我看不到视频。 VLC甚至无法识别流是否为H264。

这是通过RTSP传输的SDP文件(可正常工作的配置):

v=0
o=- 1277647151953158 1 IN IP4 190.40.14.100
s=Session streamed by "testH264VideoAudioStreamer"
i=test-h264-mux.mpg
t=0 0
a=tool:LIVE555 Streaming Media v2007.05.24
a=type:broadcast
a=control:*
a=source-filter: incl IN IP4 * 190.40.14.100
a=rtcp-unicast: reflection
a=range:npt=0-
a=x-qt-text-nam:Session streamed by "testH264VideoAudioStreamer"
a=x-qt-test-inf:test-h264=mux.mpg
m=video 8554 RTP/AVP 96
c=IN IP4 190.40.15.63/7
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1;profile-level-id=000042;sprop-parameter-sets=H264
a=control:track1

但是,如果我从RTSP切换到RTP,它就无法工作。我尝试在VLC播放器中加载上述SDP文件,但没有效果。
以下是VLC播放器0.8.6d的一些调试输出:
main input debug: thread 4016 (input) created at priority 1 (input/input.c:265)
main input debug: `rtp://@190.40.15.63:8554' gives access `rtp demux' `' path `@190.40.15.63:8554'
main input debug: creating demux: access='rtp' demux='' path='@190.40.15.63:8554'
main demuxer debug: looking for access_demux module: 0 candidates
main demuxer warning: no access_demux module matched "rtp"
main input debug: creating access 'rtp' path='@190.40.15.63:8554'
main access debug: looking for access2 module: 6 candidates
access_udp access debug: opening server=:0 local=190.40.15.63:8554
main access debug: net: connecting to '[]:0@[190.40.15.63]:8554
main access debug: looking for netrowk module: 1 candidate
ipv6 access debug: 190.40.15.63: Host or service not found
main access debug: using network module "ipv6"
main access debug: removing network module "ipv6"
main access debug: looking for netrowk module: 1 candidate
ipv4 access debug: resolving 190.40.15.63:8554...
ipv4 access debug: resolving :0...
main access debug: using network module "ipv4"
main access debug: removing network module "ipv4"
main access debug: using access2 module "access_udp"
main private debug: pre buffering
access_udp access debug: no RTP header detected
main input debug: creating demux: access='rtp' demux='' path='@190.40.15.63:8554'
main demuxer debug: looking for demux2 module: 45 candidates
ts demuxer warning: TS module discarded (lost sync)
ffmpeg demuxer debug: detected format: mp3

在VLC 1.0.5中,我遇到了“未知负载类型”错误,并且由于“未知网络堆栈错误”,SDP根本无法加载。其他显示的错误包括“不支持SDP连接信息”和“Sap分离器警告:无效的SDP”。任何帮助将不胜感激!谢谢,Ilya。

1
一个快速的评论:你的SDP文件在技术上是无效的。你应该对SPS和PPS信息进行base-64编码,用逗号分隔,并将其附加到你的sprop-parameter-sets中。你把它设置为字符串“H264”,这绝对是错误的(尽管非常普遍,不幸的是)。 - kidjan
1个回答

8
我需要做的是使用SDP文件而不是直接打开流。原来只有在使用RTSP时才会传输SDP数据。在流媒体RTP时,我必须自己提供SDP文件。
所以我所做的是:
  1. 使用RTSP进行流媒体(可行的方法),
  2. 使用Wireshark记录通过RTSP传输的SDP文件,
  3. 将SDP保存为扩展名为.sdp的文本文件,
  4. 在VLC中,打开SDP文件而不是直接打开网络流。
然后它就神奇地运行了!

还可以通过使用 *env<<serverMediaSessionObj->generateSDPDescription() 行打印 SDP 内容。将其复制并保存为 .sdp 扩展名,然后使用 vlc 播放。 - Aswin

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接