user nginx; worker_processes auto; load_module modules/ngx_rtmp_module.so; error_log /var/log/nginx/error.log notice; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/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 /var/log/nginx/access.log main; sendfile on; #tcp_nopush on; keepalive_timeout 65; #gzip on; include /etc/nginx/conf.d/*.conf; } # TCP/UDP proxy and load balancing block # #stream { # Example configuration for TCP load balancing #upstream stream_backend { # zone tcp_servers 64k; # server backend1.example.com:12345; # server backend2.example.com:12345; #} #server { # listen 12345; # status_zone tcp_server; # proxy_pass stream_backend; #} #} rtmp { server { listen 1935; chunk_size 4000; application app { live on; #exec ffmpeg -i rtmp://localhost/app/$name # -c:a libmp3lame -b:a 32k -c:v libx264 -b:v 128K # -f flv rtmp://localhost/hls/$name_low # -c:a libmp3lame -b:a 64k -c:v libx264 -b:v 256k # -f flv rtmp://localhost/hls/$name_mid # -c:a libmp3lame -b:a 128k -c:v libx264 -b:v 512K # -f flv rtmp://localhost/hls/$name_hi # -c:a libmp3lame -b:a 128k -c:v libx264 -b:v 512K # -f flv rtmp://localhost/dash/$name_dash; #exec ffmpeg -i rtmp://localhost:1935/$app/$name # -c:a libmp3lame -b:a 128k -c:v libx264 -b:v 512K # -f flv rtmp://localhost/dash/$name_dash; } application hls { live on; hls on; hls_path /tmp/hls; hls_nested on; hls_variant _low BANDWIDTH=160000; hls_variant _low BANDWIDTH=320000; hls_variant _low BANDWIDTH=640000; } application dash { live on; dash on; dash_path /tmp/dash; dash_nested on; } } }