Streaming only when user is connected

Forum for questions and support relating to the 1.28.x releases only.
Locked
zos93
Posts: 3
Joined: Mon Apr 18, 2016 11:02 am

Streaming only when user is connected

Post by zos93 »

Hi,

is it possible to activate streaming data between camera and ZM only when a user is connected to ZM (Mobile application or Internet browser) ? ZM permanetly retrieves data from my camera and it loads my network (FireWall). My Camera is defined in monitor mode.

Thank you.
biscuit
Posts: 4
Joined: Fri Nov 11, 2011 2:55 am

Re: Streaming only when user is connected

Post by biscuit »

This is the same exact question I asked just a couple days ago. Here's my thread which doesn't have an answer yet.

viewtopic.php?f=32&t=24566

In that thread I've got a link to where someone asked the same question back in 2009 but didn't receive an answer either. I suspect the answer is 'no' though.
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Streaming only when user is connected

Post by knight-of-ni »

All surveillance applications are designed to stream continuously. Event detection is retroactive. Only after the event has already occurred can the system mark it as an alarm. Since no one has invented a time machine yet, the way this is done is by continuously storing a certain number of frames in memory. When an alarm occurs at say frame 1000, it has an earlier frame still in memory, which it will mark as the actual beginning of the event. This is called preroll.

If the system had to initiate the stream first, the event in question would be missed every time because preroll is not possible in this scenario (no time machine).

But wait! You might say. I don't want to do event based recording. I just want to see a live stream. If that is the case, then why are you using ZoneMinder? You would get the same experience by pointing your browser to the camera's web portal. If you have multiple cameras, just create multiple html shortcuts on your desktop/mobile device. Some have even written their own custom montage in simple html for the cameras they want to see.

If you really need/want to use ZoneMinder and not just use the camera's web portal, you should design your system such that you are not streaming continuously through your firewall. You do that by putting the server on the same side of the firewall as the camera. Keep in mind the "server" could be something as inexpensive as a raspberry pi.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
biscuit
Posts: 4
Joined: Fri Nov 11, 2011 2:55 am

Re: Streaming only when user is connected

Post by biscuit »

In my case the system is used in two ways:

First and foremost as a security system. I setup mine specifically so that no pre-event footage is required. A break beam sensor is in place ahead of the desired recording zones. When the beam is tripped it feeds through a GPIO which is watched for changes and through the external triggers starts the recording. This is crucial for me because the environment is harsh which forces me to use low power embedded hardware. In other words I don't have enough memory or CPU cycles to keep the streams open all the time.

The second way it's used is just to check in on things through the web interface at leisure.

Hopefully that shows where these types of features would be nice. A little bit of searching shows that people have looked for it not only in ZoneMinder but in competing products as well. I know Blue Iris supports this option but it's Windows based. ZM is definitely the best product for me I've found so far. If it just did this one thing I would be thrilled.

Thanks,
Rich
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Streaming only when user is connected

Post by knight-of-ni »

biscuit wrote: First and foremost as a security system. I setup mine specifically so that no pre-event footage is required. A break beam sensor is in place ahead of the desired recording zones. When the beam is tripped it feeds through a GPIO which is watched for changes and through the external triggers starts the recording. This is crucial for me because the environment is harsh which forces me to use low power embedded hardware. In other words I don't have enough memory or CPU cycles to keep the streams open all the time.
Unfortunately this is precisely the situation that won't work the way you expect. Your assumption that camera streams can be turned on immediately, like a light switch, is not correct. It takes time to go from off to recording the actual stream, which means the triggering event will be missed by the time video begins writing to disk. This is a function of the camera, not the recording software.

For example, look at what must take place to establish a stream with an RTSP camera:
https://en.wikipedia.org/wiki/Real_Time ... directives

Sure, it happens quickly, but not quick enough.

I haven't used the API yet, but you might be able to test this yourself. Instead of using zmtrigger to trigger an alarm event, use the API to change the Monitor function from None -> Record: http://zoneminder.readthedocs.org/en/st ... -monitor-1
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
biscuit
Posts: 4
Joined: Fri Nov 11, 2011 2:55 am

Re: Streaming only when user is connected

Post by biscuit »

knnniggett wrote:I haven't used the API yet, but you might be able to test this yourself. Instead of using zmtrigger to trigger an alarm event, use the API to change the Monitor function from None -> Record: http://zoneminder.readthedocs.org/en/st ... -monitor-1
Actually, that's a great idea, thank you! I don't know why that didn't occur to me to try out before. It will take me some time to set it up and test it but after I have I'll post back here the results. At least that way anyone searching in the future can see if it will work for them. I feel pretty good about this though...

Thank you again!
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Streaming only when user is connected

Post by knight-of-ni »

I just pinged asker a.k.a. "the guy" who has the most experience with the API, and his mobile app apparently already can change the function of a single monitor via push of a button, so that tells us this part of API does indeed work.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
Locked