最近在研究RTSP协议,因此,基于Ubuntu系统,利用Darwin Streaming Server搭建了一个RTSP服务器。其实很简单。
1、将DarwinStreamingSrvr5.5.5-Linux.tar.gz解压缩:
tarx zvf DarwinStreamingSrvr5.5.5-Linux.tar.gz
2、在DarwinStreamingSrvrlinux-Linux目录下运行./Install,在安装过程中提示设置admin账号以及密码,使用这个帐号可以通过网页对DSS的配置进行管理
3、安装完之后通过http://<IPaddress>:1220可以访问DSS的配置页面,Streaming的文件默认位于server的/usr/local/movies目录下
测试可以使用它自带的测试文件。把文件拷贝到/usr/local/movies下面。
可以利用vlc打开"网络串流"测试一下服务器能否正常工作:
rtsp://192.168.56.128/java.mp4
开始打开失败,wireshark抓包发现是rstp(vlc(windows上)和Dss(linux上) 之间)协商失败,错误码是415:Media type not supported.
网上所搜索发现是缺少对视频文件java.mp4进行"后处理"
下载mp4creator-win32-1.6.1e-pre.zip,解压得到MP4creator.exe,将这个文件拷贝到c:\windows路径下面.
开启windows的cmd
E:\install_software>mp4creator -v //检查MP4creator的可用性 usage: mp4creator <options> <mp4-file> Options: -aac-old-file-format Use old file format with 58 bit adts headers -aac-profile=[2|4] Force AAC to mpeg2 or mpeg4 profile -allow-avi-files Allow avi files -calcH263Bitrates Calculate and add bitrate information -create=<input-file> Create track from <input-file> input files can be of type: .263 .aac .ac3 .amr .mp3 .divx .mp4v .m4v .cmp . xvid .chap -encrypt[=<track-id>] Encrypt a track, also -E -extract=<track-id> Extract a track -delete=<track-id> Delete a track -force3GPCompliance Force making the file 3GP compliant. This disables ISM A compliance. -forceH263Profile=<profile> Force using H.263 Profile <profile> (default is 0) -forceH263Level=<level> Force using H.263 level <level> (default is 10) -H263CbrTolerance=<value> Define H.263 CBR tolerance of [value] (default: 10 %) -hint[=<track-id>] Create hint track, also -H -interleave Use interleaved audio payload format, also -I -list List tracks in mp4 file -make-isma-10-compliant Insert bifs and od tracks required for some ISMA playe rs (also -i) -mpeg4-video-profile=<level> Mpeg4 video profile override -mtu=<size> Maximum Payload size for RTP packets in hint track -optimize Optimize mp4 file layout -payload=<payload> Rtp payload type (use 3119 or mpa-robust for mp3 rfc 3119 support) -rate=<fps> Video frame rate, e.g. 30 or 29.97 -qth=<height> Set a new height for QuickTime display -qtw=<width> Set a new width for QuickTime display -timescale=<ticks> Time scale (ticks per second) -use64bits Use for large files -use64bitstime Use for 64 Bit times (not QT player compatible) -variable-frame-rate Enable variable frame rate for mpeg4 video -verbose[=[1-5]] Enable debug messages -version Display version information E:\install_software>mp4creator -list java.mp4// 查看原来的文件信息 Track Type Info 1 video H264 [email protected], 421.166 secs, 397 kbps, 1024x768 @ 30.000047 fps 2 audio MPEG-4 AAC LC, 421.209 secs, 126 kbps, 44100 Hz E:\install_software>mp4creator -hint=1 java.mp4// hint 1 MP4ERROR: MP4File::FindIntegerProperty: no such property - moov.trak[0].mdia.min f.stbl.stsd.*.esds.decConfigDescr.objectTypeId MP4ERROR: MP4File::FindIntegerProperty: no such property - moov.trak[2].mdia.min f.stbl.stsd.*.esds.decConfigDescr.objectTypeId E:\install_software>mp4creator -hint=2 java.mp4 // hint 2 MP4ERROR: MP4File::FindIntegerProperty: no such property - moov.trak[0].mdia.min f.stbl.stsd.*.esds.decConfigDescr.objectTypeId MP4ERROR: MP4File::FindIntegerProperty: no such property - moov.trak[2].mdia.min f.stbl.stsd.*.esds.decConfigDescr.objectTypeId MP4ERROR: MP4File::FindIntegerProperty: no such property - moov.trak[3].mdia.min f.stbl.stsd.*.esds.decConfigDescr.objectTypeId E:\install_software>mp4creator -list java.mp4 // 虽然前面两次hint都报错了,但是还是发现文件多了两个track,大功告成 Track Type Info 1 video H264 [email protected], 421.166 secs, 397 kbps, 1024x768 @ 30.000047 fps 2 audio MPEG-4 AAC LC, 421.209 secs, 126 kbps, 44100 Hz 3 hint Payload H264 for track 1 4 hint Payload mpeg4-generic for track 2 E:\install_software>