I have a working setup of nginx with the rtmp module working like a charm creating live streams with both dash and hsl. No problem so far.
When I try to enable ffmpeg transcoding for adaptive streaming, it creates the hls version just fine, the video chunks, a m3pu8 for each video version and a master m3u8 that is the one I call from the web player.
But in the dash version I get the chunks, the mpd manifest for each version but no master manifest.
Am I missing something? Any help would be greatly appreciated.
nginx.conf:
events {
worker_connections 1024;
}
rtmp {
server {
listen 1935;
application live {
live on;
exec ffmpeg -i rtmp://stream.server.net/live/$name -threads 1
-c:v libx264 -profile:v baseline -b:v 768K -s 640x360 -f flv -c:a aac -ac 1 -strict -2 -b:a 96k
rtmp://stream.server.net/liveout/$name_360
-c:v libx264 -profile:v baseline -b:v 1024K -s 852x480 -f flv -c:a aac -ac 1 -strict -2 -b:a 128k rtmp://stream.server.net/liveout/$name_480;
}
application liveout {
live on;
hls on;
hls_path /home/stream/hls/;
hls_fragment 4s;
hls_playlist_length 60s;
dash on;
dash_path /home/stream/dash;
dash_fragment 10s;
dash_playlist_length 30s;
dash_nested off;
hls_variant _360 BANDWIDTH=448000;
hls_variant _480 BANDWIDTH=1152000;
}
}
}
http {
server {
server_name stream.server.net;
root /home/stream/;
location /hls {
# Serve HLS fragments
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
root /home/stream/;
add_header Cache-Control no-cache;
# CORS setup
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length';
# Allow CORS preflight requests
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
}
location /dash {
root /home/stream/;
# Serve DASH fragments
types {
application/dash+xml mpd;
video/mp4 mp4;
}
add_header Cache-Control no-cache;
# CORS setup
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length';
# Allow CORS preflight requests
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
}
location /stat {
rtmp_stat all;
# Use this stylesheet to view XML as web page
# in browser
rtmp_stat_stylesheet stat.xsl;
}
location /stat.xsl {
# XML stylesheet to view RTMP stats.
# Copy stat.xsl wherever you want
# and put the full directory path here
root /home/stream/;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/stream.server.net/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/stream.server.net/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
types {
text/html html;
application/dash+xml mpd;
}
server {
if ($host = stream.server.net) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name stream.server.net;
return 404; # managed by Certbot
}}