nginx 摄像头去flash视频配置
下载nginx http://nginx.org/download/ngi...
git clone nginx-http-flv-module, 地址 https://github.com/winshining...
进入 nginx根门路,执行 ./configure --add-module=/path/to/nginx-http-flv-module ,如果要反对https,增加对应的配置参数
执行make,如果遇到谬误,装置对应的模块
执行make install

ffmpeg相干
vcodec指定视频编码为h264(前端只反对h264),参数-g 升高推流提早

ps aux|grep ffmpeg|awk '{print $2}'|xargs kill -9
nohup ffmpeg -f rtsp -rtsp_transport tcp -i "rtsp://user:password@ip/h264/ch1/main/av_stream" -vcodec libx264 -g 1 -an -f flv -vf scale=320:-1 -r 5 rtmp://192.168.2.30:1935/myapp/1 >/opt/log/live1.log 2>&1 &

报错相干,可能短少libx264模块,下载 git clone https://code.videolan.org/vid...
进入libx264 执行 ./configure --enable-static --enable-share --disabled-asm 、 make 、 make install
进入ffmpeg 执行 ./configure --enable-gpl --enable-libx264 、 make 、 make install

遇到报错 ffmpeg: error while loading shared libraries: libx264.so.161: cannot open shared object file: No such file or directory
编辑 Id.so.conf 具体可百度

nginx 配置demo,请不要增加 epoll相干配置,会导致前端申请始终pending问题

events {

worker_connections  1024;

}
http {

include       mime.types;default_type  application/octet-stream;sendfile        on;keepalive_timeout  65;server {    listen       8881;    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 /live {        flv_live on;        add_header Cache-Control no-cache;        add_header Access-Control-Allow-Origin *;    }}

}
rtmp {

server {    listen 1935;    chunk_size 4000;    application myapp {        live on;    }}

}

推流地址 rtmp://ip:1935/myapp/x
前端如何拜访 http://ip:8881/live?app=myapp...
浏览器同一个域,只反对6个申请,多余6个,请提供多个域名拜访,或者应用http2协定。