It took me nearly 3 weeks, after a lot of problems, today finally put the streaming media server, hurriedly write a blog post to avoid forgetting ...
It started with some tutorials on the web, but it was not comprehensive, and something was out of date (like the old version of Jwplayer). I am using the latest version of jwplayer6.8, in the configuration has a lot of different places, also very pit, it is worth noting! In terms of configuration, I streamlined a lot, without so many cumbersome configuration items need to be modified.
Note: I am the virtual machine centos6.2 system built under the streaming media server, on the Win7 host to do the test.
Also, at the end of the article, you can download all the packages and other files that are used in the build process.
Don't talk nonsense, starting with the preparation of the server:
One, the preparation work, installs the dependency package, is indispensable! ( It is recommended to use the command to see if you have installed the software, confirm no re-installation )
--------------------------------------------------------------------------------------------------------------- ----------------------------------------
1. Installing zlib
Tar xzvf zlib-1.2.3.tar.gz #解压 cd zlib-1.2.3 #进入解压目录 ./configure #配置 make && make install #编译并安装
2. Installing gcc-c++
Yum-y install gcc-c++ #会自动安装的, but requires networking
4. Installing Pcre
Tar zxvf pcre-7.9.tar.gz cd pcre-7.9./configure--prefix=/usr/local/pcre #配置安装路径为/usr/local/pcre make && ma Ke Install
5. Installing the OpenSSL Openssl-devel
Yum-y Install OpenSSL Openssl-devel
Second, install the Yamdi, for the FLV to add keyframes. (Always think of "linen dish", haha ... )
--------------------------------------------------------------------------------------------------------------- ----------------------------------------
#先cd到某个目录下, download the package wget http://sourceforge.net/projects/yamdi/files/yamdi/1.4/yamdi-1.4.tar.gz/download with the wget command # Install YADMI tar xzvf yamdi-1.4.tar.gz cd yamdi-1.4 make && make install
Install Nginx server, and configure
--------------------------------------------------------------------------------------------------------------- ----------------------------------------
1. Installation
Groupadd www #添加用户组www useradd-g www www #向组添加用户www tar xzvf nginx-0.8.34.tar.gz #解压包 CD nginx-0.8.34 #此步骤重要,--with-http_flv_module and--with-http_ssl_module cannot be changed, other custom bar. ./configure--with-http_ssl_module--with-pcre=/opt/nginx/pcre-7.9--with-zlib=/opt/nginx/zlib-1.2.3--user= www--group=www--prefix=/opt/nginx--with-http_flv_module make && make install
2. Configuration
vim/opt/nginx/conf/nginx.conf #编辑nginx配置文件 # Find the server node, refer to the code to change a little bit, so easy!server { listen; server_name 192.168.1.105; root/opt/nginx/html/; Limit_rate_after 5m; #在flv视频文件下载了5M以后开始限速 limit_rate 100k; #速度限制为100K index index.html; CharSet Utf-8; #将. flv file points to FLV module Location ~ \.flv { flv ; } Error_page 502 503 504/50x.html; Location =/50x.html { root html; }}
Iv. Use and Testing
--------------------------------------------------------------------------------------------------------------- ----------------------------------------
1. Add keyframes for the prepared FLV file
#参数-i:input file -o:out file yamdi-i test1.flv-o test2.flv #目录下会生成test2. flv, at which point the file has already generated a keyframe
2. Copy test2.flv to the server directory, my server directory is "/opt/nginx/html/".
3. Copy the jwplayer.flash.swf to the server directory.
4. Edit the Web page, teststreaming project, (I was to deploy the Web page to the Win7 host Apache server, used to simulate remote access to the streaming media server, want to get in this machine, own Daoteng)
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" >192.168.164.132 is the IP of my virtual machine, loading player file Flashplayer: "http://192.168.164.132/player6.swf",
Under Load server,/video/test2.flv the flv file with keyframes: "http://192.168.164.132/video/test2.flv", Image: "Test.jpg ", width:800, height:500, Screencolor:" #BBBBBB ", Autostart:true, Provider: "http", Streamer: "Start", Stretching: "Fill",
The above three parameters are not important, the following two parameters is the most important! New version of the wonderful place! Startparam: "Start", Primary: "Flash"}); </script></body>5. Test, open the browser under Win7, enter: localhost/teststreaming/index.html
yeah! The video is successfully played, and you can drag seek! freely
If this is not successful, please check the jwplayer configuration parameters carefully!
Attached DOWNLOAD Link: http://download.csdn.net/detail/cyh970473/7443127
[Ultimate Lite] [graphical]nginx build FLV MP4 Streaming Media server