Some routers have powerful CPUs and USB-ports on a board and can be used as a video recorder in addition to routing functions, in order to 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 of routers CPU has DSP (digital signal processor), and so can be highly effective for a video stream decoding (change the resolution, the framerate, 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, as it depends on the CPU used and manufacturer's limitations of firmware reflashing. For example, was failed to upgrade the MediaTek MTK7621 based router. But was perfectly upgrade the router based on Qualcomm IPQ4018.
This project utilizes OpenWrt, Debian Buster under debootstrap, FFmpeg and Samba.
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 haves FFmpeg build in, but this version 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). Then fullweight FFmpeg package can be installed at Debian and this version can works with H264/265 stream from IP cameras.
First step was 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 archive if no NAS in the home network.
Second step was installed fullweight Debian OS under debootstrap.
Third step FFmpeg & Samba was installed.
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 noted RTSP link of the camera, the Crontab of OpenWrt was configured for save video from IP camera in files and for control of the video archive size.
That's all. Ever since this router is not only router, but video recorder too. Was no experiment with two ore more IP cameras, but test 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 in Internet too. To make this, need 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 router's computer planned to use only as video recorder, then is good idea to switch off Wi-Fi radios on a board - will be less EM radiation and more power for USB.
Detailed instructions and commands case here.