標籤:伺服器 流媒體
Nginx下rtmp模組安裝:
在lnmp環境下安裝:
cd lnmp/srcyum -y install gitwget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gztar xzf yasm-1.2.0.tar.gzcd yasm-1.2.0./configuremake && make installcd ..git clone git://git.videolan.org/x264.gitcd x264./configure --enable-sharedmake && make installcd ..wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gztar xzf lame-3.99.5.tar.gzcd lame-3.99.5./configure --enable-nasmmake && make installcd ..wget http://downloads.xiph.org/releases/ogg/libogg-1.3.1.tar.gztar xzf libogg-1.3.1.tar.gzcd libogg-1.3.1./configuremake && make installcd ..wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gztar xzf libvorbis-1.3.3.tar.gzcd libvorbis-1.3.3ldconfig./configuremake && make installcd ..git clone http://git.chromium.org/webm/libvpx.gitcd libvpx./configure --enable-sharedmake && make installcd ..wget http://downloads.sourceforge.net/faac/faad2-2.7.tar.gztar xzf faad2-2.7.tar.gzcd faad2-2.7./configuremake && make installcd ..wget http://downloads.sourceforge.net/faac/faac-1.28.tar.gztar xzf faac-1.28.tar.gzcd faac-1.28sed -i ‘[email protected]^char \*[email protected]//char *[email protected]‘ ./common/mp4v2/mpeg4ip.h./configuremake && make installcd ..wget http://downloads.xvid.org/downloads/xvidcore-1.3.2.tar.gztar xzf xvidcore-1.3.2.tar.gzcd xvidcore/build/generic./configuremake && make installcd ../../../git clone git://source.ffmpeg.org/ffmpeg.gitcd ffmpeg./configure --prefix=/usr --enable-version3 --enable-libvpx --enable-libfaac --enable-libmp3lame --enable-libvorbis --enable-libx264 --enable-libxvid --enable-shared --enable-gpl --enable-postproc --enable-nonfree --enable-avfilter --enable-pthreadsmake && make installldconfigffmpegcd ..wget http://h264.code-shop.com/download/nginx_mod_h264_streaming-2.2.7.tar.gzgit clone git://github.com/arut/nginx-rtmp-module.gittar xzf nginx_mod_h264_streaming-2.2.7.tar.gzsed -i ‘158,[email protected]^@//@g‘ nginx_mod_h264_streaming-2.2.7/src/ngx_http_streaming_module.ccd nginx-1.4.4make clean./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --with-ld-opt=-ljemalloc --with-http_mp4_module --add-module=../nginx_mod_h264_streaming-2.2.7 --add-module=../nginx-rtmp-modulemakeif [ -e "objs/nginx" ];then /bin/mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx$(date +%m%d) /bin/cp objs/nginx /usr/local/nginx/sbin/nginx service nginx restartfi
配置nginxApsaraVideo for Live:
RTMP直播的一般格式是rtmp://www.linuxeye.com/app/name,其中app的名字對於application的名字
rtmp { #儲存所有rtmp配置的塊 server { #聲明一個rtmp執行個體 listen 1935; #給Nginx添加一個監聽連接埠以接收rtmp串連 chunk_size 4096; #流整合的最大的塊大小。預設值為4096。這個值設定的越大CPU負載就越小。這個值不能低於128 application mp4 { #app的名字為mp4 live on; #切換直播模式,即一對多廣播 play /home/wwwroot/www.linuxeye.com/mp4; #播放指定mp4檔案目錄 } } }
本文出自 “zpp” 部落格,請務必保留此出處http://1439337369.blog.51cto.com/10270624/1794431
Nginx rtmp流媒體伺服器搭建