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.
Go to file
Sándor a9a7a5d939 load specified config 2021-05-28 09:27:44 +02:00
.gitignore Added sleep to config 2021-05-21 15:55:31 +02:00
README Initial commit 2021-05-21 03:35:51 +02:00
config.example.json Added sleep to config 2021-05-21 15:55:31 +02:00
record.php load specified config 2021-05-28 09:27:44 +02:00


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 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 

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" &