Introduction: Router Becomes Video Recorder for IP Cameras

Some routers have powerful CPU and USB-port on a board and can be used as a video recorder in addition to routing functions, in order for collect and distribute video and sound from IP-cameras that streams only H264/265 RTSP (as most modern cheap high resolution IP cameras). Moreover, some routers CPU have DSP (digital signal processor), and so can be highly effective for video stream decoding (change the resolution, the frame rate, etc). As a storage can be used USB flash, USB-HDD, USB-SSD. A NAS in home network can be used too.

Not any router can be upgraded as described here, depending on used CPU and manufacturer's limitations of firmware reflashing. For example, it failed to upgrade the Mediatek MTK7621 based router. But had perfectly upgraded the router based on Qualcomm IPQ4018 (Cortex-A7).

This project utilizes OpenWrt, Debian Buster under debootstrap, FFmpeg and Samba.

Step 1: On the Router Was Installed OpenWrt OS

On the router was installed OpenWrt OS in order to have Linux on a board. OpenWRT OS and the home network was deployed as described on the appropriate page of OpenWrt project for this router model.

Step 2: Dedian Buster, FFmpeg and Samba Were Deployed Within OpenWrt

The FFmpeg package was used for collect the stream from the IP camera and store that in files by piecemeal (2 minutes length of each part). OpenWrt OS has FFmpeg built in, but this version does not work with H264/265 stream at this moment, despite this stream type is most used in cheap high resolution IP-cameras.

But up on OpenWrt OS (lightweight Linux) can be installed Debian OS (fullweight Linux). The fullweight FFmpeg package can be installed at Debian next and this version can work with H264/265 streams from IP cameras.

First step dramatically increased the memory of the router with a USB flash (but USB-HDD or USB-SSD is best). Same time, this storage can be used for video archives if there is no NAS in the home network. The Samba was installed.

Second step was to install a fullweight Debian OS under debootstrap.

Third step: FFmpeg was installed. The IP camera can be connected to the router wired or Wi-Fi.

Step 3: Connect IP Camera, Configure Crontab And... Thats All

The IP camera can be connected to the router wired or Wi-Fi.

Using ONVIF Device Manager was found the link to the camera's RTSP stream.

With the noted RTSP link of the camera, the Crontab of OpenWrt was configured to save video from IP cameras in files and for control of the video archive size.

That's all. Ever since this router is not only a router, but a video recorder too. Was no experiment with two or more IP cameras, but tests with one only IP camera do not show overload of the router's CPU.

The video archive can be shared not only in the home network, but with global access on the Internet too. To make this, it is necessary to install FTP server in OpenWrt, and use router's port mapping with static IP, external IP, or temporary IP with alerts about them changes.

If the computer of this router is used only as a video recorder then it is a good idea to switch off Wi-Fi radios on a board - will be less EM radiation and more power for USB.

Details here.