Image injector

Steve2381

Senior Member
Hey all.
Not sure if this even counts as a Picaxe project... but you guys are the ones to ask.
I have a customer with an NVR controlling their CCTV system. They have several unused POE ports on the back of the machine, which then leads to blank images on the main viewing screen (no combination of screens works to not show a blank input).
They have asked if its possible to make a small device that will pull their company logo or text off an SD card and simply display it on the spare channels. Nothing moving, a simple still image.
It must be possible.... but how?
Its going to need some kind of conversion to access the network. I also imagine it going to need to provide an ip address for the NVR to allocate it to a channel?
Not a simple project I fear, but interesting.
Maybe well outside the realms of a Picaxe however.
Any suggestions gratefully received!
 

inglewoodpete

Senior Member
You're right: a PICAXE would not be able to help you deliver a solution.

Expenses aside, the ideal solution would be to have a software solution that takes a image (Eg. jpg or bmp etc) and simulates the function of an IP camera. There may even be suitable software out there but I'm not aware of what would be called.

A cheaper solution may be to get a $25 IP camera and point it at the image you want to use as a 'filler'.
 

hippy

Technical Support
Staff member
A PICAXE might be able to do it. Or more correctly be at the heart of a mainly hardware solution controlling that.

It would all depend on what the camera to NVR protocol was. If it is one way only, just the image wrapped in an some sort of framing bytes, you might be able to have a large memory which can be clocked through to bit-bang out an entire full frame of data.

You could possibly use a cheap FPGA to handle the hardware side of things interfacing between memory and the bit-banged output.

If the protocol were more complicated you might require a PC or SBC to do it.
 

hippy

Technical Support
Staff member
I had always meant to take some time to look at how video streaming works. Well; it's a whole lot of stacks and protocols piled on top of TCP/UDP. Even down at the basic RTP and RTCP protocol level, which is the equivalent of sending out a single frame of video, it's not that simple.

Your best best would likely be some sort of Linux SBC which has RTP streaming software. Something 3.141592653-ish would probably be a good place to start.

That might be able to stream a static image from a file, and turning that image into a short video which can be looped should be possible, and shouldn't be too large either given every frame is the same as the last. I'd have a look at how to stream colour bars or testcard as a start.

Then there's networking to the NVR. No idea on that but probably easy enough to try using any test video file.

I think it could be done and might not be too hard, just having to determine the 'how to'. Probably best to see what protocols and video codecs the NVR supports or requires before getting too committed. Finding someone who actually is into streaming would probably help.

Another option is for them to buy more cameras so there are fewer blanks.
 

Steve2381

Senior Member
Yes... this might actually be an interesting little project.
Basically in these big hotels we install cctv in, they have their very large monitors set up with 25 images (5x5). If there are only 19 cameras for instance, then they want to fill the blank 6 channels with a hotel logo.
The next screen option down is 16 (4x4).
We can set the framerate to 1 per second, so refresh of the image should not be an issue. Same goes for resolution... it will find and set that up for you.
I was thinking of the new Raspberry Zeros, but I have not used those, so that is another hurdle to overcome.
I think some Chinese Ebay network breakout boards, hours of Googling, a beer and a fire extinguisher are in order
 

hippy

Technical Support
Staff member
I was thinking of the new Raspberry Zeros
I would start with one which has an RJ45 ethernet connector on. A "B+", new or second-hand from CeX or ebay, would be my choice. Same CPU as a Zero and it will be much easier to set-up and use. The gstreamer software you would need works on that.

It should be possible to configure with multiple IP addresses so you could have one cable to a hub and feed it to all blank inputs so only one per installation needed rather than one per faked camera.

Get gstreamer set-up, find how to view it on a PC, and you are probably three quarters of the way there.
 

Steve2381

Senior Member
I feel guilty for discussing 'non Picaxe' now....
I just dug around in the workshop and found an old Arduino Uno with Ethernet shield that has never been used. Even has an SD card slot on it.
Found some code that lets you enter the ip address of your Ethernet shield in the code, and then write directly to the screen on that web address (change the screen colour etc - basically loads an HTML page).
So, in theory... without getting too far ahead of myself. If the NVR is only taking a snapshot of the image every 1 second (its minimum sampling level), I might be able to get it to issue the same text to multiple ip addresses in a sequence before the refresh comes around again. Not sure if any of that would work.
Then.... really getting ahead of myself, it would be nice to lift a low resolution JPEG off the SD card and display that. Trouble is, they are usually pretty slow to load.
Fun times ahead
 

lbenson

Senior Member
I found this CCTV R-Pi guide very easy to follow: https://randomnerdtutorials.com/cctv-raspberry-pi-based-system-storage-motioneyeos/

I got a wireless pi-ZW feeding to a pi3 hub (with Ethernet) very quickly, and was able to feed the hub with non-pi network streaming devices as well (openWrt pogoplug and dockstar). Don't know how your integrating controller works, but pointing an R-Pi with camera at a fixed image should be do-able for not much more than $25 U.S.
 

premelec

Senior Member
FWIW how about an optical solution... basically put an image in front of each camera ... could even have a camera ID on it... don't know what it would have to look like in a physical part... need to consult optical engineer... ;-0
 

inglewoodpete

Senior Member
FWIW how about an optical solution... basically put an image in front of each camera ... could even have a camera ID on it... don't know what it would have to look like in a physical part... need to consult optical engineer... ;-0
The planets seem to be aligning:rolleyes:. All of the responders (#4, #8 and #9) to Steve's question seem to be suggesting what I suggested 24 hours ago in post #2: point a cheap IP camera at a logo image (and point the NVR slot at the IP address of the camera). Some of the suggestions do add a bit more complexity and sophistication, though.
 

hippy

Technical Support
Staff member
Pointing an IP camera at a logo should work. The downside there is having to build a rostrum and potentially provide lighting. A self-contained digital system is more aesthetically appealing and easier to deploy.

The biggest issue with a digital system is probably not the hardware but the protocol, generating the right packets to send, There are a number of RFC's which describe the protocol so what needs to be send could be figured out -

https://tools.ietf.org/html/rfc3550

With that figured out, anything with an ethernet interface and enough memory to hold the image payload could probably be used to do the job, even a PICAXE.

But rather than having to figure it out it is easier just to 'stand on the shoulders of giants' who have already done that and provide ready to use software. It seems to me to potentially be a lot of effort just to re-invent a complicated wheel.

I suppose it depends on whether one is wanting a solution or wanting to get deep into the bowels of video streaming.
 

Steve2381

Senior Member
Hmm. Yes, I could buy some dirty cheap Ebay cameras. stick them in a rack module pointing at an illuminated 'photo' of a logo. Doesn't seem very high tech however :confused:
I am Googling with vengeance here
 

Steve2381

Senior Member
We use Chinese CCTV stuff, and they plaster their logo over the spare channels. Already discussed it with them and they won't allow us to replace that logo. Shame - simple solution!
 

Jeremy Harris

Senior Member
We use Chinese CCTV stuff, and they plaster their logo over the spare channels. Already discussed it with them and they won't allow us to replace that logo. Shame - simple solution!
You may well be able to hack the firmware. I've seen this done before, the key is to gain access to the code it's running (odds on it's Linux) and then find where those image files are, see what their pixel dimensions are, and replace them with your own images of exactly the same dimensions.

I've got a Chinese generic network camera system with a recorder, and inside the recorder there is a hidden serial port, that allows access for a terminal. The hard part is finding the default username and login password, but I found that someone else had found these out and posted them on one of the CCTV forums. I wasn't looking to change the logo on unused channels, but to change the split screen layout so that I didn't have any blank windows, but the principle is the same. I logged into the box, using the terminal, and with a few Linux commands found the config file that was used to set the number of screen windows (plus loads of other stuff). Editing this (as superuser - sudo) and saving it resulted in the box using the configuration I wanted the next time I booted it up.

As a precaution, it's wise to make a backup copy of any file you change, before doing so.

I can't point you in the direction of a source for info on your particular system, but can say that it seems that a lot of these Chinese made recorders use the same, or very similar, hardware and firmware. All I can suggest is an in-depth search for info on some of the CCTV forums.
 

Steve2381

Senior Member
My only issue would be these are high end NVR's. Hacking into them is going to invalidate the warranty and boss-man isn't going to like that.
We install these systems in posh London hotels. They are the ones asking for their logo on the spare pages.
Its not the end of the world, but it is an interesting little project I thought I would have a bash at. Probably fail.... but you never know.
Been searching around to find any information on how the NVR decodes the data, perhaps find a chip that would be useful in decoding etc.... nothing yet
 
Top