diff --git a/templates/osp-rtmp.conf b/templates/osp-rtmp.conf index 1abf8f1..ce82cea 100644 --- a/templates/osp-rtmp.conf +++ b/templates/osp-rtmp.conf @@ -13,10 +13,12 @@ rtmp { {% for h in osp_edge_allow %} allow publish {{ h }}; {% endfor %} - #deny publish all; + deny publish all; + allow play ::1; allow play 127.0.0.1; + deny play all; - push rtmp://127.0.0.1:1935/live/; + push rtmp://127.0.0.1:1935/live/$name; hls on; hls_path {{ osp_edge_http_path }}/live; @@ -34,23 +36,29 @@ rtmp { {% for h in osp_edge_allow %} allow publish {{ h }}; {% endfor %} - #deny publish all; + deny publish all; + allow play ::1; allow play 127.0.0.1; + deny play all; - push rtmp://127.0.0.1:1935/live/; + push rtmp://127.0.0.1:1935/live/$name; - exec ffmpeg -i rtmp://127.0.0.1:1935/live/$name - -c:v libx264 -c:a aac -b:a 192k -vf "scale=-2:1080" -vsync 1 -copyts -start_at_zero -sws_flags lanczos -r 30 -g 30 -keyint_min 30 -force_key_frames "expr:gte(t,n_forced*1)" -tune zerolatency -preset ultrafast -crf 28 -maxrate 4192k -bufsize 8384k -threads 4 -f flv rtmp://localhost:1935/show/$name_1080 - -c:v libx264 -c:a aac -b:a 128k -vf "scale=-2:720" -vsync 1 -copyts -start_at_zero -sws_flags lanczos -r 30 -g 30 -keyint_min 30 -force_key_frames "expr:gte(t,n_forced*1)" -tune zerolatency -preset ultrafast -crf 28 -maxrate 2096k -bufsize 4192k -threads 4 -f flv rtmp://localhost:1935/show/$name_720 - -c:v libx264 -c:a aac -b:a 96k -vf "scale=-2:480" -vsync 1 -copyts -start_at_zero -sws_flags lanczos -r 30 -g 30 -keyint_min 30 -force_key_frames "expr:gte(t,n_forced*1)" -tune zerolatency -preset ultrafast -crf 28 -maxrate 1200k -bufsize 2400k -threads 4 -f flv rtmp://localhost:1935/show/$name_480; - # -c copy -f flv rtmp://localhost:1935/show/$name_src; + exec ffmpeg -i rtmp://127.0.0.1:1935/stream-data-adapt/$name + -c:v libx264 -c:a aac -b:a 192k -vf "scale=-2:1080" -vsync 1 -copyts -start_at_zero -sws_flags lanczos -r 30 -g 30 -keyint_min 30 -force_key_frames "expr:gte(t,n_forced*1)" -tune zerolatency -preset ultrafast -crf 28 -maxrate 4192k -bufsize 8384k -threads 4 -f flv rtmp://127.0.0.1:1935/show/$name_1080 + -c:v libx264 -c:a aac -b:a 128k -vf "scale=-2:720" -vsync 1 -copyts -start_at_zero -sws_flags lanczos -r 30 -g 30 -keyint_min 30 -force_key_frames "expr:gte(t,n_forced*1)" -tune zerolatency -preset ultrafast -crf 28 -maxrate 2096k -bufsize 4192k -threads 4 -f flv rtmp://127.0.0.1:1935/show/$name_720 + -c:v libx264 -c:a aac -b:a 96k -vf "scale=-2:480" -vsync 1 -copyts -start_at_zero -sws_flags lanczos -r 30 -g 30 -keyint_min 30 -force_key_frames "expr:gte(t,n_forced*1)" -tune zerolatency -preset ultrafast -crf 28 -maxrate 1200k -bufsize 2400k -threads 4 -f flv rtmp://127.0.0.1:1935/show/$name_480; + # -c copy -f flv rtmp://127.0.0.1:1935/show/$name_src; } application show { live on; + allow publish ::1; allow publish 127.0.0.1; + deny publish all; + allow play ::1; allow play 127.0.0.1; + deny play all; hls on; hls_path {{ osp_edge_http_path }}/live-adapt; @@ -72,7 +80,9 @@ rtmp { application live { live on; drop_idle_publisher 30s; + allow publish ::1; allow publish 127.0.0.1; + deny publish all; allow play all; } }