ZoneMinder / zmNinja

High performance, cross platform ionic app for Home/Commerical Security Surveillance using ZoneMinder
http://zmninja.zoneminder.com
Other
1.02k stars 271 forks source link

Email notifications with animated GIF attachements #225

Closed sambul13 closed 8 years ago

sambul13 commented 8 years ago

On Windows, only ContaCam can save and email small anim GIFs generated from a series 20+ of images taken at motion detection event, while larger MP4 videos of detected events are stored locally or later uploaded to FTP server. No such program offers this feature in Linux and Mac.

Emailing anim GIFs is much more suitable than a series of JPEG snapshots. Anim GIFs can be easily created with FFMpeg, ideally with a running Date & Time stamp overlay.

At least two approaches can be use for that:

  1. Convert a series of JPEG snapshots to a small anim GIF like here. This thread may also help.
  2. Convert just captured and saved MP4 video to anim GIF like here. Higher quality can be achieved with this technique.

Once generated, the anim GIF can be sent by zmNinja with a notifiication email instead of JPEG images.

pliablepixels commented 8 years ago

Hi a few notes:

  1. zmNinja is a client side app. Encoding images to animated GIFs or videos is an extremely CPU intensive operation and there is very limited support on a device (such as a phone) to do this. Encoding with the likes of ffmpeg should be done on the server side - and ZM does already convert images to video (export to video function). There are some very limited libraries available to convert images to animated images for devices but they are also very CPU intensive
  2. ZM is working on releasing video support in version 1.30 - a lot of work has already gone in. Once this is out, it will eliminate this need.
sambul13 commented 8 years ago

Thanks for your prompt reply. I do realize that znNinja is a beautiful (!) and brilliant client app. I just found it and tested on Windows desktop and phone, and can't find any features related to email notifications - not GIF encoding, but simply setting such ZM config from a client, and also viewing such anim GIFs stored on the server. For home surveillance tasks its critical that evidence was kept outside of premises, and web mail server is one such option. But zmNinja currently doesn't seem to allow to set it on ZM server remotely, despite such option is currently available in ZM for MP4 videos.

Also, while ZM is working on H264 Video Storage, it doesn't address the task of creating animated GIFs. In fact, H264 video storage in ZM is viewed as recording stream straight from source cams with low CPU use. But (!) surveillance videos must have Timestamp overlay, and that makes it quite difficult to avoid re-encoding task, so may be unacceptable for ARM boards like Raspberry, since FFMpeg hardware accelerated encoding is not implemented for most GPUs.

Hence I doubt, animated GIFs by email feature will be eliminated by introducing H264 video storage support in ZM, unless you explain how exactly? :) As well, if you test ContaCam, it creates animated GIFs with extremely low CPU overhead, and does it at the same time with creating MP4 videos of the same motion detection events. These anim GIF attachments from several cams are instantly received by a remote web mail server with 5 sec delay.

pliablepixels commented 8 years ago

Hi,

a) ZoneMinder detects events, not zmNinja. zmNinja simply uses the API to report events (in other words its a consumer of ZoneMinder events). Given that, you should be using ZoneMinder to send you emails with images. That functionality already exists - please see filters in ZoneMinder. zmNinja being a client app should not be the one sending emails as that is a server functionality.

b) With respect to H264 and animated GIFs,as far as timestamp goes, all security cameras have their own timestamp option as well to consider that gets encoded into the pass through video, so you should always be able to use that if re-encoding is not possible (like in rPI). Either way, this is not something a client app should do - it should be something the server does. So if a pass through video already has a timestamp, I see less use of an animated GIF. One could always come up with examples of when it may be useful, but I think it will not be the norm with most people as browsers allow for native video playback, as do phones. Animated GIFs are also typically larger in size than a comparative video of the same duration with h264 compression

I think you are considering a situation where zmNinja is running on a desktop (powerful) and ZM is running on a low powered device. In such a situation one could consider zmNinja to have more power than ZM, but that is not the typical intention of zmNinja - its meant to be a consumer of ZM data and the usual expectation is ZM will be running on something more powerful.

sambul13 commented 8 years ago

Thanks for your explanation, it clarified many points I raised. Still, am I right that zmNinja can be viewed and used as a remote configuration app for ZM server? And the target audience of zmNinja is home video surveillance users, not businesses? In that capacity, while no video encoding is expected from zmNinja, it at least should allow to configure email notification feature of ZM server among other features it can access. As well, it should allow to play animated GIFs stored on the server just like it allows to view still images now - would you agree with that? :)

Also, apart from zmNinja functionality, motion events can be quite lengthy, hence resulting in large MP4 files. Animated GIFs in contrast allow to squeeze the entire event into a small file with series of representative images that can be auto chosen at certain time intervals to show the entire event dynamics.

pliablepixels commented 8 years ago

Still, am I right that zmNinja can be viewed and used as a remote configuration app for ZM server?

Yes, with caveats. zmNinja is not intended to be a full fledged replacement to the web console. Its primary goal is to be a mobile app on the go, that's how I started it - and it focusses on what users might want to do from a mobile. The fact that it runs on a desktop was a convenience - I spent a day researching and figured out since its a web app, I could also package it for desktops- but it isnot a primary goal. I know there are several folks who are using zmNinja as a replacement, which I like, but to be honest that was not the initial goal at all (and is not as of now too). The problem is the moment people use it on the desktop, they wonder why they can't do things one can do in the web console. The reason for that is the web console is written in php - it has the benefit of running heavy server queries at the server end, while zmNinja uses APIs exclusively - data is processed and executed client side. In the specific situation of zmNinja running on a powerful desktop, I could do everything one could do in the web console, but that takes away from the primary goal of zmNinja - to be a mobile app.

In that capacity, while no video encoding is expected from zmNinja, it at least should allow to configure email notification feature of ZM server among other features it can access.

If I rephrase that to - "Should zmNinja be allowed to configure & view filters that are are provisioned in ZM" ? Then the answer is Yes. But it doesn't today - see mobile goals philosophy and 'not console replacement' philosophy above

As well, it should allow to play animated GIFs stored on the server just like it allows to view still images now - would you agree with that? :)

Yes, if ZM created animated GIFs. It does not. If you are writing a script to do it, its specific to your use. If I were to add it, it would only work for your install. So if you want to contribute a PR that creates an animated GIF in ZM and the ZM devs merge it, I'll add the view capability to zmNinja

sambul13 commented 8 years ago

Thanks again. I do understand your view on zmNinja purpose and also its perceived limitations. However, I disagree that animated GIFs are good only for my own install. Unless MP4 files are sent as a series of small video clips each covering small part of events, animated GIFs sent by email and covering the entire event would benefit every ZM user, not just me. ContaCam proven that.

If you look at successful company approaches like Opera browser, they always strive to keep Opera accessible to all client categories, since ALL use desktop or laptop and mobiles interchangeably, so using zmNinja on laptop will further promote its downloads from mobile stores - the same familiar app for the surveillance task on any hardware. Given the fact that ZM server web console can't come close to zmNinja beauty and convenience for home users, pls consider that most ZM home users would gladly replace the console with zmNinja on any device if possible, thus contributing to your company success and grows. And for that it should allow access to configuring such features as email notifications. :) Thanks again for this excellent app.

pliablepixels commented 8 years ago

Thanks - glad you like the app.

I didn't say animated GIFs are not useful - I said if you convince ZM devs to add animated GIFs, I'll support playing them back in my app