我已经在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:
使用RTSP/RTP流式传输到Android设备时,RTP部分必须通过UDP流动.Android不支持RTSP/RTP交叉(RTP over TCP).这意味着如果UDP不可用于RTP播放,则TCP上的RTP将无法用作故障转移,并且您的流将无法播放.
考虑到它是在2010年发布的,Android 4.x现在是否支持TCP上的RTSP?我发现很多帖子询问如何强制通过TCP以外的TCP传输.我猜不是.
如果没有,我可以通过重新编译和使用ffmpeg库来实现吗?
基本上我希望ffmpeg可以帮助我自动切换到TCP,而UDP不可用.