The most budgetary video surveillance in the country

    Hi Geektimes! I want to share my experience in organizing a very low-cost video surveillance in the country with 3G with the ability to view online and save the archive.

    Since I had never encountered video surveillance before, I decided to start with a simple one - buy only one 2M camera and then test it and see what comes of it.

    I read reviews on the internet, my choice fell on This copy of Chinese production. The device broadcasts on rtsp 1920 * 1080 with compression h264 main stream and 540 * 340 second stream.

    image

    When buying a device, I suggested that I would find a program for recording video from a camera without problems, even under Windows, even under Linux. In life, everything turned out to be much more complicated.

    I had a computer with Intel Pentium D (2 core), 1 GB RAM, built-in vidyuha, 250 GB hard. At the time of receipt of the camera, I lived on this old PC windows XP x86.

    Also there is a whistle of MTS (at the dacha catches 3G), there is a hosting with a VDS server. It’s clear that with such baggage you can’t talk about high-quality video surveillance, but you have to start with something.

    So, I started home tests. The first thing that came to mind was to try the well-known ivideon service .. We quickly register, set the softink, one, two or three everything is ready, convenient and simple. It is a pity that such a service imposes significant restrictions on free use, in principle it is possible to live, but not conveniently. The saddest thing is the huge amount of data transmitted over the outgoing uplink, for 3G it is a bit much, you need a good Internet, but it will not and will not.

    ZoneMinder

    Once upon a time, we put this software at work, the impression is very good, many settings work well.

    Unfortunately, it didn’t come to the installation of this software, because, according to people familiar with the situation, the service was very demanding on resources and could simply not fly up on my old computer, and I didn’t want to reinstall Windows. Left in case of emergency, if I can’t find anything suitable.

    Axxon next

    Apparently a harsh software for harsh companies. In the free version up to 4 cameras and no more restrictions. In test mode, all the functionality with all cameras, writes only from 8-00 to 20-00 (or what).

    Honestly, the usability of the program is very inconvenient, but yes figs with it, get used to it. Faced with problems: He writes the video in one archive in his own format - the video cannot be obtained just like that, it doesn’t work on rdp (opengl> 1.4 is required). The last 4th version does not work in HP wines, the third one works, but, damn it only from the console, it will not work on the radio frequency control.

    Xeoma

    Softina installed on old iron, it worked.

    image

    In general, software is not very convenient, but you can get used to it, a matter of time.

    From the "constructor" you can collect different circuits, logic, add some handlers, actions when any event occurs. But all this makes no sense in the free version, where only 3 modules are available (there are already 6 in the paid cheapest version of these modules). One of them is a camera, one archive entry. You can screw a motion detector, but unfortunately this is not my case - the iron will not pull out, it will not be viewed online (more on this later - it was decided to issue a static picture on request, and not drive all the traffic to the Internet).

    For me, it was also useful to be able to edit the frame rate on the screen. Since uplink is not fast for rdp + 3g, issuing a real picture simply puts the channel on the dumb. In software, I set the output to 1 frame per minute, you can set another, more often / less often

    FFMPEG

    The latest working version of ffmpeg for Windows XP is here .

    In general, it is very nice when the process is fully controlled, but you need to write a lot of things yourself. Reconnect, rotation, check for freezing, etc. I didn’t really want to write myself. And here is a command that can be useful to capture a stream and write to a file:

    D:\ffmpeg\ffmpeg -i rtsp://192.168.1.10:554/user=admin_password=tlJwpbo6_channel=1_stream=0.sdp?real_stream -reset_timestamps 1 -vcodec copy -acodec copy -y  -f segment -segment_time 60   -segment_format mp4 "d:\Xeoma\video\vid-%%05d.mp4"
    

    Sadness longing with software gentlemen. Sadness ...

    But let's go back to the scheme for including all this disgrace and see what principle we want and what we can do?

    We have: 3g whistle. In fact, all mobile operators have not provided dynamic IPs for whistles for a long time, but give out gray addresses and tension. Get through the Internet to a computer with 3G is possible only through vpn.

    But we want to make everything cheaper. Which tariff to choose? Which operator to choose (catches 3G at my dacha for all operators - was lucky)? There is no desire to pay 600r / month for the whistle. I looked at the tariffs of all operators - approximately all have the same thing.

    The solution was simple. It turns out that my MTS has the option "Share an Internet" or something like that. The point is that you pay 100r per month and share your Internet on a tariff with a different number. This is the path I went.

    Setting up a vpn server on debian is very simple .

    In the BIOS of the computer, we set auto power on when power is returned, set up the MTS connection through standard means (like a dial-up modem with a call to * 99 #) and configure raising the VPN after raising the MTS connection. DONE! There is a connection, VPN holds. You can work.

    To administer the server, it is enough to connect the server tunnel through the ssch to port 3389 (rdp) and there is no need to expose 3389 from the vinhp out with port forwarding through hosting.

    Since it was decided that we would not unload the entire archive, the question remains - how to organize an online viewing.

    I did like this:

    On a computer with Windows, I set the main stream record continuously, and an additional rake every 30 seconds. This is done in order to quickly find the interesting approximate time section, and then slowly and slowly pull the video files over 3G. Apache installed on the server, php set it on the directory with the video photo and turned on the option to index the contents of the directory.
    On the hosting hosting (where we connect via VPN) we configure port forwarding:

    ProxyPreserveHost On
    #ProxyRequests Off
    ProxyPass / http://192.168.1.30/
    ProxyPassReverse / http://192.168.1.30/

    Where 192.168.1.30 is the address we received on pptpd.

    To display files from the stream, I chose this concept:

    Online we will grab one frame from the additional stream as below 2MP. To view the picture in high definition, configure the rotation of the main stream files once a minute (then it will also be easier to download files) and we will capture the frame from the last completed video. Thus, the maximum lag of HD pictures will be 2 minutes, which, in general, is normal.

    To get a snapshot from a video file, use the following php code:

    shell_exec ("D:\scripts\convert.cmd $file");

    Well, the very process of getting a snapshot:

    D:\ffmpeg\ffmpeg -y  -loglevel 0   -i %1 -ss 00:00:1.1 -r 1 -vframes 1  D:\Xeoma\last.jpeg
    

    Total cost:

    - Camera 2500
    - Internet 100r / month
    - Computer consumption of electricity 24/7 = 100W * 24 * 30 * 4r / kWh = 288r / month
    - Old computer (was available) = 3000r
    - VDS Hosting with the possibility of receiving vpn (was) = ​​2400 / year
    Probably can not be cheaper :)

    I hope this article will be useful to someone

    Also popular now: