首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 开源软件 >

用crtmpserver筹建开源rtmp直播服务

2013-12-10 
用crtmpserver搭建开源rtmp直播服务1、通过yum安装openssl-devel、cmake等编译crtmpserver必需工具2、通过svn

用crtmpserver搭建开源rtmp直播服务

1、通过yum安装openssl-devel、cmake等编译crtmpserver必需工具

2、通过svn下载crtmpserver的源码
svn?co?--username?anonymous?https://svn.rtmpd.com/crtmpserver/trunk?rtmp?

注:主线版本在Redhat?AS?5上面编译不通过,参考攻略
http://wiki.rtmpd.com/quickbuild
作出一些修改

cat?../../sources/common/include/platform/linux/linuxplatform.h?|grep?-v?"HAS_EPOLL_TIMERS"?>/tmp/linuxplatform.h.new
mv?/tmp/linuxplatform.h.new?../../sources/common/include/platform/linux/linuxplatform.h

?

3、编译
cd?rtmp/builders/cmake
cmake?.
make

4、运行
crtmpserver/crtmpserver?crtmpserver/crtmpserver.lua


5、可以用ffmpeg做输入测试
ffmpeg?-re?-i?"E:\片源\复仇者联盟720p.mov"?-vcodec?copy?-acodec?copy?-f?flv?rtmp://192.168.11.75/live/test1
ffmpeg?-re?-i?"E:\片源\复仇者联盟720p.mov"?-vcodec?copy?-acodec?copy?-f?flv?rtmpt://192.168.11.75:8080/live/test1

同样jw?player作为播放器

????<div?id="rtmp-player">
????????<p>Flash?not?installed</p>
????</div>

????<script?type="text/javascript"?src='jwplayer.js'></script>
????<script?type="text/javascript">
??jwplayer('rtmp-player').setup({
????'flashplayer':?'player.swf',
????'file':?'test1',
????'streamer':?'rtmp://192.168.11.75/live',
????'controlbar':?'bottom',
????'width':?'470',
????'height':?'290'
??});
????</script>

?

6、如果需要把crtmpserver安装到其他目录下,需要修改编译的过程
cmake?-DCMAKE_BUILD_TYPE=Release?-DCRTMPSERVER_INSTALL_PREFIX=<install-dir>
make
make?install

?

我把它安装到/usr/local/rtmp下,下面有4个子目录etc,lib,man,sbin

安装过程不完善,需要到源码的/builders/cmake/applications/appselector目录下把证书拷走
cp?server.key?server.crt?/usr/local/rtmp/lib/crtmpserver/applications/appselector/

?

修改配置文件
cd?/usr/local/rtmp/etc
cp?crtmpserver.lua.sample?crtmpserver.lua
vi?crtmpserver.lua
把applications中的rootDirectory改成绝对路径
rootDirectory="/usr/local/rtmp/lib/crtmpserver/applications"

?

启动
cd?/usr/local/rtmp/sbin
./crtmpserver?../etc/crtmpserver.lua


参考
http://blog.chinaunix.net/uid-26000296-id-3085921.html
http://kahimyang.info/kauswagan/howto_blogs/670-how_to_setup_flv_streaming_with_crtmpserver_c___rtmp_server
http://wiki.rtmpd.com/tutorial_live_stream_file
http://www.howtoforge.com/streaming-your-desktop-with-audio-and-webcam-overlay-in-a-browser-using-ffmpeg-crtmpserver-and-flowplayer

热点排行