Created
September 6, 2020 08:18
-
-
Save Novex/2dfe1ab06473cd023cf772d3d0ae24f4 to your computer and use it in GitHub Desktop.
Old ghetto brb server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Replace $INPUT_STREAM_KEY,$TWITCH_SERVER,$TWITCH_KEY,$TWITCH_TEST_KEY, and $RTMP_FALLBACK with your actual values | |
# This doesn’t work super well, sometimes twitch disconnects on brb switch | |
# Use something like https://github.com/Hakkin/streamRIP instead | |
daemon off; | |
worker_processes 1; | |
error_log /dev/stderr; | |
events { | |
worker_connections 1024; | |
} | |
rtmp { | |
server { | |
listen 1935; | |
chunk_size 4000; | |
notify_method get; | |
ping 4s; | |
application stream { | |
live on; | |
on_publish http://localhost/rtmp_auth; | |
on_play http://localhost/rtmp_auth; | |
#exec ffmpeg -i rtmp://localhost:1935/stream/$name | |
# -c:a libfdk_aac -b:a 128k -c:v libx264 -b:v 2500k -f flv -g 30 -r 30 -s 1280x720 -preset superfast -profile:v baseline rtmp://localhost:1935/hls/$name_720p2628kbs | |
# -c:a libfdk_aac -b:a 128k -c:v libx264 -b:v 1000k -f flv -g 30 -r 30 -s 854x480 -preset superfast -profile:v baseline rtmp://localhost:1935/hls/$name_480p1128kbs | |
# -c:a libfdk_aac -b:a 128k -c:v libx264 -b:v 750k -f flv -g 30 -r 30 -s 640x360 -preset superfast -profile:v baseline rtmp://localhost:1935/hls/$name_360p878kbs | |
# -c:a libfdk_aac -b:a 128k -c:v libx264 -b:v 400k -f flv -g 30 -r 30 -s 426x240 -preset superfast -profile:v baseline rtmp://localhost:1935/hls/$name_240p528kbs | |
# -c:a libfdk_aac -b:a 64k -c:v libx264 -b:v 200k -f flv -g 15 -r 15 -s 426x240 -preset superfast -profile:v baseline rtmp://localhost:1935/hls/$name_240p264kbs; | |
} | |
application program { | |
live on; | |
pull rtmp://127.0.0.1/switcher/online name=livefeed static; | |
exec_push ffmpeg -i rtmp://127.0.0.1/program/livefeed -c:v copy -c:a copy -f flv $TWITCH_SERVER$TWITCH_KEY; | |
} | |
application switcher { | |
live on; | |
pull rtmp://127.0.0.1/stillstore/image1 name=offline; | |
pull rtmp://127.0.0.1/publish/live name=online; | |
} | |
application stillstore { | |
live on; | |
wait_video on; | |
wait_key on; | |
exec_options on; | |
#still testing this part: | |
#exec_pull ffmpeg -re -i "/home/seven/movie123.mp4" -framerate 60 -g 120 -video_size 1280x720 -b:v 6000k -minrate 6000k -maxrate 6000k -bufsize 6000k -c:v libx264 -profile:v high -preset veryfast -c:a aac -b:a 192k -ar 44100 -strict -2 -f flv "rtmp://127.0.0.1/stillstore/image1"; | |
exec_pull ffmpeg -re -i "/srv/brb-720p-2-ffmpeg.flv" -c:v copy -c:a copy -f flv "rtmp://127.0.0.1/stillstore/image1"; | |
#exec_pull ffmpeg -re -f concat -safe 0 -i "/home/seven/repeat.txt" -c:v copy -c:a copy -f flv "rtmp://127.0.0.1/stillstore/image1"; | |
} | |
# application restream { | |
# live on; | |
# pull rtmp://127.0.0.1/stillstore/image1 name=fallback static; | |
# exec_push ffmpeg -i rtmp://127.0.0.1/restream/fallback -c:v copy -c:a copy -f flv $RTMP_FALLBACK; | |
# } | |
application publish { | |
live on; | |
wait_video on; | |
wait_key on; | |
exec_options on; | |
drop_idle_publisher 6s; | |
exec_publish curl "http://127.0.0.1/control/redirect/subscriber?app=switcher&newname=online"; | |
exec_publish_done curl "http://127.0.0.1/control/redirect/subscriber?app=switcher&newname=offline"; | |
} | |
} | |
} | |
http { | |
server { | |
listen 80; | |
access_log /dev/stdout; | |
location /rtmp_auth { | |
if ($arg_psk = '$INPUT_STREAM_KEY') { | |
return 200; | |
} | |
return 403; | |
} | |
location /stat { | |
rtmp_stat all; | |
rtmp_stat_stylesheet static/stat.xsl; | |
} | |
location /control { | |
rtmp_control all; | |
} | |
location /static { | |
alias /www/static; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment