How to set-up multistreaming to save on bandwidth? Useful in cases where upload might be limited.
sudo apt install npm
npm install node-media-server
mkdir -p /home/ubuntu/nms
Use a text editor to create/edit the following file: app.js
const NodeMediaServer = require('node-media-server');
const config = {
logType: 3,
rtmp: {
port: 1935,
chunk_size: 60000,
gop_cache: true,
ping: 30,
ping_timeout: 60
},
http: {
port: 8000,
allow_origin: '*'
},
relay: {
ffmpeg: '/usr/bin/ffmpeg',
tasks: [
{
app: 'live',
mode: 'push',
edge: 'rtmp://sea02.contribute.live-video.net/app/live_<TWITCH-TOKEN>',
name: 'twitch',
appendName : false
},
{
app: 'live',
mode: 'push',
edge: 'rtmps://fa723fc1b171.global-contribute.live-video.net/app/sk_us-west-<KICK-TOKEN>',
name: 'kick',
appendName : false
},
{
app: 'live',
mode: 'push',
edge: 'rtmp://a.rtmp.youtube.com/live2/<YOUTUBE-TOKEN>',
name: 'youtube',
appendName : false
}
]
}
};
var nms = new NodeMediaServer(config)
nms.run();
sudo ufw allow proto tcp from <YOUR-IP> to any port 1935
Use a text editor to create/edit the following file: /lib/systemd/system/nms.service
[Unit]
Description=start NMS
Documentation=
After=network.target
[Service]
Environment=
Type=simple
User=ubuntu
ExecStart=/usr/bin/node /home/ubuntu/nms/app.js
Restart=on-failure
[Install]
WantedBy=multi-user.target
Enable the servicesudo systemctl enable nms
sudo systemctl start nms
To later restart the service after config changes, use:
sudo systemctl restart nms
Start streaming
After completing these steps, configure OBS to point to <SERVER-IP>:1935 and within a few seconds it should start streaming to all configured platforms.