RTMP转HTTP-FLV解决web禁用flash

下载nginx-http-flv-module
https://gitee.com/mirrors/nginx-http-flv-module.git
将模块编译进NGINX

./configure --add-module=../nginx-http-flv-module
make
make install

测试nginx-1.10.3是可用的(可参考上篇)

./configure --prefix=/usr/local/nginx --with-debug --with-pcre=../pcre-8.40 --with-zlib=../zlib-1.2.11 --with-openssl=../openssl-1.0.2k --add-module=../nginx-http-flv-module

nginx增加配置
其中//flv是增加项,/flv是必填项

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

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on; 
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65; 

    #gzip  on;

    server {
        listen       8100;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

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

        location /flv {
            add_header 'Access-Control-Allow-Origin' '*';
            flv_live on;
            chunked_transfer_encoding on;
        }

nginx pull配置
这一步很重要,转播cctv6

rtmp {
    server {
        listen 1935;

        #直播
        application live {
            live on;
            pull rtmp://58.200.131.2:1935/livetv/cctv6;
        }

VLC测试
一定要注意,链接地址、端口号、应用名称对应关系
http://39.106.70.134:8100/flv?port=1935&app=live

参考地址
https://wxzzz.com/425.html#comment-111

posted @ 2021-04-02 11:59  thomas_blog  阅读(2172)  评论(0编辑  收藏  举报