Nginx build FLV MP4 Streaming media server [go]

Source: Internet
Author: User

Nginx build FLV MP4 Streaming Media Server
    • Two eggs
    • Time: December 1, 2014
    • Category: note

Environment: Centos 6.4 32bit

First, install the dependency package

1. Installing zlib

wget http://zlib.net/zlib-1.2.8.tar.gztar xzvf zlib-1.2.8.tar.gzcd zlib-1.2.8./configuremake && make install

2. Installing gcc-c++

yum -y install gcc-c++

3. Installing Pcre

WgetHttp://sourceforge.Net/projects/pcre/files/pcre/8.36/pcre-8.36.Tar.Gz/download-OPcre-8.36tar. Gztar zxvf pcre-8. 36. Tar. Gzcd pcre-8 36. /configure --prefix=/usr/local/pcremake && make install   

4. Installing the OpenSSL Openssl-devel

yum -y install openssl openssl-devel

5. Download MP4 Support Module backup

wget http://h264.code-shop.com/download/nginx_mod_h264_streaming-2.2.7.tar.gztar zxvf nginx_mod_h264_streaming-2.2.7.tar.gzvi nginx_mod_h264_streaming-2.2.7/src/ngx_http_streaming_module.c
Comment on the following lines
*/if (r->zero_in_uri){return NGX_DECLINED;}

Second, install Nginx server and configure

1. Installation

GroupaddWwwUseradd-GWwwWwwWgetHttp://nginx.Org/download/nginx-1.7.7.Tar.GzTarXzvfNginx-1.7.7.Tar.GzCdNginx-1.7.7./configure--Add-module=../nginx_mod_h264_streaming-2.2.7--With-Pcre=../pcre-8.36--With-zlib=../zlib-1.2.8--User=www--Group=www--Prefix=/usr/local/nginx--With-Http_flv_module--with- Http_stub_status_module --with -openssl-opt=enable Span class= "literal" >--with- http_mp4_module --with< Span class= "literal" >-cc-opt= ' -o3 ' make && span class= "comment" >make install          

2. Verify that the installed Nginx server supports video such as MP4, FLV, etc.

/usr/local/nginx/sbin/nginx -V

The output results are as follows:

NginxVersionNginx/1.7.7BuiltByGcc4.4.720120313(RedHat4.4.7-11)(GCC)ConfigureArguments--Add-Module=/root/nginx_mod_h264_streaming-2.2.7--With-Pcre=/root/pcre-8.36--With-Zlib=/root/zlib-1.2.8--User=www--Group=www--Prefix=/usr/local/nginx--with-http_flv_module Span class= "literal" >--with- http_stub_status_module -- with-openssl-opt=enable --with -http_mp4_module --< span class= "comment" >with-cc- opt=-o3        

3. Configuration
Edit/usr/local/nginx/conf/nginx.conf File
Only the parameters that need to be modified are shown below

User www; worker_connections65535; Gzip on; server {Listen80.2dan .cc.html index.htm Limit_rate_after Span class= "number" >10m200k.flv {flv.mp4 {mp4.2dan.cc ; Anti-theft chain authorization if ($invalid _referer) {return 403;}}      

Then restart the Nginx

/usr/local/nginx/nginx -s reload

Iv. Use and Testing

1. To add keyframes for video files, FLV uses yamdi mp4 to use Qt-faststart
2. Upload the output file to the/home/html directory and use the player call to test for normal playback, random drag, and side cache playback.

Nginx build FLV MP4 Streaming media server [go]

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.