4

目标

确认 VLC 可以播放来自本地给定 SDP 文件的流。

根据证词,这似乎是可能的:

实验

于是找了一个公开的案例,发现Mobile Streaming,RTSP/RTP,Wowza Streaming Engine | Wowza 媒体系统

这有效,播放带声音的彩色视频:

vlc rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov

我设法使用网络技巧提取 SDP 文件- 如何捕获单个进程的网络流量?- 询问 Ubuntu

strace -f -e trace=network -s 10000 mplayer rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov 2>&1 | grep a=

...然后重新格式化文件并保存到 bbb.sdp

文件看起来像(实际行不以空格开头,并以 Windows 样式的行结尾结束):

o=- 785981631 785981631 IN IP4 184.72.239.149
s=BigBuckBunny_115k.mov
c=IN IP4 184.72.239.149
t=0 0
a=sdplang:en
a=range:npt=0- 596.48
a=control:*
m=audio 0 RTP/AVP 96
a=rtpmap:96 mpeg4-generic/12000/2
a=fmtp:96 profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3;config=1490
a=control:trackID=1
m=video 0 RTP/AVP 97
a=rtpmap:97 H264/90000
a=fmtp:97 packetization-mode=1;profile-level-id=42C01E;sprop-parameter-sets=Z0LAHtkDxWhAAAADAEAAAAwDxYuS,aMuMsg==
a=cliprect:0,0,160,240
a=framesize:97 240-160
a=framerate:24.0
a=control:trackID=2

然后:

vlc bbb.sdp 

在播放列表中显示一个具有正确持续时间的条目(09:56,信息在 SDP 中),但没有视频出现。

跟踪网络调用

VLC media player 2.1.6 Rincewind (revision 2.1.6-0-gea01d28)
Process 15739 attached
[0xf19118] [http] lua interface: Lua HTTP interface
Process 15740 attached
[pid 15739] bind(7, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 0
[pid 15739] bind(7, {sa_family=AF_INET, sin_port=htons(8080), sin_addr=inet_addr("0.0.0.0")}, 16) = -1 EADDRINUSE (Address already in use)
[0xf19118] [http] main interface error: socket bind error (Permission denied)
[pid 15739] bind(7, {sa_family=AF_INET6, sin6_port=htons(8080), inet_pton(AF_INET6, "::", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = -1 EADDRINUSE (Address already in use)
[0xf19118] [http] main interface error: socket bind error (Permission denied)
[0xf19118] [http] main interface error: cannot create socket(s) for HTTP host
[0xf19118] [http] lua interface error: Error loading script /usr/lib/vlc/lua/intf/http.luac: lua/intf/http.lua:328: Failed to create HTTP host
[pid 15739] +++ exited with 0 +++
Process 15741 attached
Process 15742 attached
Process 15743 attached
Process 15744 attached
[0xf3f9a8] dummy interface: using the dummy interface module...
Process 15745 attached
[pid 15745] bind(16, {sa_family=AF_INET, sin_port=htons(15947), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
[pid 15743] bind(17, {sa_family=AF_INET, sin_port=htons(15947), sin_addr=inet_addr("0.0.0.0")}, 16) = -1 EADDRINUSE (Address already in use)
[pid 15745] bind(14, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
[pid 15745] bind(16, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
[pid 15745] bind(18, {sa_family=AF_INET, sin_port=htons(49463), sin_addr=inet_addr("0.0.0.0")}, 16Unable to determine our source address: ) = 0
This computer has an invalid IP address: 0.0.0.0
[pid 15745] bind(17, {sa_family=AF_INET, sin_port=htons(15947), sin_addr=inet_addr("0.0.0.0")}, 16 <unfinished ...>
[pid 15743] bind(15, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("0.0.0.0")}, 16 <unfinished ...>
[pid 15745] <... bind resumed> )        = 0
[pid 15743] <... bind resumed> )        = 0
[pid 15743] bind(19, {sa_family=AF_INET, sin_port=htons(55667), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
[pid 15743] bind(20, {sa_family=AF_INET, sin_port=htons(15947), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
[pid 15743] bind(17, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
[pid 15743] bind(20, {sa_family=AF_INET, sin_port=htons(45441), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
[pid 15745] bind(14, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
[pid 15745] bind(22, {sa_family=AF_INET, sin_port=htons(55005), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
Process 15746 attached
[pid 15743] +++ exited with 0 +++
Process 15747 attached
Process 15748 attached
Process 15749 attached
Process 15750 attached
Process 15751 attached
[0x7f2f80c01838] live555 demux error: no data received in 10s, aborting
[pid 15746] --- SIGRTMIN {si_signo=SIGRTMIN, si_code=SI_TKILL, si_pid=15738, si_uid=1000} ---
[pid 15746] +++ exited with 0 +++
[pid 15751] --- SIGRTMIN {si_signo=SIGRTMIN, si_code=SI_TKILL, si_pid=15738, si_uid=1000} ---
[pid 15751] +++ exited with 0 +++
[pid 15747] +++ exited with 0 +++
[pid 15748] +++ exited with 0 +++
[pid 15749] +++ exited with 0 +++
[pid 15750] +++ exited with 0 +++
[pid 15745] +++ exited with 0 +++

看来 VLC 甚至没有尝试连接到 IP 184.72.239.149 。

我一无所知。这是一个错误吗?

问题

  • 为什么直接从 RTSP URL 播放,而不是播放本地保存的 SDP 文件?
  • 该怎么办?
4

1 回答 1

5

当您在 RTSP 请求期间从服务器接收到 SDP 时,服务器会对其进行自定义,以告诉您它将在哪里发送它开始的流。如果没有 RTSP 控制通道告诉服务器你想要一个 RTP 流,它就不会流出。

只有当您拥有广播/多播 RTP 流或连续“推送”RTP 流时,直接 SDP 播放才有用,而不是在您拥有由 RTSP 发出的 VOD 流时。

于 2016-01-25T00:54:23.990 回答