Ubiquti CCTV in Dashboard simple solution

Hi
I recently got a few Ubiquiti CCTV cameras and wanted to display the video on the Dashboard, I'm aware that this subject has been covered before however I didn't really want to use any other software to handle the RTP stream
Since the cameras support snapshot view whereby you can grab a still frame from the camera URL I thought that I might try to use this to simplify the process
The code below will allow "streaming" directly into the Dashboard without need of VLC or other software. The frame rate can be tinkered with but 15 fps is not too bad.

I created a UI template for each camera and modified the IP address as necessary

You'll need to change the IP address to your camera IP and ensure that "snapshot" is enabled in camera settings
It may work for other CCTV camera manufacturers if they support snapshot or still's

Maybe someone will find it of some use should they want a lightweight solution to incorporate their CCTV in the Dash

Thanks

<!doctype html>
<html>
    <head>
        <meta charset="utf-8">      
        <title>Image Refresh Two</title>
    </head>

    <body>

    <!-- Get the initial image. -->
    <img id="frameT" src="http://192.168.0.240/snap.jpeg">

    <script>        
        // Use an off-screen image to load the next frame.
        var imgT = new Image();

        // When it is loaded...
        imgT.addEventListener("load", function() {

            // Set the on-screen image to the same source. This should be instant because
            // it is already loaded.
            document.getElementById("frameT").src = imgT.src;

            // Schedule loading the next frame.
            setTimeout(function() {
                imgT.src = "http://192.168.0.240/snap.jpeg?" + (new Date).getTime();
            }, 1000/15); // 15 FPS (more or less)
        })

        // Start the loading process.
        imgT.src = "http://192.168.0.240/snap.jpeg?" + (new Date).getTime();
    </script>
    </body>
</html>
2 Likes

Tell me more about these cameras. The way your display works makes them very efficient for using with my Python "AI person detector"

How much do they cost? What is the pixel resolution of the snapshots?

I used to think 720p or 1080p would be about the maximum needed, seeing how the image is resized to 300x300 for the Ai inference. I was shocked to see the detection performance improve significantly when I got a 4K UHD camera -- improvement was so dramatic I've replaced the six most important views with them (prices have dropped dramatically $60-80).

is that '(prices have dropped dramatically by $60-80'
or 'prices have dropped dramatically to $60-80'

if it's to $60-$80 - where?

"analog" 4K cameras;
Costco has had the Lorex UHD cameras" on sale" for ~$80 that go with the Lorex UHD system they sell.
Amazon has these (that work with the Lorex UHD DVR for $55 (still need cable and 12V 1A supply)
https://smile.amazon.com/Amcrest-UltraHD-Security-8-Megapixel-AMC4KBC36P-W/dp/B07NVXSP8Q/ref=pd_bap_rp_1/136-4787334-8734742?_encoding=UTF8&pd_rd_i=B07NVXSP8Q&pd_rd_r=5db26bbc-feae-4fe1-bf8b-38a0e57a3eee&pd_rd_w=ESKTY&pd_rd_wg=s86Pt&pf_rd_p=e2d77b61-80b7-48a5-b680-e33621bc18ff&pf_rd_r=0K55BR4NXPJ2ATCZDY7X&psc=1&refRID=0K55BR4NXPJ2ATCZDY7X

For Netcams Amazon has these for $80:
https://www.amazon.com/dp/B07Z7C1RD3/ref=sspa_dk_detail_4?psc=1&pd_rd_i=B07Z7C1RD3&pd_rd_w=GCKDi&pf_rd_p=45a72588-80f7-4414-9851-786f6c16d42b&pd_rd_wg=pKGJI&pf_rd_r=W8TCD8WW7D4WFGP844TB&pd_rd_r=11c58464-f425-475f-8119-90c32df498d2&spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUE0QkIzV1lOQVVFR1kmZW5jcnlwdGVkSWQ9QTA5ODg3MzIxVVlOMzNRRTVOT1FQJmVuY3J5cHRlZEFkSWQ9QTA2MjU4MTIxTU81VTlXTFZXSjZZJndpZGdldE5hbWU9c3BfZGV0YWlsJmFjdGlvbj1jbGlja1JlZGlyZWN0JmRvTm90TG9nQ2xpY2s9dHJ1ZQ==

A nice 4-port POE switch for ~$31:
https://www.amazon.com/BV-Tech-Switch-Ethernet-Uplink-Function/dp/B075G2PM17/ref=pd_rhf_ee_s_rp_c_0_11?_encoding=UTF8&pd_rd_i=B075G2PM17&pd_rd_r=26fc1344-fb92-4ce2-80c7-5b4cd91abf7c&pd_rd_w=I9WIT&pd_rd_wg=gunTv&pf_rd_p=ca87eff0-8f0b-4d91-98c9-5392e1c880ff&pf_rd_r=DVKQXH5BA84JSV6Z2QMX&psc=1&refRID=DVKQXH5BA84JSV6Z2QMX

The downside is the Pi4 can handle maybe two UHD rtsp streams, but can do 4 or more 1080p streams.

The Pi3B+ can handle 6 Onvif snapshot camers but I haven't found many "Onvif Snapshot" camera that delivers the full resolution. I found one that is looking good in my testing giving full 1080p snapshots, but its not POE, for $38 at Amazon. but more are not available at the moment :frowning:

I'm working on some recommendations for when I update my GitHub with my latest Python AI code and node-red controller-viewer.

1 Like

Hi

The cameras I use are Ubiquiti UVC-G3-AF

The snapshots are 1080p

The Ubiquiti cameras are expensive at around Ā£130 each or $170 each in the UK when compared to other brands

Thanks

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.