My steps are as follows:
1. Installation Dependency Package: Yum Install glibc.i686
#yum –y Update
#yum-y install gcc glibc glibc-devel make nasm pkgconfig lib-devel openssl-devel expat-devel gettext-devel libtool mhash. x86_64 perl-digest-sha1.x86_64 gcc-c++
2, install the GIT tool://new installed software is placed in the new Softsource folder
#mkdir Softsource
#cd Softsource
#wget http://www.codemonkey.org.uk/projects/git-snapshots/git/git-latest.tar.gz
#tar XZVF git-latest.tar.gz
#cd git-2013-08-28
#autoconf
#./configure
#make && make Install
# git--version
git version 1.8.1.GIT
#cd:
3. Install ffmpeg and its dependent packages:
++++++++yasm+++++++++++
#wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
#tar XZVF yasm-1.2.0.tar.gz
#cd yasm-1.2.0
#./configure
#make
#make Install
#cd:
++++++++x264+++++++++++
#git Clone git://git.videolan.org/x264
#cd x264
#./configure--enable-shared
#make
#make Install
#cd:
++++++++lame+++++++++++
(#wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz)
#wget http://kakola.googlecode.com/files/lame-3.98.4.tar.gz
(Install lame-3.98.4.tar.gz to avoid error:libmp3lame >= 3.98.3 not found error in the third step, and need to install lame in advance.)
)
#tar XZVF lame-3.98.4.tar.gz
#cd lame-3.98.4
#./configure--enable-nasm
#make
#make Install
#cd:
++++++++libogg+++++++++++
#wget http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz
#tar XZVF libogg-1.3.0.tar.gz
#cd libogg-1.3.0
#./configure
#make
#make Install
#cd:
++++++++libvorbis+++++++++++
#wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz
#tar XZVF libvorbis-1.3.3.tar.gz
#cd libvorbis-1.3.3
#./configure
#make
#make Install
#cd:
++++++++libvpx+++++++++++
#wget http://webm.googlecode.com/files/libvpx-v1.1.0.tar.bz2
#tar-VXJF libvpx-v1.1.0.tar.bz2
#cd libvpx-v1.1.0
#./configure--enable-shared
#make
#make Install
#cd:
++++++++faad2+++++++++++
#wget http://downloads.sourceforge.net/project/faac/faad2-src/faad2-2.7/faad2-2.7.tar.gz
#tar ZXVF faad2-2.7.tar.gz
#cd faad2-2.7
#./configure
#make
#make Install
#cd:
++++++++faac+++++++++++
#wget http://sourceforge.net/projects/faac/files/faac-src/faac-1.28/faac-1.28.tar.gz/download (HTTP// 172.16.1.100/faac-1.28.tar.gz)
#tar ZXVF faac-1.28.tar.gz
#cd faac-1.28
#cd common/mp4v2/
#vi Mpeg4ip.h
126g-position to 126 rows and delete this line, leaving
Go back to the faac-1.28 directory: CD.
Cd..
#./configure
#make
#make Install
#cd:
++++++++xvid+++++++++++
#wget http://downloads.xvid.org/downloads/xvidcore-1.3.2.tar.gz
#tar ZXVF xvidcore-1.3.2.tar.gz
#cd Xvidcore/build/generic
#./configure
#make
#make Install
#cd:
++++++++ffmpeg+++++++++++
#git Clone Git://source.ffmpeg.org/ffmpeg
#cd FFmpeg
#./configure--prefix=/opt/ffmpeg/--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
#cd:
++++++++ zlib+++++++++++
Wget http://www.zlib.net/zlib-1.2.8.tar.gz
#tar XZVF zlib-1.2.8.tar.gz
#cd zlib-1.2.8
#./configure–prefix-/usr/local/zlib
#make && make Install
Modify the/etc/ld.so.conf as follows:
Include ld.so.conf.d/*.conf
/lib
/lib64
/usr/lib
/usr/lib64
/usr/local/lib
/usr/local/lib64
/opt/ffmpeg/lib
#ldconfig
Second, the installation of Nginx related modules
#wget http://h264.code-shop.com/download/nginx_mod_h264_streaming-2.2.7.tar.gz
#tar ZXVF nginx_mod_h264_streaming-2.2.7.tar.gz
#git Clone Git://github.com/arut/nginx-rtmp-module.git
#wget http://sourceforge.net/projects/pcre/files/pcre/8.12/pcre-8.12.tar.gz
#tar ZXVF pcre-8.12.tar.gz
#cd pcre-8.12
#./configure–prefix=/usr/local/pcre
#make && make Install
#cd:
Download nginx-1.5.3 installation package
#wget http://nginx.org wget http://nginx.org/download/nginx-1.5.3.tar.gz
#tar ZXVF nginx-1.5.3.tar.gz
#cd nginx-1.5.3
#groupadd www
#useradd-G www www
#cd:
#cd NGINX_MOD_H264_STREAMING-2.2.7/SRC
#vi ngx_http_streaming_module.c
Delete if (R->zero_in_uri) {}
#cd:
#cd nginx-1.5.3
#./configure--prefix=/usr/local/nginx--add-module=. /nginx_mod_h264_streaming-2.2.7--with-http_ssl_module--with-pcre=/root/softsource/pcre-8.12--with-zlib=/root/ softsource/zlib-1.2.8--user=www--group=www--with-http_flv_module--with-http_stub_status_module--add-module=. /nginx-rtmp-module
#make
#make Install
#cd:
Third, installation Yamdi
The role of YADMI is to add keyframes to the FLV file to enable drag playback
Download YADMI
#wget Http://sourceforge.net/projects/yamdi/files/yamdi/1.4/yamdi-1.4.tar.gz/download
Installing YADMI
#tar XZVF yamdi-1.4.tar.gz
#cd yamdi-1.4
#make && make Install
#cd:
How to use: Yamdi-i input.flv-o out.flv
Add keyframes to the input.flv file, output as out.flv file
Four, modify the Nginx master configuration file, configure the virtual host (note the space)
#cd/usr/local/nginx/conf
#vi nginx.conf modified to the following (as per its own circumstances):
User www www;
Worker_processes 30;
Error_log/usr/local/nginx/logs/error.log Crit;
Pid/usr/local/nginx/logs/nginx.pid;
Events {
Use Epoll;
Worker_connections 65535;
}
HTTP {
Include Mime.types;
Default_type Application/octet-stream;
Log_format Main ' $remote _addr– $remote _user [$time _local] '
"$request" $status $bytes _sent '
' "$http _referer" "$http _user_agent" '
' $gzip _ratio ';
Keepalive_timeout 60;
Server_names_hash_bucket_size 128;
Client_header_buffer_size 32k;
Large_client_header_buffers 4 32k;
Access_log off;
gzip on;
Gzip_min_length 1100;
Gzip_buffers 4 8k;
Gzip_types Text/plain;
Output_buffers 1 32k;
Postpone_output 1460;
Client_header_timeout 3m;
Client_body_timeout 3m;
Send_timeout 3m;
Sendfile on;
Tcp_nopush on;
Tcp_nodelay on;
######################################################################
server {
Listen 8081;
server_name 172.16.10.200;## #设置主机ip
root/usr/local/nginx/html/flv_file/;
Limit_rate_after 5m; # # #在flv视频文件下载了5M以后开始限速
Limit_rate 512k; # # #速度限制为512K
Index index.html;
CharSet Utf-8;
Location ~ \.flv {
flv
}
Location ~ \.mp4 {
MP4:
}
Location ~ {
root HTML;
Index index.html index.htm index.php;
}
Error_page 502 503 504/50x.html;
Location =/50x.html {
root HTML;
}
}
}
Save exit;
#cd:
Five, basically has been set up, but at this time we also need a test to support the drag-and-drop flash Player, open-source JW player can achieve such a function
Download Link: Http://blogimg.chinaunix.net/blog/upfile2/100607142612.rar
After downloading the player, upload it to the/usr/local/nginx/html/directory set above and put the FLV video file in the directory!
The player is placed in the same sibling as the index.html.
This time you need to install RAR:
#wget http://www.rarlab.com/rar/rarlinux-3.8.0.tar.gz
#tar ZXVF rarlinux-3.8.0.tar.gz-c/usr/local
#yum Install glibc.i686
#yum Install libstdc++.so.6
At this point, the/usr/local/rar will have the RAR command and the Unrar command.
Go to the HTML folder under Nginx download video playback tool player.swf
#cd
#cd/usr/local/nginx/html
#wget Http://blogimg.chinaunix.net/blog/upfile2/100607142612.rar
#unrar –e 100607142612.rar
#ls –l
Can see the extracted files;
Vi. Setting the port number according to the configuration in the Nginx configuration file
#vi/etc/sysconfig/iptables
Open 8081 Ports
#/sbin/service iptables Restart
Reboot firewall, set to take effect
Modify the firewall configuration file, in the directory/etc/sysconfig/iptables, add the port number to be opened, as follows:
1
2-a input-m State--state new-m tcp-p TCP--dport 80-j ACCEPT
-A input-m state--state new-m tcp-p TCP--dport 8088-j ACCEPT
#增加的代码必须放在以下代码之上, otherwise it won't work.
1
2-a input-j REJECT--reject-with icmp-host-prohibited
-A forward-j REJECT--reject-with icmp-host-prohibited
Seven, after the start of Nginx test:
Start command:
#/usr/local/nginx/sbin/nginx-c/usr/local/nginx/conf/nginx.conf
To start the Nginx Help document:
#/usr/local/nginx/sbin/nginx-h
#/usr/local/nginx/sbin/nginx–s Reload
To see if the Nginx configuration is correct:
#/usr/local/nginx/sbin/nginx–t
If the configuration is correct, the following is displayed:
nginx.conf syntax is OK.
Nginx.conf test is successful.
Http://127.0.0.1/player.swf?type=http&file=mp42.mp4
Description: #这里的127.0.0.1 is your own IP
#player. SWF is my JW player player
#http是表示居于http分发方式
#mp42. mp4 is my FLV video file
Building mp4/flv Streaming Media server based on Nginx under CentOS6.4