我已经在 Android 中使用 VideoView 在 wowza 上成功播放视频。现在我要处理我的服务器,UDP 端口似乎被阻止。以openRTSP命令证明:
-> % openRTSP rtsp://61.218.52.250:554/live/ch00_0
Opening connection to 61.218.52.250, port 554...
...remote connection opened
Sending request: OPTIONS rtsp://61.218.52.250:554/live/ch00_0 RTSP/1.0
CSeq: 2
User-Agent: openRTSP (LIVE555 Streaming Media v2013.12.16)
Received 105 new bytes of response data.
Received a complete OPTIONS response:
RTSP/1.0 200 OK
CSeq: 2
Server: UBNT Streaming Server v1.2
Public: DESCRIBE, SETUP, TEARDOWN, PLAY
Sending request: DESCRIBE rtsp://61.218.52.250:554/live/ch00_0 RTSP/1.0
CSeq: 3
User-Agent: openRTSP (LIVE555 Streaming Media v2013.12.16)
Accept: application/sdp
Received 562 new bytes of response data.
Received a complete DESCRIBE response:
RTSP/1.0 200 OK
CSeq: 3
Server: UBNT Streaming Server v1.2
Content-Base: rtsp://61.218.52.250:554/live/ch00_0/
Content-Type: application/sdp
Content-Length: 393
v=0
o=- 1 1 IN IP4 127.0.0.1
s=Ubiquiti Live
i=UBNT Streaming Media
c=IN IP4 0.0.0.0
t=0 0
m=video 0 RTP/AVP 99
b=AS:50000
a=framerate:25
a=x-dimensions:1280,720
a=x-vendor-id:ubnt,a521
a=x-rtp-ts:4617405454576779984
a=rtpmap:99 H264/90000
a=fmtp:99 profile-level-id=42A01E;packetization-mode=1;sprop-parameter-sets=Z0IAKOkAoAt1xIAG3dAAzf5gDYgQlA==,aM4xUg==
a=control:trackID=0
Opened URL "rtsp://61.218.52.250:554/live/ch00_0", returning a SDP description:
v=0
o=- 1 1 IN IP4 127.0.0.1
s=Ubiquiti Live
i=UBNT Streaming Media
c=IN IP4 0.0.0.0
t=0 0
m=video 0 RTP/AVP 99
b=AS:50000
a=framerate:25
a=x-dimensions:1280,720
a=x-vendor-id:ubnt,a521
a=x-rtp-ts:4617405454576779984
a=rtpmap:99 H264/90000
a=fmtp:99 profile-level-id=42A01E;packetization-mode=1;sprop-parameter-sets=Z0IAKOkAoAt1xIAG3dAAzf5gDYgQlA==,aM4xUg==
a=control:trackID=0
Created receiver for "video/H264" subsession (client ports 63346-63347)
Sending request: SETUP rtsp://61.218.52.250:554/live/ch00_0/trackID=0 RTSP/1.0
CSeq: 4
User-Agent: openRTSP (LIVE555 Streaming Media v2013.12.16)
Transport: RTP/AVP;unicast;client_port=63346-63347
Received 47 new bytes of response data.
Received a complete SETUP response:
RTSP/1.0 461 Unsupported Transport
CSeq: 4
Failed to setup "video/H264" subsession: 461 Unsupported Transport
搜索了一圈后我发现似乎Android 仍然不支持基于 TCP 的 RTSP http://www.wowza.com/forums/content.php?62#device:
使用 RTSP/RTP 流式传输到 Android 设备时,RTP 部分
必须通过 UDP 传输。 Android 不支持 RTSP/RTP 交错 (RTP
通过 TCP)。这意味着如果 UDP 无法用于 RTP 播放,则 RTP
通过 TCP 的传输无法作为故障转移,并且您的流将无法播放。
考虑到它是在 2010 年发布的,Android 4.x 现在支持 RTSP over TCP 吗?我发现很多帖子询问如何强制通过 TCP(而不是 UDP)传输。我想不是。
如果没有,我可以通过重新编译和使用 ffmpeg 库来实现吗?
基本上我希望 ffmpeg 可以帮助我在 UDP 不可用时自动切换到 TCP。