2020-12-08 22:10:59 +01:00
|
|
|
rtmp_auto_push on;
|
|
|
|
rtmp_auto_push_reconnect 1s;
|
|
|
|
|
|
|
|
rtmp {
|
|
|
|
server {
|
|
|
|
#listen 1935;
|
|
|
|
listen [::]:1935;
|
|
|
|
chunk_size 4096;
|
2021-01-28 02:09:30 +01:00
|
|
|
ping 30s;
|
|
|
|
ping_timeout 15s;
|
|
|
|
drop_idle_publisher 15s;
|
2020-12-08 22:10:59 +01:00
|
|
|
|
2021-01-28 02:09:30 +01:00
|
|
|
application edge-data {
|
2020-12-08 22:10:59 +01:00
|
|
|
live on;
|
|
|
|
|
|
|
|
{% for h in osp_edge_allow %}
|
|
|
|
allow publish {{ h }};
|
|
|
|
{% endfor %}
|
2020-12-09 10:39:19 +01:00
|
|
|
deny publish all;
|
|
|
|
allow play ::1;
|
2020-12-08 22:10:59 +01:00
|
|
|
allow play 127.0.0.1;
|
2020-12-09 10:39:19 +01:00
|
|
|
deny play all;
|
2020-12-08 22:10:59 +01:00
|
|
|
|
2020-12-09 11:29:30 +01:00
|
|
|
push rtmp://127.0.0.1:1935/live/;
|
2020-12-08 22:10:59 +01:00
|
|
|
|
|
|
|
hls on;
|
|
|
|
hls_path {{ osp_edge_http_path }}/live;
|
|
|
|
hls_fragment 1;
|
2021-01-28 02:09:30 +01:00
|
|
|
#hls_playlist_length 30s;
|
|
|
|
hls_playlist_length 30m;
|
2020-12-08 22:10:59 +01:00
|
|
|
|
|
|
|
hls_nested on;
|
2021-01-28 02:09:30 +01:00
|
|
|
hls_fragment_naming sequential;
|
2020-12-08 22:10:59 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-01-28 02:09:30 +01:00
|
|
|
application edge-data-adapt {
|
2020-12-08 22:10:59 +01:00
|
|
|
live on;
|
|
|
|
|
|
|
|
{% for h in osp_edge_allow %}
|
|
|
|
allow publish {{ h }};
|
|
|
|
{% endfor %}
|
2020-12-09 10:39:19 +01:00
|
|
|
deny publish all;
|
|
|
|
allow play ::1;
|
2020-12-08 22:10:59 +01:00
|
|
|
allow play 127.0.0.1;
|
2020-12-09 10:39:19 +01:00
|
|
|
deny play all;
|
2020-12-08 22:10:59 +01:00
|
|
|
|
2020-12-09 11:29:30 +01:00
|
|
|
push rtmp://127.0.0.1:1935/live/;
|
2020-12-08 22:10:59 +01:00
|
|
|
|
2021-01-28 02:09:30 +01:00
|
|
|
exec ffmpeg -i rtmp://127.0.0.1:1935/edge-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
|
2020-12-09 10:39:19 +01:00
|
|
|
-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;
|
2020-12-08 22:10:59 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
application show {
|
|
|
|
live on;
|
2020-12-09 10:39:19 +01:00
|
|
|
allow publish ::1;
|
2020-12-08 22:10:59 +01:00
|
|
|
allow publish 127.0.0.1;
|
2020-12-09 10:39:19 +01:00
|
|
|
deny publish all;
|
|
|
|
allow play ::1;
|
2020-12-08 22:10:59 +01:00
|
|
|
allow play 127.0.0.1;
|
2020-12-09 10:39:19 +01:00
|
|
|
deny play all;
|
2020-12-08 22:10:59 +01:00
|
|
|
|
|
|
|
hls on;
|
|
|
|
hls_path {{ osp_edge_http_path }}/live-adapt;
|
|
|
|
hls_nested on;
|
|
|
|
hls_fragment 1;
|
2021-01-28 02:09:30 +01:00
|
|
|
#hls_playlist_length 30s;
|
|
|
|
hls_playlist_length 30m;
|
2020-12-08 22:10:59 +01:00
|
|
|
|
2021-01-28 02:09:30 +01:00
|
|
|
hls_fragment_naming sequential;
|
2020-12-08 22:10:59 +01:00
|
|
|
|
|
|
|
record off;
|
|
|
|
|
|
|
|
# Instruct clients to adjust resolution according to bandwidth
|
|
|
|
hls_variant _480 BANDWIDTH=1200000; # Medium bitrate, SD resolution
|
|
|
|
hls_variant _720 BANDWIDTH=2048000; # High bitrate, HD 720p resolution
|
2021-01-28 02:09:30 +01:00
|
|
|
#hls_variant _1080 BANDWIDTH=4096000; # FHB 1080p
|
2020-12-08 22:10:59 +01:00
|
|
|
#hls_variant _src BANDWIDTH=4096000; # Source bitrate, source resolution
|
|
|
|
}
|
|
|
|
|
|
|
|
application live {
|
|
|
|
live on;
|
|
|
|
drop_idle_publisher 30s;
|
2020-12-09 10:39:19 +01:00
|
|
|
allow publish ::1;
|
2020-12-08 22:10:59 +01:00
|
|
|
allow publish 127.0.0.1;
|
2020-12-09 10:39:19 +01:00
|
|
|
deny publish all;
|
2020-12-08 22:10:59 +01:00
|
|
|
allow play all;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|