Giter Site home page Giter Site logo

mts's Introduction

nginx+ffmpeg rstp转rtmp

  • 安装ffmpeg
*****************************

先安装nasm
wget http://www.nasm.us/pub/nasm/releasebuilds/2.13.03/nasm-2.13.03.tar.xz
tar -xvf nasm-2.13.03.tar.xz
cd nasm-2.13.03
./configure  --prefix=/usr 
make
sudo make install

*****************************

缺少libx264库,需要安装该库:
wget https://code.videolan.org/videolan/x264/-/archive/master/x264-master.zip
unzip x264-master.zip
cd x264-master
./configure --enable-static --enable-share --disable-opencl
make
sudo make install

*****************************

wget https://github.com/FFmpeg/FFmpeg/archive/n4.2.zip
sudo apt-get install yasm
unzip n4.2.zip
cd FFmpeg-n4.2
./configure --enable-gpl --enable-libx264
make
make install
  • 安装nginx
sudo apt-get install build-essential libpcre3 libpcre3-dev openssl libssl-dev zlib1g-dev
wget http://nginx.org/download/nginx-1.12.0.tar.gz
wget https://github.com/arut/nginx-rtmp-module/archive/master.zip
unzip master.zip     
tar -zxvf nginx-1.12.0.tar.gz
cd nginx-1.12.0
./configure --prefix=/opt/nginx --with-http_ssl_module --add-module=../nginx-rtmp-module-master
make
sudo make install
  • nginx配置 nginx.conf
worker_processes 1;
events {
    worker_connections 1024;
}
rtmp {
    server {
        listen 1935;
        chunk_size 4000;
		application mylive {
            live on;
        }
    }
}
http {
    include mime.types;
    default_type application/octet-stream;
    sendfile on;
    keepalive_timeout 65;

    server {
        listen 20000;
        server_name localhost;
        location / {
            root html;
            index index.html index.htm;
        }
        error_page 500 502 503 504 /50x.html;
			location = /50x.html {
			root html;
		}
    }
}
  • 运行ffmpeg命令 ffmpeg -re -rtsp_transport tcp -i "rtsp://admin:[email protected]:554/cam/realmonitor?channel=1&subtype=1" -f flv -vcodec libx264 -vprofile baseline -acodec aac -ar 44100 -strict -2 -ac 1 -f flv -s 890*540 -q 10 "rtmp://192.168.0.121:1935/mylive/1"

mts's People

Contributors

gaomingbo avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.