- 收藏
- 点赞
- 分享
- 举报
live555移植笔记三 ubuntu下保存接收的RTSP数据并保存
[i=s] 本帖最后由 microcreat 于 2013-1-7 09:21 编辑 [/i]
在有上面的2个例子在ubuntu下面的成功的例子后,虽然能够播放了,但是想保存数据文件怎办? 看了下代码,结果发现,只有加一个参数就可以讲数据保存为文件: 一,首先打开RTSP服务器: root@microcreat:/workdir/private/live/mediaServer# pwd /workdir/private/live/mediaServer root@microcreat:/workdir/private/live/mediaServer# ls COPYING in_demo.264 Makefile.head DynamicRTSPServer.cpp live555MediaServer Makefile.tail DynamicRTSPServer.hh live555MediaServer.cpp version.hh DynamicRTSPServer.o live555MediaServer.o in.264 Makefile
root@microcreat:/workdir/private/live/mediaServer# ./live555MediaServer
LIVE555 Media Server
version 0.75 (LIVE555 Streaming Media library version 2012.09.27).
Play streams from this server using the URL
rtsp://192.168.196.128/
Received 152 new bytes of response data. Received a complete OPTIONS response: RTSP/1.0 200 OK CSeq: 2 Date: Mon, Jan 07 2013 01:12:21 GMT Public: OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, GET_PARAMETER, SET_PARAMETER
Sending request: DESCRIBE rtsp://192.168.196.128/in.264 RTSP/1.0 CSeq: 3 User-Agent: ./openRTSP (LIVE555 Streaming Media v2012.09.27) Accept: application/sdp
Received 658 new bytes of response data. Received a complete DESCRIBE response: RTSP/1.0 200 OK CSeq: 3 Date: Mon, Jan 07 2013 01:12:21 GMT Content-Base: rtsp://192.168.196.128/in.264/ Content-Type: application/sdp Content-Length: 495
v=0 o=- 1357521141391924 1 IN IP4 192.168.196.128 s=H.264 Video, streamed by the LIVE555 Media Server i=in.264 t=0 0 a=tool:LIVE555 Streaming Media v2012.09.27 a=type:broadcast a=control:* a=range:npt=0- a=x-qt-text-nam:H.264 Video, streamed by the LIVE555 Media Server a=x-qt-text-inf:in.264 m=video 0 RTP/AVP 96 c=IN IP4 0.0.0.0 b=AS:500 a=rtpmap:96 H264/90000 a=fmtp:96 packetization-mode=1;profile-level-id=42001E;sprop-parameter-sets=Z0IAHpWoLQSZ,aFOPIA== a=control:track1
Opened URL "rtsp://192.168.196.128/in.264", returning a SDP description: v=0 o=- 1357521141391924 1 IN IP4 192.168.196.128 s=H.264 Video, streamed by the LIVE555 Media Server i=in.264 t=0 0 a=tool:LIVE555 Streaming Media v2012.09.27 a=type:broadcast a=control:* a=range:npt=0- a=x-qt-text-nam:H.264 Video, streamed by the LIVE555 Media Server a=x-qt-text-inf:in.264 m=video 0 RTP/AVP 96 c=IN IP4 0.0.0.0 b=AS:500 a=rtpmap:96 H264/90000 a=fmtp:96 packetization-mode=1;profile-level-id=42001E;sprop-parameter-sets=Z0IAHpWoLQSZ,aFOPIA== a=control:track1
Created receiver for "video/H264" subsession (client ports 42010-42011) Sending request: SETUP rtsp://192.168.196.128/in.264/track1RTSP/1.0 CSeq: 4 User-Agent: ./openRTSP (LIVE555 Streaming Media v2012.09.27) Transport: RTP/AVP;unicast;client_port=42010-42011
Received 209 new bytes of response data. Received a complete SETUP response: RTSP/1.0 200 OK CSeq: 4 Date: Mon, Jan 07 2013 01:12:21 GMT Transport: RTP/AVP;unicast;destination=192.168.196.128;source=192.168.196.128;client_port=42010-42011;server_port=6970-6971 Session: 60BFBE6B
Setup "video/H264" subsession (client ports 42010-42011) Created output file: "microcreat-video-H264-1" Sending request: PLAY rtsp://192.168.196.128/in.264/RTSP/1.0 CSeq: 5 User-Agent: ./openRTSP (LIVE555 Streaming Media v2012.09.27) Session: 60BFBE6B Range: npt=0.000-
Received 184 new bytes of response data. Received a complete PLAY response: RTSP/1.0 200 OK CSeq: 5 Date: Mon, Jan 07 2013 01:12:21 GMT Range: npt=0.000- Session: 60BFBE6B RTP-Info: =rtsp://192.168.196.128/in.264/track1;seq=45374;rtptime=2776738273
Started playing session Receiving streamed data (signal with "kill -HUP 2050" or "kill -USR1 2050" to terminate)... Received RTCP "BYE" on "video/H264" subsession (after 9 seconds) Sending request: TEARDOWN rtsp://192.168.196.128/in.264/RTSP/1.0 CSeq: 6 User-Agent: ./openRTSP (LIVE555 Streaming Media v2012.09.27) Session: 60BFBE6B
Received 65 new bytes of response data. Received a complete TEARDOWN response: RTSP/1.0 200 OK CSeq: 6 Date: Mon, Jan 07 2013 01:12:30 GMT
root@microcreat:/workdir/private/live/testProgs# ls microcreat* -l -rw-r--r-- 1 root root 2389166 2013-01-07 09:12 microcreat-video-H264-1 这样就可以看到生成的文件了。 三,用mplayer验证此文件是否能够播放: root@microcreat:/workdir/private/live/testProgs# mplayer microcreat-video-H264-1
OK,可以正常播放!
说明: 可能会有疑问,为什么文件名是这样的呢? 跟踪代码就可以看到这个问题: 打开: vim playCommon.cpp
.............................
// Create an output file for each desired stream:
char outFileName[1000];
if (singleMedium == NULL) {
// Output file name is
// "
可以看到最后的文件名由几部分组成: filename-prefix medium_name codec_name counter microcreat video H264 1 其实执行这个demo程序,会自动保存为一个默认的名字,实际上已经源码已经做了这个方面的处理了!
Markdown 语法
- 加粗**内容**
- 斜体*内容*
- 删除线~~内容~~
- 引用> 引用内容
- 代码`代码`
- 代码块```编程语言↵代码```
- 链接[链接标题](url)
- 无序列表- 内容
- 有序列表1. 内容
- 缩进内容
- 图片![alt](url)
-
2013-01-07 08:59:41
-
2013-01-07 09:26:32
-
2013-01-07 09:03:33
-
2014-12-15 09:29:44
-
2013-08-23 10:55:38
-
2020-07-16 16:28:29
-
2015-04-30 17:17:11
-
2013-01-30 00:14:56
-
2018-11-25 11:08:57
-
2017-01-21 15:59:16
-
2016-11-04 17:00:03
-
2024-01-17 13:59:28
-
2024-01-17 14:00:29
-
2018-08-23 16:21:26
-
2023-11-08 18:03:13
-
2020-11-10 11:50:22
-
2021-03-18 16:00:14
-
2013-08-20 11:49:37
-
2017-02-20 16:56:28
-
5Hi3516CV610 如何使用SD卡升级固件
-
5cat /dev/logmpp 报错 <3>[ vi] [func]:vi_send_frame_node [line]:99 [info]:vi pic queue is full!
-
50如何获取vpss chn的图像修改后发送至vo
-
5FPGA通过Bt1120传YUV422数据过来,vi接收不到数据——3516dv500
-
50SS928 运行PQtools 拼接 推到设备里有一半画面会异常
-
53536AV100的sample_vdec输出到CVBS显示
-
10海思板子mpp怎么在vi阶段改变视频数据尺寸
-
10HI3559AV100 多摄像头同步模式
-
9海思ss928单路摄像头vio中加入opencv处理并显示
-
10EB-RV1126-BC-191板子运行自己编码的程序
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明