Python 3 FFMPEG Script to Automate Live Video Restreaming From DASH to RTMP Using Streamlink & NGINX



Warning: This project is in “Alpha” status and is being updated frequently with breaking changes.

PyRestreamer is a simple app built with FFMPEGStreamlinkDocker, and Python to re-stream video content from DASH or HLS streams to RTMP. One possible use case is to allow re-broadcasting content from sources that only provide DASH or HLS endpoints to other services and endpoints that require RTMP.

The general idea is that you specify the times you would like to be actively re-streaming, and then PyReStreamer will automatically start streaming at the specified time and stop after the specified duration. FFMPEG is used under the hood, so you can output anything supported by FFMPEG.

This app was specifically built to automate restreaming from Living as One to

Setting Up PyReStreamer

PyReStreamer is designed to be deployed in a Docker container. As such, you’ll need a host running Docker Engine to get started. Once you’ve got that up and running, these steps will get you started:

  1. Pull the image from Docker Hub: docker pull billdeitrick/pyrestreamer
  2. Copy the sample .env and logging.yml files and edit according to your requirements. The .env file is fairly well documented, and the logging.yml file is configured for suitable Docker defaults. PushOver support is built in (in example file) if you are a PushOver user. Otherwise, you can learn more about logging options in the Python docs. Generally I prefer to drop them in /opt/pyrestreamer on my Docker host.
  3. Start the container; here’s an example command:

Leave a Reply