Archive for the ‘sysadmin’ Category

rtmp streaming to multiple platforms at once using nginx with docker

juni 27th, 2020 No comments

It’s been while since I posted here, and since I recently did something that is worth to put on here, I’ll have another go 😉

I’m part of the hamradio YOTA project, and with the epidemic thingie we wanted to do some live sessions on Youtube, Facebook and twitch at once.

To capture/broadcast I’m using OBS on my desktop PC, however, this software can only push to one streaming service at once, unless I open up multiple OBS’s and try to set things up that way, but that could lag your computer, and if you have bandwidth limitations, this can also create issues.

So, I wanted to push the stream to one of my datacenter servers, and transcode(where needed)/redistribute to the streaming platforms from there.
This makes it so I only have to upload once from a “home” connection
In my tests, my rtmp stream +-6 Mbit up from home, +-17 Mbit up from datacenter to the services.
Optionally people can also pull from that service, or you can distribute it to more servers for other people to look live, if you want to have your own mini rtmp setup.

Since I like to use docker, I’ve created a Dockerfile that builds nginx with this rtmp module.
I’ve also created a docker-compose so it’s easy for you to get started an try it out yourself.
(Requires some experience with servers and docker)
You can find it here:

Note, if your home router overheats and restarts during the stream, cause of heatwave (yeah I need to get an airco in that tech room), you might have to stop the broadcast and start it again, cause it doesn’t handle disconnects that well.. if facebook is disconnected too long they stop and you might need to reset that stream key.. Youtube nicely waits, for twitch it doesn’t matter

73 de ON1GPS