/nginx-multistream

Multiplex an rtmp stream to both YouTube and Facebook Live using nginx in a container

Primary LanguageDockerfile

nginx-multistream

Multiplex a rtmp stream to both YouTube and Facebook Live using nginx in a container. This makes use of NGINX, the NGINX RTMP module, and FFmpeg.

This was cobbled together from instructions on the OBS project forum as well as a guide on Vultr. I have Dockerized the installation of nginx, ffmpeg, and the rtmp modules using an Ubuntu Xenial (18.04) base, nginx 1.17.9, and ffmpeg4.

Notes

This was testing on macOS with Docker desktop

Running

Edit nginx.conf and put in your own YouTube and Facebook stream keys

Build and run:

make docker-build
make docker-run

Streaming to the multiplexer

In OBS choose a custom stream and use rtmp://localhost/live as the destination. No key is needed.

Performance notes

The Facebook Live stream is re-encoded using ffmpeg. If you're running into performance limitations on the computer running the multiplexer the Facebook stream may lag or fail.