arut / nginx-rtmp-module

NGINX-based Media Streaming Server
http://nginx-rtmp.blogspot.com
BSD 2-Clause "Simplified" License
13.31k stars 3.5k forks source link

hls_variant is not working for some unknown reason. #822

Open kmskrishna opened 8 years ago

kmskrishna commented 8 years ago

From my knowledge the src application takes the rtmp stream from OBS with the in OBS as rtmp://10.9.21.50/src/1080 where 1080 is the name of the stream.

and then ffmpeg encodes it and feeds it to live application. But on starting the stream only /tmp/live folder is created /tmp/live/1080/ folder is not getting created and index.m3u8 is not getting created in that.

I have been googling for the solution for the past 48 hours but no luck. I am copy pasting my nginx.conf file here.

`user root; worker_processes 1; error_log logs/error.log debug;

events { worker_connections 1024; }

rtmp { server { listen 1935;

    application src {
        allow play all;
        live on;

        exec ffmpeg -i rtmp://127.0.0.1:1935/src/$name -async 1 -vsync -1
                -c:v libx264 -c:a libvo_aacenc -b:v 256k -b:a 32k -vf "scale=480:trunc(ow/a/2)*2" -tune zerolatency -preset veryfast -crf 23 -f flv rtmp://127.0.0.1:1935/live/$name_low
                -c:v libx264 -c:a libvo_aacenc -b:v 768k -b:a 96k -vf "scale=720:trunc(ow/a/2)*2" -tune zerolatency -preset veryfast -crf 23 -f flv rtmp://127.0.0.1:1935/live/$name_mid
                -c:v libx264 -c:a libvo_aacenc -b:v 1024k -b:a 128k -vf "scale=960:trunc(ow/a/2)*2" -tune zerolatency -preset veryfast -crf 23 -f flv rtmp://127.0.0.1:1935/live/$name_high
                -c:v libx264 -c:a libvo_aacenc -b:v 1920k -b:a 128k -vf "scale=1280:trunc(ow/a/2)*2" -tune zerolatency -preset veryfast -crf 23 -f flv rtmp://127.0.0.1:1935/live/$name_hd720
                -c copy -f flv rtmp://127.0.0.1:1935/live/$name_src;
    }

    application live {
        live on;
        hls on;
        hls_path /tmp/live;
        hls_nested on;
   hls_fragment 10s;

        hls_variant _low BANDWIDTH=288000; 
        hls_variant _mid BANDWIDTH=448000; 
        hls_variant _high BANDWIDTH=1152000;
        hls_variant _hd720 BANDWIDTH=2048000;
        hls_variant _src BANDWIDTH=4096000;
    }

    application dash {
        live on;
        dash on;
        dash_path /tmp/dash;
        dash_nested on;
    }
}

}

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

server {
    listen 80;
    server_name 127.0.0.1 _ 10.9.21.50;

    location /live {
        types {
            application/vnd.apple.mpegurl m3u8;
            video/mp2t ts;
        }
        root /tmp;
        add_header Cache-Control no-cache;
        add_header Access-Control-Allow-Origin *;
    }  

    location /stat {
        rtmp_stat all;
        rtmp_stat_stylesheet stat.xsl;
    }

    location /stat.xsl {
        root /usr/local/nginx/html/stat;
    }

    location /stats {
        stub_status;
    }

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

    location /dash {
        root /tmp;
        add_header Cache-Control no-cache;
        add_header 'Access-Control-Allow-Origin' '*';
    }

}

}`

chr314 commented 7 years ago

just replace libvo_aacenc with libfdk_aac :)