How I Converted My Old Laptop into a CCTV Storage Server

Turn your old laptop into a private, cloud-free CCTV storage server using FFmpeg and a bit of Linux magic. Capture, store, and manage IP camera footage efficiently — no DVR or subscription needed.

Savita Bharti

2 months ago

how-i-converted-my-old-laptop-into-a-cctv-storage-server

In an age where smart cameras are everywhere, storing CCTV footage usually means monthly cloud subscriptions or pricey DVR systems. I wanted a more affordable, private solution — so I repurposed an old Ubuntu laptop into a dedicated CCTV feed recorder. Here's how I did it.

🔧 What You’ll Need

  • An old laptop (running Ubuntu Server — no GUI required)

  • A TP-Link Tapo cam (or any IP camera that supports RTSP)

  • FFmpeg installed

  • Basic terminal/command line knowledge

🎥 Accessing the Camera Stream

Most modern IP cameras support RTSP (Real-Time Streaming Protocol), which allows you to stream directly into tools like FFmpeg.

Here’s the RTSP URL format I used for my Tapo C200:

bash

rtsp://username:password@192.168.1.13:554/stream1

You can test the stream with:

bash

ffmpeg -i rtsp://username:password@camera_ip/stream1

💾 Recording with FFmpeg

To capture and store the feed in hour-long chunks, I used the following command:

bash

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

🔍 What This Does:

  • Downscales to 720p resolution

  • Reduces frame rate to 12fps (enough for security footage)

  • Uses CRF 30 for smaller file size without losing too much quality

  • Ignores audio (-an) to save space

  • Splits files into hourly segments

🧹 Automating Cleanup with Cron

To avoid running out of disk space, I set up a cron job that deletes footage older than 2 days:

bash

crontab -e

Then add:

arduino

59 23 * * * find /home/your_username/recordings/ -type f -name "recording-*.mp4" -mmin +2880 -delete

This runs daily at 11:59 PM and removes videos older than 48 hours (2880 minutes).

⚙️ Keeping FFmpeg Running with PM2

While PM2 is designed for Node.js, it also works great for managing long-running CLI processes:

bash

pm2 start "ffmpeg -rtsp_transport tcp -i rtsp://... -c:v libx264 ..." --name cctv-recorder --interpreter bash

pm2 startup

pm2 save

This ensures the FFmpeg command restarts on boot and keeps running reliably in the background.

📦 Storage Breakdown

Using the above settings, here’s my actual usage:

  • 24 seconds = ~786 KB

  • 1 hour = ~120 MB

  • 1 day (24h) = ~2.8 GB

  • 80 GB drive = ~28 days of retention

Perfect for short-term logging without manual intervention.

🧠 What I Learned

  • FFmpeg is a beast. Lightweight, customizable, and insanely powerful.

  • You don’t need expensive hardware to build a robust security setup.

  • Cron + PM2 = Set it and forget it.

  • Privacy first. No more relying on cloud services to store sensitive footage.

🏁 Final Thoughts

This little weekend project turned my dusty old laptop into a self-sufficient CCTV storage box. It’s private, cheap, and highly customizable — ideal for privacy-conscious homeowners or DIY tinkerers.

Got a camera lying around? Give it a go!