hotshotgg

导航

ffmpeg nginx

yum-config-manager --add-repo http://www.nasm.us/nasm.repo

 

yum install autoconf automake bzip2 cmake freetype-devel gcc gcc-c++ git libtool make mercurial nasm pkgconfig zlib-devel

 

mkdir ~/ffmpeg_sources

 

NASM:

http://www.nasm.us/pub/nasm/releasebuilds/2.13.01/nasm-2.13.01.tar.xz

  1. #tar -vxf nasm-2.13.01.tar.xz  

  2. #cd cd nasm-2.13.01  

  3. #./configure  

  4. #make && make install  

YASM:

cd ~/ffmpeg_sources

wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz tar xzvf yasm-1.3.0.tar.gz cd yasm-1.3.0 ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" make make install

LIBX264:

cd ~/ffmpeg_sources git clone --depth 1 http://git.videolan.org/git/x264 cd x264 PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static make make install

mercurial:

下载rpm包
https://www.mercurial-scm.org/release/centos6/RPMS/x86_64/

   安装后,修改

   export PYTHONPATH=/usr/lib64/python2.6/site-packages

 

LIBX265:

cd ~/ffmpeg_sources hg clone https://bitbucket.org/multicoreware/x265 cd ~/ffmpeg_sources/x265/build/linux cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED:bool=off ../../source make make install

libfdk_aac:

cd ~/ffmpeg_sources git clone --depth 1 https://github.com/mstorsjo/fdk-aac cd fdk-aac autoreconf -fiv ./configure --prefix="$HOME/ffmpeg_build" --disable-shared make make install

libmp3lame

cd ~/ffmpeg_sources 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 --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --disable-shared --enable-nasm make make install

libopus:

cd ~/ffmpeg_sources wget https://archive.mozilla.org/pub/opus/opus-1.1.5.tar.gz tar xzvf opus-1.1.5.tar.gz cd opus-1.1.5 ./configure --prefix="$HOME/ffmpeg_build" --disable-shared make make install

libogg:

cd ~/ffmpeg_sources wget http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.gz tar xzvf libogg-1.3.2.tar.gz cd libogg-1.3.2 ./configure --prefix="$HOME/ffmpeg_build" --disable-shared make make install

libvorbis:

cd ~/ffmpeg_sources wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.4.tar.gz tar xzvf libvorbis-1.3.4.tar.gz cd libvorbis-1.3.4 ./configure --prefix="$HOME/ffmpeg_build" --with-ogg="$HOME/ffmpeg_build" --disable-shared make make install

libvpx:

cd ~/ffmpeg_sources git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git cd libvpx ./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm PATH="$HOME/bin:$PATH" make make install

FFmpeg:

cd ~/ffmpeg_sources curl -O http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 tar xjvf ffmpeg-snapshot.tar.bz2 cd ffmpeg PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" \ --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib -ldl" \ --bindir="$HOME/bin" --pkg-config-flags="--static" \ --enable-gpl \ --enable-libfdk_aac \ --enable-libfreetype \ --enable-libmp3lame \ --enable-libopus \ --enable-libvorbis \ --enable-libvpx \ --enable-libx264 \ --enable-libx265 \ --enable-nonfree make make install hash -r

NGINX:
下载源码,编译安装,参见LNMP中NGINX安装,
配置加上

--add-module=/home/user/nginx-rtmp-module 

 

全部配置:

./configure --prefix=/usr/local/nginx  --user=www --group=www --add-module=/home/user/nginx-rtmp-module  --with-http_ssl_module --with-openssl=/usr/local/src/openssl-1.0.1j --with-zlib=/usr/local/src/zlib-1.2.11 --with-pcre=/usr/local/src/pcre-8.40

 

make && make install

 隐藏Nginx版本号、开机启动

 

配置nginx.conf加上

 


#user nobody;
worker_processes 1;

#error_log logs/error.log;

#pid logs/nginx.pid;

events {
worker_connections 1024;
}

rtmp {
server {
listen 1935;

application myapp {
live on;
}
application hls {
live on;
hls on;
hls_path /tmp/hls;
hls_fragment 1s;
hls_playlist_length 1m;
}
}
}

http {
include mime.types;
default_type application/octet-stream;

sendfile on;

keepalive_timeout 65;

server {
listen 80;
server_name localhost;

location / {
root html;
index index.html index.htm;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

location /hls{
types {
application/vnd.apple.mpegurl m3u8;
}
root /tmp;
add_header Cache-Control no-cache;
add_header Access-Control-Allow-Origin *;
}
}

server {
listen 8080;

location /stat {
rtmp_stat all;
rtmp_stat_stylesheet stat.xsl;
}

location /stat.xsl {
root /usr/local/nginx/html/nginx-rtmp-module/;
}

location /control {
rtmp_control all;
}

 

location /rtmp-publisher {
root /usr/local/nginx/html/nginx-rtmp-module;
}

location / {
root /usr/local/nginx/html/nginx-rtmp-module/www;
}
}

}

 

 

posted on 2017-08-16 16:31  hotshotgg  阅读(245)  评论(0编辑  收藏  举报