2023-05-06 22:32:09 +02:00
|
|
|
rtmp {
|
|
|
|
# abre nginx para escuchar por el puerto
|
|
|
|
server {
|
|
|
|
listen 1935;
|
|
|
|
chunk_size 4096;
|
|
|
|
# dale un nombre a tu aplicacion
|
|
|
|
|
|
|
|
#log_format combined '$remote_addr [$time_local] $command "$app" "$name" "$args" - $bytes_received $bytes_sent "$pageurl" "$flashver" ($session_readable_time)'
|
|
|
|
|
|
|
|
application entrada {
|
|
|
|
live on;
|
|
|
|
# enciende HLS
|
|
|
|
hls on;
|
|
|
|
hls_path /var/www/html/canal/;
|
|
|
|
# ajustes de hls
|
2023-05-18 23:49:16 +02:00
|
|
|
hls_fragment 5;
|
|
|
|
hls_playlist_length 1m;
|
2023-05-06 22:32:09 +02:00
|
|
|
# para bloquear el directo
|
|
|
|
# quita el comentario de la línea siguiente
|
|
|
|
# deny play all;
|
2023-05-18 23:29:30 +02:00
|
|
|
|
|
|
|
# TODO: Podemos usarlo para validar los accesos
|
|
|
|
#on_publish http://docker.for.mac.host.internal:5000/api/stream/start;
|
|
|
|
#on_publish_done http://docker.for.mac.host.internal:5000/api/stream/end;
|
|
|
|
|
2023-05-18 23:49:16 +02:00
|
|
|
idle_streams off;
|
|
|
|
hls_cleanup on;
|
|
|
|
|
|
|
|
|
2023-05-18 23:29:30 +02:00
|
|
|
## Transcode video for low latencies
|
|
|
|
exec ffmpeg -i rtmp://localhost/entrada/$name -c:v libx264 -x264opts keyint=60:no-scenecut -b:v 450k -c:a copy -s 854x480 -r 30 -sws_flags bilinear -tune zerolatency -preset veryfast -f flv rtmp://localhost/show/$name_sd;
|
2023-05-06 22:32:09 +02:00
|
|
|
}
|
2023-05-18 23:29:30 +02:00
|
|
|
|
|
|
|
application show {
|
|
|
|
live on; # Allows live input from above
|
|
|
|
hls on; # Enable HTTP Live Streaming
|
|
|
|
hls_type live; # Either 'event' or 'live' (live means played from current live position)
|
|
|
|
deny play all; # Disable consuming the stream from nginx as rtmp
|
|
|
|
|
|
|
|
hls_fragment 2s;
|
|
|
|
hls_playlist_length 10s;
|
|
|
|
|
|
|
|
# Pointing this to an SSD is better as this involves lots of IO
|
|
|
|
# hls_path /tmp/hls/;
|
|
|
|
hls_path /var/www/html/canal/variant/;
|
|
|
|
|
|
|
|
# Instruct clients to adjust resolution according to bandwidth
|
|
|
|
#hls_variant _subsd BANDWIDTH=400000;
|
|
|
|
hls_variant _sd BANDWIDTH=1000000;
|
|
|
|
#hls_variant _hd BANDWIDTH=5000000;
|
|
|
|
}
|
|
|
|
|
2023-05-06 22:32:09 +02:00
|
|
|
}
|
|
|
|
}
|