A simple RTSP stream recorder that records a stream in segments and supports looping the recording once storage space runs out. Ideal for use in low-powered devices like the Raspberry Pi.
- ffmpeg
- Clone this repository
- Add the stream information to the streamlist.json file according to the example. You can add more entries to add more streams to be recorded. Make sure the record directories are accessible by the program.
- Run RTSPRecord.py
- Clone this repository
- Add the stream information to the streamlist.json file according to the example. You can add more entries to add more streams to be recorded. Make sure the record directories are accessible by the program.
- Make RTSPRecord.py executable
chmod +x /path/to/script/directory/RTSPStream.py - Create a new service
sudo nano /etc/systemd/system/RTSPRecord.service
Add the following content to the service file.
[Unit]
Description=RTSPRecord Service
After=network.target
[Service]
ExecStart=/usr/bin/python3 /path/to/script/directory/RTSPStream.py
WorkingDirectory=/path/to/script/directory
Restart=always
User=youruser
Group=yourgroup
[Install]
WantedBy=multi-user.target- Reload systemd and enable the service
sudo systemctl daemon-reload
sudo systemctl enable RTSPRecord.service
sudo systemctl start RTSPRecord.service