@nogthree and I have been talking cameras, quite a lot.
We run these cheap as hell aliexpress cameras, and their software is both seemingly powerful but totally laughable.
We have a zoneminder instance but it requires serious hardware and hence power usage to record streams. Every ZM alternative is a paid product and not exactly leaps and bounds better.
We could try and invest in hardware decoders and all sorts of malarky but lets leave that for a more desperate hour.
The goal is to enable the lowest power method of scaleably consuming the data from these cameras.
So last night we tried using the motion capture alarm feature to start a snapshot per second feature on the camera, which it ostensibly uploads to our ftp server. This feature works, sort of. It uploads jpegs that are 500kb of nothing but zero’s. So thats what I mean by powerful but useless. Lots of features but in true china fashion nothing really works properly.
So that would have been the most scaleable as the cameras would have been doing the bulk of the work. No matter.
Next thing I tried was querying the cameras with a node script I whipped up.
var
http = require('http'),
Cam = require('onvif').Cam;
new Cam({
hostname: "10.0.1.122", // green room camera
username: "foo",
password: "bar"
}, function(err) {
this.getStreamUri({protocol:'RTSP'}, function(err, stream) {
console.log(stream)
});
this.getSnapshotUri({}, function(err, snapshot) {
console.log(snapshot)
});
// This throws an exception :/
/*this.getDeviceInformation({}, function(err, response) {
console.log(response)
});*/
});
executed with: node script.js
This gives you some output like
{ uri: 'rtsp://10.0.1.122:554/ucast/11',
invalidAfterConnect: false,
invalidAfterReboot: false,
timeout: 'PT60S' }
{ uri: 'http://10.0.1.122:80/cgi-bin/anv/images_cgi?channel=0&user=foo&pwd=bar',
invalidAfterConnect: false,
invalidAfterReboot: false,
timeout: 'P1Y' }
So that is quite interesting. The rtsp stream can be opened in vlc but quickly crashes. Some googling seems to indicate that cameras change their framerate depending on light or something and that makes vlc very sad.
The take snapshot url seems to work pretty darn reliably, at least on some cameras.
So the other thing to look into is command line consumption of the rtsp stream in some way that doesnt die. I started this but my laptop ran out of battery about this point.
Some tabs of mine while researching this:
ZoneMinder/Client.pm at master · ZoneMinder/ZoneMinder
sigrand/OpenONVIF
https://github.com/sigrand/OpenONVIF
onvif
ip - Open source code exists for ONVIF video stream on camera side? (not client side) - Stack Overflow
openRTSP
http://www.live555.com/openRTSP/
linux - Capture RTSP stream from IP Camera and store - Super User
ffmpeg - How to dump raw RTSP stream to file? - Stack Overflow
osx - How can I record an rtsp video stream to a file from a linux command line? - Stack Overflow
video - rtsp stream capturing - Stack Overflow
Erlyvideo
Also, looking into playing with motion. No research there just yet.
Goals
So, the plan is to hopefully to figure out the lowest load way of putting interesting (ie movement) camera data in a format thats a nice tradeoff between the cost of power to compress and the cost of storage in s3, into an s3 bucket with some sort of easy library browsing interface on top. I’m confident I can knock up an interface quick enough, and throwing this stuff on s3 is super easy. The main issue is figuring out how to stably grab data from these cameras.
Stay tuned. If you want to help @nogthree and myself work on this little project, shout out