From bbd81c1847dff893a880e158db9b0b8dc4bead62 Mon Sep 17 00:00:00 2001 From: Lukas Schulz Date: Sat, 25 Jul 2020 16:45:24 +0200 Subject: [PATCH] Add new file --- streaming-server.conf | 113 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 streaming-server.conf diff --git a/streaming-server.conf b/streaming-server.conf new file mode 100644 index 0000000..223b346 --- /dev/null +++ b/streaming-server.conf @@ -0,0 +1,113 @@ +user www-data; +worker_processes auto; +pid /run/nginx.pid; +include /etc/nginx/modules-enabled/*.conf; + +events { + worker_connections 768; + # multi_accept on; +} + +rtmp { + server { + listen 1935; + chunk_size 4000; + application stream { + live on; + + #record all; + #record_path /tmp/av; + #record_max_size 1M; + + #record_unique on; + + #allow publish 192.168.*.*; + #deny publish all; + + exec ffmpeg -re -i rtmp://localhost:1935/$app/$name -vcodec flv -acodec copy -s 1920x1080 + -f flv rtmp://localhost:1935/1080p/${name} + -vcodec h264_nvenc -s 1920x1080 -vprofile baseline -acodec copy -f flv rtmp://localhost:1935/hls/1080p + -f flv rtmp://localhost:1935/dash/1080p; + + exec ffmpeg -re -i rtmp://localhost:1935/$app/$name -vcodec flv -acodec copy -s 1280x720 + -f flv rtmp://localhost:1935/720p/${name} + -vcodec h264_nvenc -s 1280x720 -vprofile baseline -acodec copy -f flv rtmp://localhost:1935/hls/720p + -f flv rtmp://localhost:1935/dash/720p; + + exec ffmpeg -re -i rtmp://localhost:1935/$app/$name -vcodec flv -acodec copy -s 848x480 + -f flv rtmp://localhost:1935/480p/${name} + -vcodec h264_nvenc -s 848x480 -vprofile baseline -acodec copy -f flv rtmp://localhost:1935/hls/480p + -f flv rtmp://localhost:1935/dash/480p; + + # exec ffmpeg -re -i rtmp://localhost:1935/$app/$name -vcodec flv -acodec copy -s 32x32 + # -f flv rtmp://localhost:1935/small/${name}; + } + + application 1080p { + live on; + } + + application 720p { + live on; + } + + application 480p { + live on; + } + + application small { + live on; + } + + application hls { + live on; + hls on; + hls_path /tmp/hls; + } + + application dash { + live on; + dash on; + dash_path /tmp/dash; + } + } +} +http { + + server { + + listen 8080; + + # This URL provides RTMP statistics in XML + location /stat { + rtmp_stat all; + + # Use this stylesheet to view XML as web page + # in browser + rtmp_stat_stylesheet stat.xsl; + } + + location /stat.xsl { + # XML stylesheet to view RTMP stats. + # Copy stat.xsl wherever you want + # and put the full directory path here + root /var/www/; + } + + location /hls { + # Serve HLS fragments + types { + application/vnd.apple.mpegurl m3u8; + video/mp2t ts; + } + root /tmp; + add_header Cache-Control no-cache; + } + + location /dash { + # Serve DASH fragments + root /tmp; + add_header Cache-Control no-cache; + } + } +} \ No newline at end of file