- a Wi-Fi router with a LAN port for the bridge, in this case TP-Link TL-WR841N (D) V. 10,
- the camper's NAS,
- the camper's router.
The IP camera has an image processor inside that does a lot of work with the data and then broadcasts the video over standard RTSP Protocol. As a result, the devices that receive this video may be without a powerful processor. To utilize this advantages, the settings (resolution, frame rate, etc.) of the camera and the streaming from It must be configured in the camera and must not be changed in the devices receiving this video. These parameters, as well as the IP address of the camera (it should be a single IP address in the camper’s local network), login and password, synchronization of the camera time with the computer, automatic restart, are easily set in the local network with ONVIF Device Manager.
Ideally, it should be wired connected the IP camera directly to the camper’s router (switch), if possible to organize wires inside the camper. When not - It is possible to transfer the stream from the IP camera via Wi-Fi and this case is described here. But one of the drawbacks of this case is that it is needed to reboot the camera router and then the camera itself, at any time, if the camper’s access point (router) reboots.
Streaming from the IP camera will be available on the camper's local network by IP. Video recording (archive) will be stored in the camper’s NAS and will also be available.
If the IP camera has no Wi-Fi on a board, then need a wireless Wi-Fi router with LAN port for wireless connection. In this case, the cheapest TP-Link TL-WR841N(D) v.10 router was used with flashed OS OpenWRT.
To configure the wireless bridge in TP-Link TL-WR841N (D), it was connected to a Windows PC via the RJ45 patch cord. The PC has been with IP 192.168.0.66 to the wired LAN. The web face of the TP-Link was on IP 192.168.0.1 through the browser.
In some cases will need switch off the PC firewall while this settings.
Then a new password for the administrator (root) was set.
Then in System.System menu the "Hostname" of the router was set.
Two relay packages must be installed for OpenWRT. It is easy to do with the help of WinSCP on PC. In WinSCP, a connection was established to the TP-Link router via SCP protocol by host name (IP), port 22, root username and password.
The "relayed" package was installed first on the System.Software web interface of the router. The path to the package file must be entered manually full using /tmp. Like this example: /tmp/relayd_2016-02-07-ad0b25ad-2_mips_24kc.ipk
The "luci-proto-relay" package was installed second on the System.Software web interface of the router. The path to the package file must be entered manually full using /tmp. Like this example: /tmp/luci-proto-relay_git-18.320.63580-3787301-1_all.ipk
Both of these packages files have been removed from the /tmp folder of the router because the router does not have so much memory.
In the Network.Wireless menu was pressed the "Edit" button next to the "OpenWRT" wireless controller.
Then was changed the "ESSID" to "CA-Bridge1", was selected "Channel" auto. On the "Wireless Security" tab, was selected WPA2-PSK and installed Key. Then was clicked "Enable wireless network", "Save and apply".
Then in the Network.Wireless menu was clicked "Scan" next to the icon "radio0".
Then was clicked "Join network" next to the camper's wireless AP (in this case "CA-AP"). Then was set the password WPA for camper's wireless AP, inner OpenWRT name (in this case "wwan") and was selected "lan" in the field "Create/assign firewall zone", then was click on "Submit".
In the Network.Interfaces menu, was selected "Add new interface".
Then was set the name of the new inner OpenWRT interface (in this case "ca_ap_bridge"), was selected the "Relay bridge" protocol, then was "Submit".
Then was clicked both "lan" and "wwan" in the "Relay between networks", and then with "local IP" blank was "Save & Apply".
In the Network.Firewall menu must "accept" the forwarding for "lan" (with "wwan") under Zones, must check on "Drop invalid packets", then "Save & Apply".
Then was power off the TP-Link TL-WR841N (D), disconnect it from the PC used for setup, then was connected the IP camera to the TP-Link TL-WR841N (D) LAN port and was power turn on both devices.
All next settings were made via Windows PC. In some cases will need switch off the PC firewall while settings.
From the PC was login as root in the camper’s NAS via PuTTY by NAS IP over port 22. Then was command:
In the open file, the full path of access to the NAS shared folder (in this case, CA-NAS-shfld) from any NFS client within camper’s network found. In this case, it was /export/CA-NAS-shfld.
In the NAS shared folder, it was necessary to make a folder to archive video from the USB camera. Here the camera/folder name was outer_cam_01:
Then the FFmpeg package was installed within the NAS computer:
apt-get install ffmpeg
Whereas in this case:
- camera IP 192.168.1.10,
- the user name of camera is admin without a password,
- the frame rate of RTSP streaming from the camera is 17 (the best choice is not to change the frame rate further as the camera resolution),
- the duration of the video for recording - 2 minutes,
commands were entered in the PC terminal:
# in this case, "Joe's Own Editor" was opened
# the following line gives the command every 2 minutes to record 118 seconds of the stream from the camera to a file with the current date and time in name
*/2 * * * * ffmpeg -i rtsp://192.168.1.10:554/user=admin_password=tlJwpbo6_channel=1_stream=0.sdp?real_stream -r 17 -t 118 -vcodec copy /media/58DA9B27DA9B0084/CA-NAS-shfld/outer_cam_01/`date +\%Y\%m\%d\%H\%M\%S`.avi > /dev/null 2>&1
# the following line gives the command every 6 minutes to delete the oldest files in the folder when the folder size exceeds 20000 MB
*/6 * * * * while [ $(du -sm /media/58DA9B27DA9B0084/CA-NAS-shfld/outer_cam_01 | cut -f1) -gt 20000 ]; do rm -f /media/58DA9B27DA9B0084/CA-NAS-shfld/outer_cam_01/"$(ls -1c /media/58DA9B27DA9B0084/CA-NAS-shfld/outer_cam_01/ | tail -n1)";done > /dev/null 2>&1
# and at least one empty line should be at the end of the file!
Streaming from the camera can be opened, for example, in VLC player by URL: rtsp://192.168.1.10:554/user=admin_password=tlJwpbo6_channel=1_stream=0.sdp?real_stream
The camera archive is located in the cmaper's local network /CA-NAS/CA-NAS-shfld/outer_cam_01/, has up to 20,000 MB of archives for 2 minutes, each of which has the date and time of the recording.