求助 Java 实现下载 rtsp 协议的网络视频。
在网上(
https://blog.csdn.net/mengzhengjie/article/details/45133083 )找到代码,替换了视频的地址。
运行后日志:
$ java RTSPClient
端口打开成功
OPTIONS
rtsp://newvod.ahbbtv.com:1935/vod/_definst_/mp4:vod/2019/5/30 RTSP/1.0
Cseq: 1
返回内容:
RTSP/1.0 200 OK
CSeq: 1
Server: Wowza Streaming Engine 4.1.2 build13947
Cache-Control: no-cache
Public: DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, OPTIONS, ANNOUNCE, RECORD, GET_PARAMETER
Supported: play.basic, con.persistent
DESCRIBE
rtsp://newvod.ahbbtv.com:1935/vod/_definst_/mp4:vod/2019/5/30/2019_5_30_20_23_31_10370_576P_600k.mp4?akrstarttime=1559318076&akrendtime=1559404476&akrCustomParameter=akr1559318076332&akrhash=PGuLYS-4IzT4kRFDZHttng5k1KpgUdbH40a9UJjEs5A= RTSP/1.0
Cseq: 2
返回内容:
RTSP/1.0 200 OK
CSeq: 2
Server: Wowza Streaming Engine 4.1.2 build13947
Cache-Control: no-cache
Expires: Mon, 3 Jun 2019 10:10:29 HKT
Content-Length: 620
Content-Base:
rtsp://newvod.ahbbtv.com:1935/vod/_definst_/mp4:vod/2019/5/30/2019_5_30_20_23_31_10370_576P_600k.mp4/Date: Mon, 3 Jun 2019 10:10:29 HKT
Content-Type: application/sdp
Session: 230416585;timeout=60
v=0
o=- 230416585 230416585 IN IP4 127.0.0.1
s=vod/2019/5/30/2019_5_30_20_23_31_10370_576P_600k.mp4
c=IN IP4 0.0.0.0
t=0 0
a=sdplang:en
a=range:npt=0- 1673.628
a=control:*
m=audio 0 RTP/AVP 96
a=rtpmap:96 mpeg4-generic/44100/2
a=fmtp:96 profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3;config=1210
a=control:trackID=1
m=video 0 RTP/AVP 97
a=rtpmap:97 H264/90000
a=fmtp:97 packetization-mode=1;profile-level-id=64001E;sprop-parameter-sets=Z2QAHqzZQLQSb/wAQAA8QAAAAwBAAAAMg8WLZYA=,aOvssiw=
a=cliprect:0,0,576,720
a=framesize:97 720-576
a=framerate:25.0
a=control:trackID=2
SETUP
rtsp://newvod.ahbbtv.com:1935/vod/_definst_/mp4:vod/2019/5/30/2019_5_30_20_23_31_10370_576P_600k.mp4?akrstarttime=1559318076&akrendtime=1559404476&akrCustomParameter=akr1559318076332&akrhash=PGuLYS-4IzT4kRFDZHttng5k1KpgUdbH40a9UJjEs5A=/trackID=1m=video 0 RTP/AVP 97
a=rtpmap:97 H264/90000
a=fmtp:97 packetization-mode=1;profile-level-id=64001E;sprop-parameter-sets=Z2QAHqzZQLQSb/wAQAA8QAAAAwBAAAAMg8WLZYA=,aOvssiw=
a=cliprect:0,0,576,720
a=framesize:97 720-576
a=framerate:25.0
a=control:trackID=2
RTSP/1.0
Cseq: 3
Transport: RTP/AVP;UNICAST;client_port=16264-16265;mode=play
接收到数据为空,重新启动连接
----------------------------------------------------------------------------------------
拜托,大佬指点迷津。我改如何下载这段视频呢??
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
https://www.v2ex.com/t/570210
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.