NGINX RTMP - HLS Variants has no video

16 Views Asked by At

I'm trying to get HLS Fragmentation to work using the NGINX-RTMP module. The livestream itself is working, its seems to just be an issue with the resolution changing. I'm also getting audio.

This is the rtmp section of my nginx.conf

rtmp {
    server {
        listen 1935;
        chunk_size 4096;

        application live {
            live on;

            allow publish all;
            allow play all;

            exec ffmpeg -i rtmp://localhost/$app/$name
                -c:v libaom-av1 -b:v 1400k -c:a aac -b:a 128k -vf "scale=384:216" -tune zerolatency -f flv rtmp://localhost/hls/$name_bad
                -c:v libaom-av1 -b:v 2500k -c:a aac -b:a 128k -vf "scale=768:432" -tune zerolatency -f flv rtmp://localhost/hls/$name_low
                -c:v libaom-av1 -b:v 6000k -c:a aac -b:a 144k -vf "scale=1280:720" -tune zerolatency -f flv rtmp://localhost/hls/$name_mid
                -c:v libaom-av1 -b:v 10000k -c:a aac -b:a 144k -vf "scale=1920:1080" -tune zerolatency -f flv rtmp://localhost/hls/$name_hi;
        }

        application hls {
            live on;

            allow publish all;
            allow play all;
            
            hls on;
            hls_path /tmp/hls/;
            hls_nested on;

            hls_variant _bad BANDWIDTH=1528000,RESOLUTION=384x216,NAME="216p",FRAME-RATE=30;
            hls_variant _low BANDWIDTH=2628000,RESOLUTION=768x432,NAME="432p",FRAME-RATE=30;
            hls_variant _mid BANDWIDTH=6144000,RESOLUTION=1280x720,NAME="720p60",FRAME-RATE=60;
            hls_variant _hi BANDWIDTH=10144000,RESOLUTION=1920x1080,NAME="1080p60",FRAME-RATE=60;
        }
    }
}

This is the stream.m3u8 generated by NGINX

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1528000,RESOLUTION=384x216,NAME="216p"
stream_bad/index.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=2628000,RESOLUTION=768x432,NAME="432p"
stream_low/index.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=6144000,RESOLUTION=1280x720,NAME="720p60"
stream_mid/index.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=10144000,RESOLUTION=1920x1080,NAME="1080p60"
stream_hi/index.m3u8

I've tried both switching from libaom-av1 to libx264 and removing the framerate changes and still got the same issue.

Thanks for your help!

0

There are 0 best solutions below