Posts in "General"

How to get your old analog AHD / TVI / BNC CCTV cameras working with Blue IRIS 5.

The aim of this blog post is to run through an easy and cost effective way to get any existing BNC / Analogue CCTV cameras you may have hooked up and working again with Blue Iris.

I put this blog post together primarily because I was unable to find a similar one that already existed. Although you could figure this all out on your own with a few hours of forum/blog trawling and a fair bit of tinkering – I suspect most people would rather save themselves an evening & avoid some of the guess work in terms of what equipment to order.

To be clear – If you’re setting up a new CCTV install, I’d strongly recommend just buying some IP cameras instead as the resolution & clarity will be much higher. The hookup has great reviews on some decent POE IP Cameras. https://www.youtube.com/watch?v=xg3krwlX4jk

On the other hand if you have a load of already wired up and connected old school CCTV cameras that you’d like to bring back to life, either for convenience, or just because. Read on.

What I’m working with

  • I have a blue Iris 5 setup on a windows PC, already connected up with a few IP Cameras.
  • I have 4 “swpro-735cam” cameras mounted around the outside of the house, relics from an old installation before I moved here.
  • The BNC/Power cables for the cameras are all sat in my hall and easily accessable.

My Goal.

Get the existing 4 Swann cameras working again and have them visible in Blue Iris without spending too much money.

My plan of attack to solve this is to use a cheap DVR, and get that to stream the footage straight up to Blue Iris. Although specific RTSP/BNC video encoders etc exist, all the ones I came across were massively more expensive than a cheap DVR.

The DVR.

In my case I bought a “ANNKE CCTV DVR” (this one to be exact). So far as I can tell most other models appear to be almost identical – at least on the hardware side – so my choice of going with Annke was mostly just because I recognised the brand name.

The exact model I ended up with was a  DN41R which set me back around £40.

The setup was fairly straight forward. I attached a temporary VGA monitor, the mouse included in the box then power it up and connected the 4 BNC cables to the back (ensuring the cameras were all powered). You will have to run through a quick setup wizard, involving setting up some passwords and secret questions for the DVR. After that you should hopefully see your cameras on the screen assuming they all work.

If it asks, its also worth telling it you don’t want to run the wizard on startup, as the camera streams appear to hang when this is open & I don’t plan on leaving a screen attached.

It is also worth just pointing out, you don’t need a harddrive in the DVR for any of this to work, so mine remains empty.

Getting the DVR streams working.

The next step is to get the DVR outputting some the RTSP streams that we want to feed in to Blue IRIS.

  1. First off, I connected the Annke DVR to my network with the ethernet cable.
  2. Step 2 was to open up my router control panel & grab the DVR’s IP. (This was pretty painless as it supports DHCP).
  3. Browsing to the IP, you can then login to the web control panel – which is surprisingly nice looking despite the cameras not working in it (I wasn’t willing to install the plugin, but you don’t need them to set this up).

As an optional extra, I also added the DVR to my firewall list along with my other IP cameras to block it accessing the internet directly.

With luck, you should now see something along the lines of the above. If you want to have a quick test of the streams, you can actually access them straight away via RTSP using your admin credentials – although I’d recommend setting up a “Media user” and connecting with that instead for the proper set up.

For now you can poke the below in to VLC (via Open network stream) and check it works.

rtsp://username:password@{dvr-ip-address}/h264/ch1/main/av_stream

To add the Media User, head in to the configuration tab, open up Network, Advanced settings and on the final tab on the right “Integration protocols”.

On this page you can create your media user (with access level media user), then tick the enable ONVIF button. After saving this the DVR will want a reboot. Not 100% what enabling ONVIF actually does apart from opening up another rtsp stream at :

rtsp://username:password@{dvr-ip-address}/Streaming/Channels/101

Although this is the stream I’ve chosen to use in my Blue IRIS setup. While you are in here it may also be worth turning off platform access & https if you don’t intend to use them.

Before we start adding the streams to Blue IRIS it is also probably worth tweaking the configuration of the camera’s themselves a little.

On mine (As seen above) I enabled WD1 (which is the 960H resolution), selected to only stream Video rather than audio as well. I also lowered my frame rate to 15 (optional) and checked h.264+ on.

At this point I’d suggest using the “Copy to” button to set all the camera’s up the same way, then hit save. It may want to reboot again after this.

Available Streams.

The DVR appears to support two differnt RTSP stream urls, although the feeds coming from both appear to be much the same.

rtsp://username:password@{dvripaddress}:554/h264/ch1/main/av_stream

Breaks down in to /{codec}/ch{camera-id}/{stream}/av_stream

  • Format (so far as i can tell it ignores this)
  • Channel (ch1 – ch4 or more if you brought a DVR that supports more cameras)
  • Stream (main, sub)

See the official support article for more info https://help.annke.com/hc/en-us/articles/360000252622-How-to-view-the-camera-on-VLC-player-by-RTSP- 

rtsp://username:password@{dvripaddress}:554/Streaming/Channels/101

Which breaks down in to /Streaming/Channels/{camera-id}0{stream-id}

Ie. the sub stream for camera 4 would be /Streaming/Channels/403

Blue IRIS.

After all that, we can finally start adding the cameras to Blue IRIS itself, which is fortunately really easy.

  • Open the new camera dialog.
  • Add the IP and the media users username & password in the boxes then hit “Find/inspect…” to check it’s happy. It should select the Generic/Onvif setup for you.
  • In main stream, add the RTSP path to the camera you want to add, ie. “/Streaming/Channels/101” 
  • Untick “Send RTSP keep-alives” (See troubleshooting)
  • Then hit okay and you should have your camera working! 

While your here its also likely worth setting the Direct to disk & hardware encoder options if you have these available.

You should now just run through the above steps for each camera you want to add (just incrementing the camera-id number as you go).

Success

With a bit of luck, you should now be done and happily viewing your old BNC connected cameras in Blue IRIS (Even if the quality is sadly pretty potato compared with newer IP cams).

If you are still having issues with the camera feeds, I’ve documented a few of the key problems I encountered getting everything running smoothly. The above instructions with luck will have prevented you ending up with any of them, but on the off chance they haven’t, I’ll detail them below as well as what ended up solving them for me. I suspect of the time spent setting this all up, 90% went in to debugging the below “fun”.

The Cameras keep dropping out & resetting?

Initially i thought this was due to the DVR being under-powered and wasted a ton of time trying different media encoding, frame rates and settings. 

As it turns out for some reason the DVR really does not like RTSP keep-alives. Having this enabled resulted in the cameras stopping after 5 or so seconds, then getting rebooted by watchdog. Since I turned this off they have been running fine.

Error: 80002745 (Socket error: 10053) 0

This is a weird one and only seemed to pop up when I was using the none H264+ encoding. I originally thought it was a Blue IRIS issue with the stream (as VLC worked fine on my desktop). Turns out some odd authentication hi-jinx were at play – as I eventually noticed VLC also didn’t work if I attempted to open the stream on the PC running Blue IRIS. 

Oddly it started working again as soon as I logged in to the web admin panel for the DVR from that PC – although often dropped out again not long after.

After disabling the keep alives, switching to h264+ I’ve not seen this happen. Although while attempting to work this out I did end up making a number of other changes. I don’t think any of these were what solved the issue, but on the offchance one of them was, the other things i attempted were;

  • Disabling timeout on login (done from within the DVR’s local UI)
  • Upgrading the DVR firmware.

If you need to upgrade your firmware, you can grab it from here: https://help.annke.com/hc/en-us/articles/900000011006-Firmware-upgrade (Just load it on to a USB, then use the built in upgrade function under Maintenance on the local UI – the web version appeared broken for me).

If your DVR is the same as mine you will need to upgrade to the 20190401 version, rather than the latest 20190505 – as this version is apparently too large for the DVR and thus won’t allow itself to be installed.

The DVR camera page, the 960×576 isn’t an option.

Its possible that your camera doesn’t support it, but in a lot of cases it may just be that the UI hasn’t correctly refreshed the options in the drop down. I found that by swapping to “camera 2” in the drop down at the top, then back to camera 1, the correct values got populated.

Also ensure that W10 is enabled and has been saved + you have refreshed the page after doing so.

PJAX-Standalone version 0.6.0 released

As the first major bit of work I’ve done on PJAX-Standalone (Pushstate AJAX) in quite some time (aside from the occasional bug fix), version 0.6.0 of PJAX-Standalone includes a totally overhauled demo site (saving future PJAX uses from the horror of encountering my design skills), in addition to the bug fixes, code tweaks and features I was initially planning.

Key changes include:

  • Updated docs & demo
  • Options to enable/disable autoAnalytics and returnToTop
  • Universal Analytics support
  • Access to request information in callbacks via event.data
  • Fixes for title handling & control click not working

A fuller list of changes found in the new version can be found in this github pull request.

The new and improved PJAX-standalone sample site is also now live.

By Carl on January 30th, 2014 in General

PHP Secret Santa

Secret Santa ScreenShot

PHP Secret Santa

After a few years of neglect I decided it was about time I gave my ageing PHP Secret Santa App a bit of an update.

The original, having been the result of a spur of the moment, hacked together reaction to the idea of running a CS Secret Santa between my friends (way back when in my second year of UNI), was as you may have guessed a pretty crappy implementation. The code was awful and the word awful just doesn’t capture just how bad the UI really was. Despite this, I’ve still somehow ended up running the script almost every time Christmas rolls come around.

My newer version of the script functions, effectively, the same as my original. Rather than taking the more common approach of putting the names in to two arrays, shuffling one, then joining em back together until no one ends up with themselves, I decided to stick with my original “names in a hat” style algorithm. Mostly just for nostalgia value. The implementation effectively mirrors its real world equivalent, with each user taking their turn to grab a value from the “hat” (array of users who need gifts buying from them)  and putting it back and taking another if they happen to get themselves. This continues until every user has someone to buy for. The one flaw with this plan is that when the final person comes to pick, if it so happens that the only person left in the “hat” is themselves, there a little stuck. My solution to this problem was essentially just to make them swap with another user. Which so far has worked pretty well 🙂

Once everyone has been assigned someone to buy for, the next step is just email everyone telling them who they have. It may not be the shortest, simplest or most straight forward solution, but I quite like it either way.

The next step of the Rebuild was to try and create a “slightly” nicer looking UI, although due to my terrible design skills I’m not sure how successful this was, but on the bright side, I found an excuse to make a JavaScript Add User button.

As normal the code can be found on my github or you can use the live version here: http://userbag.co.uk/labs/santa/

Please feel free to ask questions, point out bugs/flaws or even just use the script for your own Secret Santa’s.

JSnip 0.5, a Portfolio Section and a little blog optimisation.


A Photo I took in Sloveina!

Sloveina

As a result of a holiday in Slovenia (obligatory photo to the right), being a little busier than normal at work and a hint of having nothing interesting to post it appears it’s actually been quite a while since I last updated my blog.

My solution as you may have noticed is this somewhat rambling posting purportedly providing interesting information and such.

Probably the most interesting update to the estimated two people that actually read this blog is the release of my latest version of JSnip. The new version includes with it an array of bug fixes and a brand new LightBox Snippet, along with a rather snazzy little zoom animation to go with it. As always you can get the full code on Github and check out the new features on the sample page.

Probably less interesting would be the fact I finally got a more or less functioning version of my portfolio page on-line (minus quite a few projects I lack pictures for). The best part of this being my site is now finally free from those pesky “coming soon” pages, and that I’ve also found somewhere to dump a little feed from my github.

Least interesting of all, but probably still quite a nice change for anyone who actually views these pages is that the blog should now be loading signifcantly faster thanks to the addition of WP Super Cache. (Previously page loads were taking a good ice age and a half which was kinda ridiculous)

P.S. Click the Holiday Image to the right to see the new JSnip Lightbox in action.

Recent Stuff

Since I couldn’t think of anything in particular to Blog about, I thought I may as well quickly try and summarise all the random bits and bobs I’ve been working on and hacking at over the past few months.

A Javascript Game

JavaScript Game Screen Shot

JavaScript Game

Prior to starting this little project the closest thing I’d ever created to an actual game was a text based World of Zull mod as part of my Degree’s java module. Despite this I had always wanted to try my hand at creating  a simple game and thought now was as good a time as any to have a go. Since I knew so little about creating games I opted to try and do it in a language I was relatively comfortable in, JavaScript. The added advantage of this also being that anyone with a modern web browser would be able to play it without the worry of having to install anything extra. Since my main aim with this project was to learn exactly how to create games myself, the whole thing is built in pure self coded JS, without the aid of any pre-existing game building frameworks.

The game itself is more or less an asteroids style space shooter, except with a infinite-ish game-play area (something that proved far more challenging than i had originally envisioned due to the need to unload and reload star fields in order to prevent browsers slowing to a halt.) To simplify the code i created a basic javascript inheritance mechanism and a number of distinct objects to manage the different elements of the game, star fields, your ship, enemy ship’s the HUD etc. The majority of the GUI consists of DOM elements absolutly positioned relative to a central div, with the ships drawn with the HTML 5 canvas API.

Over all the most challenging aspects of the whole endeavour proved to be coming up with a relatively accurate collision detection mechanism that wouldn’t bring browsers to a crawl.

The game can be played online from my (still in development) website Thybag.co.uk‘s holding page – although my latest collision detection algorithm has yet to be added to the live version.

An Updated version of the Magic Framework

Screenshot of Magic Layout

Magic V2

The new version of magic was written partially in response to working on a reasonably large CakePHP project and wanting to get a better understanding of  how MVC pattern PHP frameworks really work. Additionally it provides me with a nice starting point for small projects in which I want to use the MVC design pattern, yet want to avoid the overhead associated with many of the larger PHP frameworks (Since they are often significant overkill for a lot of  smaller projects).

The new version is a ground up rewrite including;

  • Ultra Light MVC framework, with a router and fully PHP enabled Views.
  • Database managed via PEAR
  • A set of base modules to provide all the functionality needed for a basic user system.
  • New default theme
  • Basic templating support

Since the new version of magic was originally developed as an independent side project it’s currently still within my own local SVN repository rather than the google code project. Once I get it to a usable state I will overwrite my now defunct Google code copy with the new one.

DIY Uber Desktop

Picture of DIY desktop stack

Uber Case

Since space is hard to come by in student accommodation, I spent a weekend on a DIY project to try and make better use of mine. Using a load of scrap wood, screws and a small tub of black paint a few friends (Ryan and Amy) and I set about constructing a custom container for my working desktop, gaming desktop and server pc (Which both runs my Minecraft server and streams my media around the house). In addition is also provides me with an extra shelf and somewhere to fit the switch, wireless router and external hard-drives.