rtmp { server { listen 1935; chunk_size 4000; # test pattern applications, transmux only, low resource overhead, no recording application qa { live on; exec /usr/local/bin/ffmpeg -i rtmp://localhost/$app/$name -async 1 -vsync -1 -c:v copy -c:a aac -b:a 96k -f flv rtmp://localhost/testhls/$name_1280; } application testhls { live on; hls on; hls_path /var/lib/nginx/testhls; hls_nested on; hls_cleanup on; hls_type live; hls_fragment 10s; hls_playlist_length 60s; hls_variant _1280 BANDWIDTH=1000000; } # general applications for an end user source, recording enabled increase record_max_size to match expected max duration of any event application live { live on; record all; record_path /var/lib/nginx/rec; record_max_size 128000K; exec_record_done /usr/local/bin/record-postprocess.sh $path $basename; exec /usr/local/bin/ffmpeg -i rtmp://localhost/$app/$name -async 1 -vsync -1 -c:v libx264 -x264opts keyint=60:min-keyint=60:scenecut=-1 -c:a aac -strict -2 -b:v 500k -b:a 96k -vf "format=yuv420p,scale=480:trunc(ow/a/2)*2" -tune zerolatency -preset ultrafast -crf 23 -f flv rtmp://localhost/show/$name_480 -c:v libx264 -x264opts keyint=60:min-keyint=60:scenecut=-1 -c:a aac -strict -2 -b:v 2300k -b:a 96k -vf "format=yuv420p,scale=960:trunc(ow/a/2)*2" -tune zerolatency -preset ultrafast -crf 23 -f flv rtmp://localhost/show/$name_960 -c:v libx264 -x264opts keyint=60:min-keyint=60:scenecut=-1 -c:a aac -strict -2 -b:v 5800k -b:a 96k -vf "format=yuv420p,scale=1920:trunc(ow/a/2)*2" -tune zerolatency -preset ultrafast -crf 23 -f flv rtmp://localhost/show/$name_1920 -c:v copy -c:a aac -b:a 96k -f flv rtmp://localhost/show/$name_3840; } application show { live on; hls on; hls_path /var/lib/nginx/hls; hls_nested on; hls_cleanup on; hls_type live; hls_fragment 10s; hls_playlist_length 60s; hls_variant _480 BANDWIDTH=500000; hls_variant _960 BANDWIDTH=2300000; hls_variant _1920 BANDWIDTH=5800000; hls_variant _3840 BANDWIDTH=13000000; } } }