Simple PHP hackjob to automatically record live streams from Restreamer. It is copying the HLS output with FFmpeg when the Restreamer instance report type connected.
.gitignore | ||
config.example.json | ||
README | ||
record.php |
With this utility it is possible to record live streams that is available through a Restreamer instance. This monitors the Restreamer API to check if the local repeater is connected. When it is, it probes the HLS endpoint and depending on the HTTP Code in the response it starts an FFmpeg process that copies the HLS output OR RTMP stream to a specified location on the filesystem. Then it can be played back. It is also possible to provide a "rewindable" live stream, but keep in mind that it will introduce big latency. To set this up, clone this repository and move or copy config.example.json to config.json, then edit it. Then, run the following command to start monitoring and recording streams: php -q /path/to/record.php Create a cronjob or systemd service to make it run on boot and handle potential failures/exits. Example cronjob: * * * * * flock -n /tmp/hls-recorder-flock -c "php -q /path/to/record.php" &