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. If not - it's possible to transfer the stream from the IP camera via Wi-Fi (even if the camera does not have its own Wi-Fi module) 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 it needs 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 utilized with flashed OS OpenWRT.
To configure the wireless bridge in TP-Link TL-WR841N (D), it was connected to a Windows PC via the RJ-45 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 to 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 (to "CA-Bridge" in this case), and "Sync with browser" next to "Local time" was clicked.
Two relay packages should 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 it changed "ESSID" to "CA-Bridge", "Channel" to auto, "Network" to "lan". On the "Wireless Security" tab, was selected WPA2-PSK and installed Key. Then "Enable wireless network", "Save and apply".
Then in the Network.Wireless menu was clicked "Scan" next to the icon "radio0".
In the next tab were changed "Channel" to "auto", "ESSID" to "CA-APR", "BSSID" to blancked, "Network" to "lan" and to "wwan". Then "Save and apply".
(optional) In Network.Interfaces menu, was selected "LAN", and in opened tab were added custom DNS servers
Then "Save and apply".
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 were clicked both "lan" and "wwan" in the "Relay between networks", and then with "local IP" blank was "Save & Apply".
In the Network.Firewall menu was clicked "Add" for the new firewall zone.
In next tab were changed "Name" to "brgzone", "Forward" to "accept", "Masquerading" to On, "MSS clamping" to On, "Covered networks" to "ca_ap_bridge" and to "lan" and to "wwan", then "Save & Apply".
The TP-Link TL-WR841N (D) was powered off, disconnected to the PC used for installation, then the IP camera was connected to the LAN port of TP-Link TL-WR841N (D) and there was power on both devices.
All next settings were made via Windows PC. In some cases will need to 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 opened file, the full path of access to the camper's NAS shared folder (in this case, CA-NAS-shfld) from any NFS client within the camper's network was found. In this case, it was /export/CA-NAS-shfld.
In the camper's 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:
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 from PC via PuTTY 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!
From this point, the 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 camper'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.
Created with Mobirise - Click here