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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM