The nginx alternative
Restreamer is the easier choice if you want SRT ingest and Facebook without extra plumbing. If you would rather have a configuration you can read in one sitting, install nginx and libnginx-mod-rtmp, append this block to /etc/nginx/nginx.conf at the top level, outside http {}, then run nginx -t && systemctl reload nginx:
nginx
rtmp {
server {
listen 1935;
chunk_size 4096;
application live {
live on;
record off;
allow publish 203.0.113.10; # your encoder's public IP
deny publish all;
deny play all;
push rtmp://live.twitch.tv/app/TWITCH_KEY;
push rtmp://a.rtmp.youtube.com/live2/YOUTUBE_KEY;
push rtmp://127.0.0.1:19350/rtmp/FACEBOOK_KEY; # through stunnel
}
}
}The allow publish line is not optional. Without it, anyone who finds port 1935 can push video through your server onto your channels, with your keys. Facebook needs a stunnel client entry, saved under /etc/stunnel/ with the stunnel service enabled:
ini
[fb-live]
client = yes
accept = 127.0.0.1:19350
connect = live-api-s.facebook.com:443
verifyChain = yes
CAfile = /etc/ssl/certs/ca-certificates.crt
checkHost = live-api-s.facebook.comTwitch and YouTube still take plain RTMP. YouTube recommends RTMPS, which with nginx means a second stunnel entry of the same shape.