We write to the cloud
Initially, CCTV cameras were connected to a computer using a local network. Next, a special software was installed and launched on the PC, which allowed recording video and then saving it to the server. From the moment the cloud began to be used in tracking systems, the task of the organization has been simplified to the maximum.
At the moment, you need to perform the following algorithm of actions that will help you start recording from an IP video camera to the cloud:
- Connect the CCTV camera to the router. The connection can be provided either via Wi-Fi technology or using a cable.
- After downloading a specialized program, you need to set the IP address and device ID.
- Sign up for the right or suitable cloud service.
- Log in to your personal account, in which to enter the necessary identification numbers.
- If everything is done correctly, then the devices will be ready for recording to the cloud.
Cloud for IP cameras
A high-quality cloud for a video surveillance camera allows you to solve many issues and simplify the generation of a tracking system. Today there are a large number of cloud services, and here are the most relevant ones:
- Ivideon. The main advantage of the service is that it can be used in conjunction with CCTV cameras from different manufacturers. At the same time, the recorded information can be viewed on most common operating systems of computers and mobile devices.
- NOVIcloud. Quite a simplified and inexpensive option for owners of cameras and recorders of this manufacturer.
- Spacecam. Allows you to set up work with cameras of the RVi brand. At the same time, it functions perfectly with any modifications of such video cameras.
IP camera tutorial video: How to view live and playback using recording software, NVR
How to record from an IP camera to the cloud?
Data storage systems using servers are very popular in almost any area of business. And the more settlements switch to high-speed Internet, the more often they use cloud technologies. A server located in the cloud allows the owner of a video surveillance camera to save himself from tedious and complex system configuration, as well as to have constant remote access to data from almost any device.
IP Camera with Cloud Recording
A CCTV camera is a digital device that transmits data in a similar format using TokenRing and Ethernet technologies. Compared to analog cameras, IP devices have more advantages, primarily higher resolution.
- wireless with a mobile connection (using 4G, 3G, GPRS);
- wireless with Wi-Fi connection;
- wired using LAN cables.
At the same time, the Internet speed should be much higher in the case when the camera has a high resolution.
Initially, wireless video cameras had the following disadvantage. in order to operate them, it was necessary to acquire a permanent IP address. However, with the advent of P2P devices, this problem has been eliminated. But working with P2P devices also has one important nuance. In this case, the recorded information can be viewed only with the help of a specific cloud service, as a rule, associated with the manufacturer of the video camera.
Features of P2P cameras with cloud recording
This type of CCTV cameras is equipped with special software that allows you to identify the video camera by a special ID number. The undoubted advantage of this type is the ability to connect remotely and use a dynamic IP address.
P2P video cameras can be useful in a wide variety of areas of life:
Due to the fact that the main target audience of such video cameras is ordinary citizens who purchase devices for household needs and at the same time do not have specific skills or education, the manufacturers have simplified all the settings as much as possible. Therefore, self-configuration of the IP camera will take a maximum of twenty minutes.
Any company that manufactures a video surveillance camera with a cloud service offers its own cloud service, if P2P technologies were used in the production of the video camera. This is important so that any user of the system can have full access to the data. Thus, in order to view information from video cameras produced by different organizations, you will need to connect to several cloud services, depending on the manufacturer of the device.
The advantage of cloud cameras
P2P cloud cameras are the most advanced tracking devices. At the same time, any devices that involve the use of cloud technologies can be called P2P, since they have all the same capabilities.
Cameras that work with cloud technologies have an extremely important advantage: they allow you to provide access to video information to a large number of users at once. This option is often used in the tourism sector. In this case, the owners do not use an advertising video, but a live broadcast of a picture from the facility where the vacation is being promoted. This can be achieved through the use of modern tunneling protocols. And the cloud camera can be controlled from any location on the planet.
For a long period of time, Wi-Fi camcorders with cloud recording did not have the ability to record high quality images as soon as dusk fell on the ground. Fortunately, this issue has been resolved in modern modifications. IP cameras now have additional infrared illumination. Thus, the camcorder does not pause at night. In addition, such models have additional protection from external influences, so the camera can work without interruption, regardless of whether a stormy wind blows, it is raining or snowing.
Among the range of modern models, you can see devices with a different set of functions and at completely different prices. Professionals recommend opting for the cloud camcorder that best suits the customer’s preferences, purpose and the list of functions performed. Then you can get the perfect camera model with cloud recording.
IP camera connection
As mentioned above, a simple D-Link DCS-7010L IP camera was chosen for testing. The key selection criterion here was the device’s support for the RTSP protocol, since it is on this that our server will pick up the video stream from the camera.
We connect the camera to the router with the included patch cord. After turning on the power and connecting to the router, the camera took the IP address via DHCP, in our case it was 192.168.1.34 (If you go into the router settings, you will see that the DCS 7010L device is connected. this is it). It’s time to test the camera.
Open the specified IP address in the browser 192.168.1.34 to get to the camera administrator web interface. There is no password by default.
As you can see, the video from the camera is broadcast correctly in the admin panel. At the same time, periodic jams are noticeable. This is what we will fix using WebRTC.
Making sure it’s really WebRTC.
What if we were deceived and the video from the IP camera is sent via HTTP again? Let’s not idly contemplate the picture, but check what kind of traffic we actually get. Of course, run Wireshark and the debug console in Chrome again. In the Chrome browser console, we can observe the following:
This time nothing flickers and no images are seen being transmitted over HTTP. All we see this time are Websocket frames and most of them are ping / pong types to maintain a Websocket session. Interesting frames: connect, prepareRtspSession and onReadyToPlay. this is the order in which the connection to the server is established: first Connect via Websocket, and then request the stream to play.
And this is what chrome: // webrtc-internals shows
According to the graphs, we have 1Mbps bitrate from the IP camera. There is also outgoing traffic, most likely these are RTCP and ICE packets. RTT to Amazon server is about 300 milliseconds.
Now let’s take a look at Wireshark, there you can clearly see UDP traffic from the server’s IP address. The picture below shows packets of 1468 bytes. This is WebRTC. precisely, SRTP packets carrying VP8 video frames that we can observe on the browser screen. In addition, STUN requests are skipped (the lowest packet in the picture). this WebRTC ICE carefully checks the connection.
It is also worth noting the relatively low latency (ping to the data center was about 250 ms) of video playback. WebRTC works over SRTP / UDP, which is the fastest way to deliver packets, unlike HTTP, RTMP and other TCP-like streaming methods. Those. the latency seen by the eye should be the RTT of the browser buffering, decoding, and playback time. Visually, in this case it is. the eye almost does not see the delay, it is less than 500 milliseconds.
The next test is connecting other viewers. I managed to open 10 Chrome windows and each one was showing a picture. At the same time, Chrome itself began to dull a little. When opening the 11th window on another computer, playback remained smooth.
Broadcasting a video stream from an IP camera using WebRTC
Generally speaking, solving the problem of online broadcasting from an IP camera does not require the use of WebRTC. The camera itself is a server, has an IP address and can be connected directly to a router in order to distribute video content. So why use WebRTC technology?
As the number of viewers of an Ethernet broadcast increases, the lack of channel thickness will be felt more and more, and then the resources of the camera itself.
As mentioned above, the IP camera is a server. But what protocols can it use to send the video to the desktop browser? Mobile device? Most likely it will be HTTP streaming, where video frames or JPEG images are transmitted over HTTP. HTTP streaming is not known to be very suitable for real-time video streaming, although it has worked well in on-Demand video, where stream interactivity and latency are not particularly important. In fact, if you are watching a movie, a few seconds delay in the video will not make it worse, unless you are watching the movie at the same time as someone else. “Oh no! Jack killed her! Alice writes in a chat to Bob a spoiler 10 seconds before the tragic denouement “.
Or it will be RTSP / RTP and H.264, in which case a video player plugin such as VLC or QuickTime must be installed in the browser. Such a plugin will pick up and play the video, just like the player itself. But we really need real browser streaming without installing additional crutches / plugins.
First, let’s sniff the IP camera to find out what exactly is sending this device towards the browser. The subject will be the D-Link DCS 7010L camera:
How to Record Footage from Your IeGeek IP Camera to Your Computer’s Hard Drive with HiP2P Client
You can read more about installing and configuring the camera below about Honor, but here we’ll just see what it uses for video streaming. When we enter the camera‘s admin panel through the web interface, we see something like this (sorry for the landscape):
The picture opens in all browsers and jumps evenly, about once a second. Considering that both the camera and the laptop on which we are watching the stream are connected to the same router, everything should be smooth and beautiful, but this is not so. Similar to HTTP. Run Wireshark to confirm our guesses:
Here we see a sequence of TCP fragments 1514 bytes long
and a terminating HTTP 200 OK with the length of the received JPEG:
Next, go to Chrome / Developer Tools / Network and see in real time how GET Requests and images transmitted via HTTP flash:
We don’t need this kind of streaming. Not smooth, jerking HTTP requests. How many such requests per second will the camera withstand? There is reason to believe that at 10 viewers and earlier, the camera will safely bend or start to become terribly buggy and give out slides.
If we look at the HTML of the camera admin page, we will see an interesting code like this:
RTSP / RTP is just what you need for proper video playback. But will this work in a browser? Not. But if you install the QuickTime plugin, everything will work. But we are doing purely browser-based streaming.
Here we can also mention Flash Player, which can receive an RTMP stream converted from RTSP, RTP, H.264 through a suitable server like Wowza. But Flash Player, as you know, is also a browser plug-in, although incomparably more popular than VLC or QuickTime.
In this case, we will test the same RTSP / RTP re-streaming, but a WebRTC-compatible browser will be used as a playing device without any additional browser plugins and other crutches. We will set up a relay server that will take the stream from the IP camera and send it to the Internet to an arbitrary number of users using browsers with WebRTC support.
Recall that the structure of our WebRTC broadcast is as follows:
We have already installed the main elements of this diagram, it remains to establish the “arrows” of interactions.
The connection between the browser and the WebRTC server is provided by the web client, which is available on the github :. A set of JS, CSS and HTML files is simply uploaded to / var / www / html at the installation stage (see paragraph 9 above under the spoiler).
The interaction between the browser and the server is configured in the flashphoner.xml XML configuration file. There you need to enter the server IP address so that the web client can connect to the WebRTC server via HTML5 Websockets (point 9 above).
This completes the server setup, you can check its operation:
Open the index.html web client page in the browser (for this, the Apache was installed on the same Amazon server with the yum.y install httpd command):
Here webrtc-ipcam.ddns.net is a free domain obtained through the dynamic DNS server noip.com, which links to our external IP address. We told the router to forward RTSP requests to 192.168.1.34 in accordance with the NAT rules (see also above).
Parameter ID = rtsp: //webrtc-ipcam.ddns.net/live1.sdp specifies the URL of the stream to be played. The WebRTC server will request streams from the camera, process them and give them to the browser for playback via WebRTC. Your router may support DDNS. If not, then the IP camera itself has such support:
And this is how DDNS support looks in the router itself:
Now you can start testing and evaluate the results.
As a result, we were able to launch WebRTC online broadcasting from an IP camera to multiple browsers with minimal effort. No dancing with a tambourine, no rocket-science required. only basic knowledge of Linux and SSH console.
The broadcast quality was acceptable, and the playback delay was invisible to the eye.
Summing up, we can say that browser-based WebRTC broadcasts have a right to exist, since in our case, WebRTC is no longer a crutch or a plugin, but a real platform for playing video in a browser.
About WebRTC on mobile devices
As you know, WebRTC is supported by Chrome and Firefox browsers on the Android platform.
Let’s check if our broadcast will be displayed there:
In the picture of the HTC phone, the video from the camera is displayed in the Firefox browser. There are no differences in the smoothness of playback from the desktop.
First, we disable authentication in the camera settings. as part of testing, we will send the stream to everyone who asks. To do this, in the web interface of the camera, go to the Setup. Network settings and set the value of the Authentication option to Disable.
In the same place, we check the value of the RTSP protocol port, by default it is 554. The format of the video being sent is determined by the used profile. In the camera, you can set up to three of them, we will use the first one, live1.sdp. by default it is configured to use H.264 for video and G.711 for audio. You can change the settings if necessary in the Setup. Audio and Video section.
Now you can check the operation of the camera via RTSP. Open VLC Player (you can use any other one that supports RTSP. QuickTime, Windows Media Player, RealPlayer, etc.) and in the Open URL dialog set the RTSP address of the camera: rtsp: //192.168.1.34/live1.sdp
Well, everything works as it should. The camera correctly reproduces the video stream in the player via the RTSP protocol.
By the way, the stream is played quite smoothly and without artifacts. We expect the same from WebRTC.