daemon off; events { worker_connections 1024; } rtmp { server { listen 1935; chunk_size 4000; application encoder { live on; exec ffmpeg -i rtmp://localhost:1935/encoder/$name -c:a libfdk_aac -b:a 32k -c:v libx264 -b:v 128K -f flv -g 30 rtmp://localhost:1935/hls/$name_low -c:a libfdk_aac -b:a 64k -c:v libx264 -b:v 256k -f flv -g 30 rtmp://localhost:1935/hls/$name_mid -c:a libfdk_aac -b:a 128k -c:v libx264 -b:v 512K -f flv -g 30 rtmp://localhost:1935/hls/$name_hi; } application hls { live on; hls on; hls_fragment_naming system; hls_fragment 5s; hls_path /data/hls; hls_nested on; hls_variant _low BANDWIDTH=160000; hls_variant _mid BANDWIDTH=320000; hls_variant _hi BANDWIDTH=640000; } } } http { server { listen 80; location /hls { types { application/vnd.apple.mpegurl m3u8; video/mp2t ts; } root /data; add_header Cache-Control no-cache; add_header Access-Control-Allow-Origin *; } location /stat { rtmp_stat all; rtmp_stat_stylesheet static/stat.xsl; } location /static { alias /static; } } }