Saving ESCAM QF001 IP camera RTSP stream to disk

The ESCAM QF001 is a very cheap (but fairly decent) IP camera. Recently I bought three from AliExpress and payed about € 30 a piece. After testing I’m planning to buy three more. The only complaint I have is that they make kind of a hissing sound but the video and audio quality is pretty good for it’s price. Here is a review.

The goal is to save all the video / audio streams from the different camera’s to a hard disk so it can be viewed later. I’m having a Raspberry Pi Model B+ as a fileserver.

So in my case, I’m using six camera’s but this works as good for 1 as it does for 6 or for 10. Let’s get started.

You’ll need:

  • IP camera(‘s) that support(s) an RTSP stream;
  • a Linux fileserver. I’m using a Raspberry PI with Raspbian on it;

If you want to configure these camera’s, you’ll need VMS or Video Management Software. It’s probably developed in China but it’s not too bad, once you get to know it.

  • First I’m going to make sure the camera has a static IP so I can always reach it on the same address. This also will make things easy for our script. You select your camera (left treeview), click Device config and click on Network.

  • Second, I’m going to setup a password for the Administrator and make a separate account for the user that’s going to login to the camera and will fetch the RTSP stream. Same as before: select your camera (in the left treeview), click on Device config and choose Tool manager.
  • In the tab User manager I have added a user called ipcamera. You can remove rights from the user but I have not really bothered.

 

For now, we are done with the camera’s so we’ll get started on the Raspberry PI fileserver. I’m having an external hard disk attached to it with the following directories:

 

This is set up so the different camera’s can stream into their own directory.  I’m also making a user called ipcamera on the Raspberry Pi. This one will be used exclusively for streaming and you could tune the access this user has so it can just write into the different CAM folders.

I’m using avconv to convert the h264 RTSP stream into something VLC can read. The avconv package is part of winff, so I’m installing that on the PI.

This long stream will be split up into parts of 10 minutes. We’ll need to kill this avconv process and for that we’ll need pkill.

Logged in as the ipcamera user, I’m making two files in my homedirectory: /home/ipcamera:

  • recordIpCameras.sh

This file saves the live RTSP feed from the different camera’s. Don’t forget to change the user / password and chmod +x.

  • cleanIpCamera.sh

The script above generates the video files for us. This one deletes them after a set period of time.

In conclusion we’re going to add these two scripts to the crontab of the ipcamera user.

  • Login as the ipcamera user

Add these two lines to your crontab file:

Reboot (for the fun of it), wait until a tenth minute (like: 7:10, 7:20, 7:30) and watch the feeds pour in.

Leave a Reply

Your email address will not be published. Required fields are marked *