I'm trying to broadcast a stream from OBS (codec is set x264) to nginx with an rtmp server and then view the stream as mpeg-dash in VLC.
I've set up nginx with the rtmp module and that works. I can stream to nginx and receive the stream via rtmp in VLC. For that I used this URL: rtmp://127.0.0.1/live/stream
This is my config.
#user nobody;
worker_processes 1;
error_log logs/error.log debug;
events {
worker_connections 1024;
}
rtmp {
server {
listen 1935;
ping 30s;
notify_method get;
application live {
live on;
dash on;
dash_path /tmp/dash;
}
}
}
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 off;
tcp_nopush on;
aio off;
directio 512;
#keepalive_timeout 0;
keepalive_timeout 65;
server {
listen 8080;
location /dash {
# Serve DASH fragments
types {
application/dash+xml mpd;
video/mp4 mp4;
}
root /tmp;
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;
}
}
}
}
I can see the stream.mpd in the file explorer, but VLC always says can't open source. I've tried both URLs: http://127.0.0.1/tmp/dash/stream.mpd and http://127.0.0.1/dash/stream.mpd, but both didn't work.
I also tried it with HLS, but I couldn't get this to work either.
To avoid having troubles with file privileges, I set the whole folder to chmod 777.
Any ideas what could be wrong or what I could try? Thank you