Nginx builds one of the streaming media servers supporting http and rtmp protocols

Source: Internet
Author: User
Tags flv file

Nginx builds one of the streaming media servers supporting http and rtmp protocols
Purpose:
Enable Nginx to support flv and mp4 files and RTMP live and on-demand video;
Enable the rtmp hls Function

MATERIALS:
HTTP Live Streaming (HLS) is an HTTP-based Streaming media network transmission protocol proposed by Apple.
HLS only requests basic HTTP packets. Unlike the real-time transmission protocol (RTP), HLS can pass through any firewall or proxy server that allows HTTP data to pass through.
It also easily uses the content delivery network to transmit media streams.
Use ffmpeg to Convert flv, mp4, mp3, and other formats (the VOD experiment is not tested for the time being)

I. Preparations
Nginx: http://nginx.org
Module: nginx_mod_h1__streaming (videos with h264 encoding supported)
Module: http_flv_module supports flv
Module: http_mp4_module supports mp4
:
Http://h264.code-shop.com/download/nginx_mod_h264_streaming-2.2.7.tar.gz
Https://github.com/arut/nginx-rtmp-module

1. Install the dependency package:
# Yum-y install gcc glibc-devel make nasm pkgconfig lib-devel openssl-devel expat-devel gettext-devel libtool mhash. x86_64 perl-Digest-SHA1.x86_64

2. Install related Toolkit
1). git
# Mkdir soft-source
# Cd soft-source
# Wget http://codemonkey.org.uk/projects/git-snapshots/git/git-latest.tar.xz
# Xz-d git-latest.tar.xz
# Tar xzvf git-latest.tar
# Cd git-2014-06-27
# Autoconf
#./Configure
# Make & make install
# Git -- version
Git version 2.0.0.GIT
# Cd ..

2). zlib
# Wget http://zlib.net/zlib-1.2.8.tar.gz
# Tar-zxvf zlib-1.2.8.tar.gz cd zlib-1.2.8
#./Configure
# Make
# Make install
# Cd ..

3). pcre
# Wget http://exim.mirror.fr/pcre/pcre-8.12.tar.gz
# Tar zxvf pcre-8.12.tar.gz
# Cd pcre-8.12
#./Configure
# Make & make install
# Cd ..

4). yadmi
Yadmi is used to add a key frame to the flv file for drag playback.
# Wget http://sourceforge.net/projects/yamdi/files/yamdi/1.4/yamdi-1.4.tar.gz/download
# Tar xzvf yamdi-1.4.tar.gz
# Cd yamdi-1.4
# Make & make install
# Cd ..

Usage:
# Yamdi-I input. flv-o out. flv
Add a key frame to the input. flv file and output it to the out. flv file.

5). OpenSSL
# Wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz
# Tar-zxvf openssl-1.0.1c.tar.gz
#./Config
# Make
# Make install

3. Install ffmpeg and its dependent packages:
1). 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 ..

2). x264
# Git clone git: // git.videolan.org/x264
# Cd x264
#./Configure -- enable-shared
# Make
# Make install
# Cd ..

3). LAME
# Wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
# Tar xzvf lame-3.99.5.tar.gz
# Cd lame-3.99.5
#./Configure -- enable-nasm
# Make
# Make install
# Cd ..

4). 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 ..

5). 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 ..

6). libvpx
# Git clone http://git.chromium.org/webm/libvpx.git
# Cd libvpx
#./Configure -- enable-shared
# Make
# Make install
# Cd ..

7). 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 ..

8). FAAC
# Wget http://downloads.sourceforge.net/project/faac/faac-src/faac-1.28/faac-1.28.tar.gz
# Tar zxvf faac-1.28.tar.gz
# Cd faac-1.28
#./Configure
# Make
# Make install
# Cd ..

9). 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 ..

10). 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 ..

Modify/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

Ii. Install Nginx modules
1. Module Installation
# 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

2. Create users and groups
# Groupadd www
# Useradd-g www

3. Install nginx
# Wget http://nginx.org/download/nginx-1.6.0.tar.gz
# Tar zxvf nginx-1.6.0.tar.gz
# Cd nginx-1.6.0

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.