Recording RTMP Streams on Ubuntu
Recording live streams is useful for catch-up content, compliance, training, podcasts, highlights and backup copies. Nginx RTMP can record incoming streams directly on the server, but you should plan storage carefully because video files can become large very quickly.
Step 1: Decide what you need to record. Some platforms record every stream, while others only record selected applications such as /events or /shows.
Step 2: Create a recording folder:
sudo mkdir -p /var/recordings/rtmp
Step 3: Set ownership so Nginx can write files:
sudo chown -R www-data:www-data /var/recordings/rtmp
Step 4: Add recording to your RTMP application:
record all;
record_path /var/recordings/rtmp;
record_unique on;
Step 5: Test your Nginx configuration:
sudo nginx -t
Step 6: Reload the service:
sudo systemctl reload nginx
Step 7: Start a short test stream, stop it, then check the recordings folder.
Step 8: Download and play the file to confirm audio and video are present.
Step 9: Add a retention policy. For example, delete recordings older than 14 or 30 days using a cron job.
Do not enable recording without monitoring disk space. A full disk can break websites, databases, logs and streaming services. For professional use, store recordings on separate storage or move them to object storage after the stream ends. Also consider privacy and consent if presenters, guests or customers are being recorded.
Hosting tip: For Online Audience style hosting guides, remind users to test changes outside busy broadcast times, keep a backup of the last working configuration, and avoid exposing admin services publicly. A clear checklist, sensible firewall rules and careful bitrate choices will prevent most support issues before they happen.