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作为播放器
Flash not installed
jwplayer('rtmp-player').setup({
'flashplayer': 'player.swf',
'file': 'test1',
'streamer': 'rtmp://192.168.11.75/live',
'controlbar': 'bottom',
'width': '470',
'height': '290'
});
6、如果需要把crtmpserver安装到其他目录下,需要修改编译的过程
cmake -DCMAKE_BUILD_TYPE=Release -DCRTMPSERVER_INSTALL_PREFIX=
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