In the era of smart surveillance, many of us have IP cameras like TP-Link Tapo at home. But storing the footage reliably often means investing in cloud plans or expensive DVRs. I decided to do somethi

An old laptop with Ubuntu Server (no GUI needed)
TP-Link Tapo Camera (or any IP camera with RTSP support)
Basic understanding of the command line
ffmpeg installed on the laptop
Most Tapo cameras provide an RTSP stream. Here's the example I used:
rtsp://username:[email protected]:554/stream1 I verified it worked using ffmpeg.
To record continuously and split footage into 1-hour segments:
ffmpeg -rtsp_transport tcp -i rtsp://your_user:your_pass@camera_ip/stream1 \
-vf scale=1280:720 -r 12 -c:v libx264 -preset slow -crf 30 -an \
-f segment -segment_time 3600 -reset_timestamps 1 -strftime 1 \
/home/your_username/recordings/recording-%Y-%m-%d_%H-%M-%S.mp4This:
Scales to 720p
Reduces framerate to 12 fps
Uses libx264 with crf 30 for size optimization
Ignores audio (-an)
Saves hourly segments
I added a cron job to delete files older than 2 days:
crontab -e59 23 * * * find /home/your_username/recordings/ -type f -name "recording-*.mp4" -mmin +2880 -deleteEven though ffmpeg is not a Node.js app, you can still manage it with PM2:
pm2 start "ffmpeg -rtsp_transport tcp -i rtsp://... -c:v libx264 ..." --name cctv-recorder --interpreter bashpm2 startup
pm2 saveWith 12fps @ 720p and CRF 30, my storage looked like:
24s = 786 KB
~2.8 GB per day
80 GB free = ~28 days of footage retention
FFmpeg is powerful and lightweight
You don’t need a GUI or expensive hardware to manage CCTV
Proper cron management can automate cleanup
PM2 makes long-running CLI jobs easy to manage
With this setup, I turned a spare laptop into a full-fledged surveillance recorder, saving money and gaining control over my data. Whether you're a DIY enthusiast or privacy-conscious, this approach is a great weekend project.t
0
11
0