由于项目的原因,需要搭建这么个玩意。
Darwin StreamingServer简称DSS,DSS是Apple公司提供的开源实时流媒体播放服务器程序。使用这个程序可以方便的在机子上搭建出一个多媒体的服务器。
以下是安装最新的DarwinStreaming Server6.03版本的步骤
1.下载如下安装包以及patch
http://static.macosforge.org/dss/downloads/DarwinStreamingSrvr6.0.3-Source.tar
http://dss.macosforge.org/trac/raw-attachment/ticket/6/dss-6.0.3.patch
http://dss.macosforge.org/trac/raw-attachment/ticket/6/dss-hh-20080728-1.patch
2.解压程序及相关打patch步骤
- su(以root权限操作,之前在普通用户下的sudo操作没有成功)
-
- tar -xvf DarwinStreamingSrvr6.0.3-Source.tar
-
- addgroup -system qtss
- adduser -system -no-create-home -ingroup qtss qtss
-
- apt-get install build-essential
-
- patch -p0 < dss-6.0.3.patch
- patch -p0 < dss-hh-20080728-1.patch
-
- cd DarwinStreamingSrvr6.0.3-Source
- mv Install Install.old
-
- 下载如下文件
- http://dss.macosforge.org/trac/raw-attachment/ticket/6/Install
- 放到 DarwinStreamingSrvr6.0.3-Source目录中
-
- chmod +x Install
- ./Buildit
- ./Install
安装完了以后,流媒体服务是自动启用的。
这样就可以输入http://127.0.0.1:1220进入web管理界面了,按照提示设置一些密码就可以了。服务器里面预置一些测试的用例。
下面就可以写VideoView来在模拟器上测试程序了
如果要用自己的多媒体文件来测试程序,传到流媒体服务器上后,用模拟器测试是无法播放的,程序会报
CommandPLAYER_INIT completed with an error or infoPVMFFailure
的错误。
(
以下参考
:http://www.360doc.com/content/11/0105/14/1290342_84159022.shtml#)
流媒体是需要先hint的。所谓hint只是在原有的视音频轨道上增加一些流化信息。因此它和是否能够快进快退没有关系,只和文件能否流化有关系。换句话说,没有hint过的mp4文件也是可以快进快退的。
hint的具体解释可以参考下面这段英文:
摘自:http://www.gnu-darwin.org/www001/src/ports/multimedia/mpeg4ip-libmp4v2/work/mpeg4ip-1.6.1/doc/about_hint_tracks.txt
- Hint tracks are a series of instructions in a mp4 container file that
- tell a server how to transmit packets. Hint tracks always refer
- to another track, most likely an audio or video media track.
-
- This series of instructions tells the server when to send the packet,
- what type of RTP header to add, if there is any extra data in the
- packet, and how much data to send in the packet. To save on space,
- a hint can contain a pointer to the media track, instead of duplicating
- that data.
-
- It will also tell what SDP to add for the track that is referenced.
-
- So, a file that is hinted should have a media track, and an associated
- hint track for that media track. There are some mp4 container files
- that just have hint tracks - these are called "fat hints " and are
- usually not playable locally. These are illegal in ISMA, so we won 't
- talk about them.
-
- To create hint tracks for a mp4 file is fairly simple with the mp4creator
- program. Just execute the:
- mp4creator -hint= <track to hint track number> <mp4file>
例如:
没有流化过的mp4文件,用mp4info查看文件信息(如果mp4info没有安装,就用apt-getinstall mp4info安装一下 )。
- mp4info ./test.mp4
- mp4info version 1.6
- ./test.mp4:
- Track Type Info
- 1 audio MPEG-4 AAC LC, 662.165 secs, 121 kbps, 48000 Hz
- 2 video H264 [email protected], 662.562 secs, 1756 kbps, 640x368 @ 29.970025 fps
hint音频:
- mp4creator -hint=1 ./test.mp4 (如果mp4creator没有安装,就用apt-get install mp4creator安装一下 )
hint视频:
- mp4creator -hint=2 ./test.mp4
查看流化后的信息:
- mp4info ./test.mp4
- mp4info version 1.6
- ./test.mp4:
- Track Type Info
- 1 audio MPEG-4 AAC LC, 662.165 secs, 121 kbps, 48000 Hz
- 2 video H264 [email protected], 662.562 secs, 1756 kbps, 640x368 @ 29.970025 fps
- 3 hint Payload mpeg4-generic for track 1
- 4 hint Payload H264 for track 2
- Tool: mp4creator 1.5.0.1
这样模拟器上就可以播放自己上传到服务器上的mp4了