Nginx下rtmp模块安装:
在lnmp环境下安装:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
cd lnmp /src
yum -y install git
wget http: //www .tortall.net /projects/yasm/releases/yasm-1 .2.0. tar .gztar xzf yasm-1.2.0. tar .gz
cd yasm-1.2.0. /configure
make && make install
cd ..git clone git: //git .videolan.org /x264 .gitcd x264. /configure -- enable -shared
make && make install
cd ..wget http: //downloads .sourceforge.net /project/lame/lame/3 .99 /lame-3 .99.5. tar .gztar xzf lame-3.99.5. tar .gz
cd lame-3.99.5. /configure -- enable -nasm
make && make install
cd ..wget http: //downloads .xiph.org /releases/ogg/libogg-1 .3.1. tar .gztar xzf libogg-1.3.1. tar .gz
cd libogg-1.3.1. /configure
make && make install
cd ..wget http: //downloads .xiph.org /releases/vorbis/libvorbis-1 .3.3. tar .gztar xzf libvorbis-1.3.3. tar .gz
cd libvorbis-1.3.3ldconfig. /configure
make && make install
cd ..git clone http: //git .chromium.org /webm/libvpx .gitcd libvpx. /configure -- enable -shared
make && make install
cd ..wget http: //downloads .sourceforge.net /faac/faad2-2 .7. tar .gztar xzf faad2-2.7. tar .gz
cd faad2-2.7. /configure
make && make install
cd ..wget http: //downloads .sourceforge.net /faac/faac-1 .28. tar .gztar xzf faac-1.28. tar .gz
cd faac-1.28sed -i 's@^char \*strcasestr@//char *strcasestr@' . /common/mp4v2/mpeg4ip .h. /configure
make && make install
cd ..wget http: //downloads .xvid.org /downloads/xvidcore-1 .3.2. tar .gztar xzf xvidcore-1.3.2. tar .gz
cd xvidcore /build/generic . /configure
make && make install
cd ../../.. /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 -pthreads
make && make install
ldconfig ffmpeg cd ..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 .gz
sed -i '158,161s@^@//@g' nginx_mod_h264_streaming-2.2.7 /src/ngx_http_streaming_module .c
cd nginx-1.4.4
make 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-module
make if [ -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 restart
fi |
配置nginx视频直播:
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文件目录 } } }
本文转自 linuxpp 51CTO博客,原文链接:http://blog.51cto.com/1439337369/1794431,如需转载请自行联系原作者