Reference: http://blog.csdn.net/xiaoliouc/article/details/8363984
The first time I got something about Linux, there was no foundation for C and C ++. Refer to the online resources and record them as follows.
The required software and some resource files, uploaded to the web site (http://download.csdn.net/detail/zuowen8605/7571901), csdn and blog Park mixed come. (:>)
The Unbuntu-12.04.2-i386 is used
The Link contains the following content:
Openssl-1.0.1c.tar.gz
Pcre-8.32.tar.gz
Zlib-1.2.3.tar.gz
Nginx_mod_h264_streaming-2.2.7.tar.gz
Nginx-1.3.3.tar.gz
Yamdi-1.4.tar.gz (add key frame)
Player.swf (player)
The local path uses :~ /Nginx: Put the files downloaded above into this directory.
The basic environment and configuration methods are similar:
1. zlib-1.2.3
A. Unzip the package: [email protected]: ~ /Nginx $ tar zxvf zlib-1.2.3.tar.gz
B. Directory: [email protected]: ~ /Nginx $ CD zlib-1.2.3/
C. Configuration: [email protected]: ~ /Nginx/zlib-1.2.3 $ sudo./configure -- prefix =/usr/local/zlib
D. Install [email protected]: ~ /Nginx/zlib-1.2.3 $ sudo make & sudo make install
2. pcre-8.32
A. Unzip the package: [email protected]: ~ /Nginx $ tar zxvf pcre-8.32.tar.gz
B. Directory: [email protected]: ~ /Nginx $ CD pcre-8.32/
C. Configuration: [email protected]: ~ /Nginx/pcre-8.32 $ sudo./configure -- prefix =/usr/local/PCRE
D. Install [email protected]: ~ /Nginx/pcre-8.32 $ sudo make & make install
3. openssl-1.0.1c
A. Unzip the package: [email protected]: ~ /Nginx $ tar zxvf openssl-1.0.1c.tar.gz
B. Directory: [email protected]: ~ /Nginx $ CD openssl-1.0.1c/
C. Configuration: (this step is not required ~)
D. Install [email protected]: ~ /Nginx/openssl-1.0.1c $ sudo make & sudo make install
4. nginx_mod_h264_streaming-2.2.7
A. Unzip the package: [email protected] buntu :~ /Nginx $ tar zxvf nginx_mod_h264_streaming-2.2.7.tar.gz
B. Directory: [email protected]: ~ /Nginx $ CD nginx_mod_h264_streaming-2.2.7/
C. Modify ngx_http_streaming_module.c:
[Email protected]: ~ /Nginx/nginx_mod_h264_streaming-2.2.7/src $ gedit ngx_http_streaming_module.c
Find the following code and comment it out.
/* TODO: Win32 */ if (r->zero_in_uri) { return NGX_DECLINED; }
5. nginx-1.3.3
A. Add a user group: [email protected]: ~ /Nginx $ groupadd WWW
B. Add a user: [email protected]: ~ /Nginx $ useradd-G WWW
C. decompress: [email protected]: ~ /Nginx $ tar zxvf nginx-1.3.3
D. Directory: [email protected]: ~ /Nginx $ CD nginx-1.3.3/
E. Configuration:
[Email protected]: ~ /Nginx/nginx-1.3.3 $. /configure -- add-module = .. /nginx_mod_h264_streaming-2.2.7 -- With-PCRE = .. /pcre-8.32 -- With-zlib = .. /zlib-1.2.3 -- with-http_ssl_module -- With-OpenSSL = .. /openssl-1.0.1c -- user = WWW -- group = WWW -- prefix =/usr/local/nginx -- with-http_flv_module -- with-http_stub_status_module -- with-http_mp4_module -- With-CC-opt =-O3
F. Installation: [email protected]: ~ /Nginx/nginx-1.3.3 $ sudo make & sudo make install
Environment setup complete
Add and modify some configurations and put player.swf in the project.
1. Modify nginx. conf. Command: [email protected]: ~ // Nginx/nginx-1.3.3 $ sudo gedit/usr/local/nginx/CONF/nginx. conf
Under the server node, the listen corresponds to the port number, changed to 801, and added the following code to configure the video path and video format.
root /usr/local/nginx/html/video/;
location ~\.flv { flv; } location ~\.mp4$ { mp4; }
Save and exit.
Place the player.swf file in the/usr/local/nginx/html/path and add the video folder.
[Email protected]: ~ /Nginx $ sudo copy player.swf/usr/local/nginx/html/
[Email protected]: ~ /Nginx $ sudo mkdir/usr/local/nginx/html/video
Put a view.mp4 file under the videofolder and access http: // localhost: 801/player.swf? Type‑http&file=view.mp4,Successful.
The view.mp4 file can be viewed but cannot be dragged. You need to add a key frame for the video and use yamdi to complete this step.
A. Unzip the package: [email protected]: ~ /Nginx $ tar zxvf yamdi-1.4.tar.gz
B. Switch the Directory: [email protected]: ~ /Nginx $ CD yamdi-1.4/
C. Install [email protected]: ~ /Nginx/yamdi-1.4 $ sudo make & sudo make install
D. Use: [email protected]: ~ /Nginx/yamdi-1.4 $ yamdi-I view.mp4-O view_0.mp4
Put the view_0 file in the video directory, http: // localhost: 801/player.swf? Type=http&file=view_0.mp4,Successful.