centos7上通过nginx+ffmpeg搭建rtsp直播流转rtmp视频服务器

一、准备工作

1、安装git

yum -y install git

 

2、安装openssl

yum -y install openssl openssl-devel

 

3、安装gcc

yum -y install gcc gcc-c++ autoconf automake make

 

二、安装nginx

1、创建临时目录并进入

mkdir /temp

cd /temp

 

2、下载nginx-rtmp-module

git clone https://github.com/arut/nginx-rtmp-module.git

 

3、下载nginx

wget http://nginx.org/download/nginx-1.10.3.tar.gz

tar -zxvf nginx-1.10.3.tar.gz

cd nginx-1.10.3

 

4、添加rtmp和openssl支持

./configure --add-module=/temp/nginx-rtmp-module --with-http_ssl_module

make && make install

 

5、配置rtmp

vi /usr/local/nginx/conf/nginx.conf

添加:

rtmp {
    server {
        listen 1935;
        chunk_size 4096;
        application live {
            live on;
            record off;
        }
    }
}

 

6、启动nginx

/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

 

三、安装ffmpeg

1、安装epel-release

yum install -y epel-release

 

2、安装Nux-Dextop源

rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro

rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm

 

3、安装ffmpeg

yum install -y ffmpeg

ffmpeg -version

 

四、推流

ffmpeg -re -rtsp_transport tcp -i "rtsp://184.72.239.149/vod/mp4://BigBuckBunny_175k.mov" -f flv -r 25 -s 1920x1080 -an rtmp://localhost:1935/live/room

你可能感兴趣的:(nginx,ffmpeg,rtsp,rtmp)