Optimal way to time lapse with IP cameras?

Support and queries relating to all previous versions of ZoneMinder
Locked
Eklectick
Posts: 127
Joined: Sat Nov 20, 2004 1:12 am

Optimal way to time lapse with IP cameras?

Post by Eklectick »

I am using Axis cams right now but I think finding an optimal setting would actually work with any IP camera (I guess).

I am currently using ZM 1.22.2

The thing is, I am trying to "pull" one jpg from each of my Axis cams every 10 seconds (or for the matter trying to find a setting to pull one frame any user specified number of seconds).

The setting that got my setup going on Record Mode is to set Maximum FPS (MFPS) to 0.10 and Alarm Maximum FPS to 0.10 (Under Monitor - General tab). The obvious one (I think) would be to set MFPS and AMFPS to 1 and Frame Skip (Under Misc) to 10, but doing this actually instructs ZM to capture 1 fps :roll: .

I dont know if there is perhaps a setting I am not aware of to actually tell an IP cam to pull just one (or two or whaterver) frames every 10 (or whatever) seconds.

I bring this up because although I got the cameras to actually capture one frame every ten seconds I feel this not to be elegant, it "feels" like trying to force or fool ZM into capturing one frame by telling it to capture 0.10 of a frame every second :roll: which could cause overhead (which there is none) or perhaps a bunch of other weird errors (that I would like to take care of in another post) and which I think maybe would go away by just plainly instructing ZM to pull just X frame(s) every X second(s) from an IP cam in a more optimal form.

Any ideas?

Regards!
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

So long are you are using a jpg grab and not mpjpg stream, then setting the max fps to 0.1 is the best way to do it. This way ZM does not get more frames than required and there is no overhead as ZM will just sleep in the meantime. The frames are requested at a constant interval, so you can't wait 10 seconds and then get 3 frames and then wait 10 seconds etc.

Using frame skip is the better solution if you want to watch at a higher frame rate than you capture and throw away the unwanted frames.
Phil
User avatar
jacomoman
Posts: 23
Joined: Thu Jan 17, 2008 9:25 pm
Location: Silicon Valley, CA

Re: Optimal way to time lapse with IP cameras?

Post by jacomoman »

If I may offer up an alternative way of achieving time lapse video with ZM... Not that the method you folks have discussed won't work, I'm sure it will, but this, IMHO, is a better of achieving the same ends:

Forget mucking with your cameras or monitor setting in any way. Set up your cameras and monitors to record at their maximum possible frame rates and let ZM do its job to capture JPEGs as normal under the /var/cache/zoneminder/events.

But then you create a script to walk the path under events/ with a start & finish paths, and a frames-to-skip setting to pick off one JPEG, skip however many, then pick off another one, and on and on and on till it reaches the finish path. All chosen JPEGs will be copied to a single output dir. Then once you have a continuous stream of JPEGs in that output dir, you hand the output dir off to ffmpeg to create a video from the JPEG sources.

This way you've held onto the real time (non time lapsed) JPEGs and can always refer back to them if need be, but then you can re-run this script as many times as you want to play with the frames-to-skip setting so you can see the shorter or longer time lapse versions of the same start/finish period.

I created a first version of just such a script and here's the result of it uploaded to my YouTube acct. I'm renovating my house and this is a 2 min time lapse video from 7 hrs of work on the 1st day of demolition.

https://youtu.be/sD7nbU0pNP0

I created it using the exact mechanism I explained above. It's footage from a Vivotek camera set to 1280x720, processing at around 20 FPS. I set a frames-to-skip=80.

I'm now upgrading that script to be much more flexible so that you can give it multiple start/finish paths and you can even vary the frames-to-skip setting per start/finish paths so end video can give the appearance of slowing down and speeding up at various sections of your choosing. It's gonna be so cool!!! :D I can't wait to try it out. I'm about 1/2 way thru writing the bash shell script.

Let me know if you're interested in that that. I can share it in a github repo.

Cheers,
Jac 8)
Falka
Posts: 4
Joined: Sun Jul 31, 2016 6:59 pm

Re: Optimal way to time lapse with IP cameras?

Post by Falka »

Hello!

I'm very intrested in that TimeLapse script. Can you share it? :)
User avatar
jacomoman
Posts: 23
Joined: Thu Jan 17, 2008 9:25 pm
Location: Silicon Valley, CA

Re: Optimal way to time lapse with IP cameras?

Post by jacomoman »

Sorry for the delay in response. Here's the github repo for the ZM archiver/time-lapse utility:

https://github.com/jacomoman/zm-archiver

Hope it's of use to someone. :)
Locked