ability to rerun a video through detection process

Anything you want added or changed in future versions of ZoneMinder? Post here and there's a chance it will get in! Search to make sure it hasn't already been requested.
Post Reply
turboc
Posts: 3
Joined: Fri Jan 18, 2019 7:12 pm

ability to rerun a video through detection process

Post by turboc »

I'm trying to work on my motion detection settings. I have grown tired of tweaking the settings, walking to the camera on the other side of the house, walking around to trigger alarms, going back to my PC to see if the correct alarms triggered, rinse and repeat. It would be really nice if I could record a video that had the motions and light effects that impact motion detection and be able to run that video through the detection engine repeatedly to see how tweaks on the motion detection settings impact the alarms generated. Think of it as a test camera. Now that I think of it, can I generate a video through record and pass it back in as a file input repeatedly?
User avatar
snake
Posts: 337
Joined: Sat May 21, 2016 2:20 am

Re: ability to rerun a video through detection process

Post by snake »

One way to do this: Setup ffserver to serve up an RTSP stream of a video. Have ZM connect to the stream.

Something like this:
https://stackoverflow.com/questions/374 ... h-ffserver
You'll want to loop the video file - that might be another ffserver setting.
Alec
Posts: 52
Joined: Thu Aug 17, 2017 3:55 am

Re: ability to rerun a video through detection process

Post by Alec »

If you are using ffmpeg I think that you can simply use a file for the source path, e.g. "file://home/xena/test.mp4"

FWIW, I found this buried in another post, tried it on my install, and it works for me, but beyond that, I'm useless on this topic.
DFU
adrianmay
Posts: 4
Joined: Sun Apr 19, 2020 6:58 am

Re: ability to rerun a video through detection process

Post by adrianmay »

Massive upvote for this.

The situation is actually more tedious than turboc describes - if you want the settings to work day and night, it will take many days to get them right.

It's assumed that everybody will set up zones and tweak their params. If you can't perform that obligatory task without rigging up some external way of fooling the SW, then it's lacking.

Anyway, the workaround assumes you can capture those videos. I can't, because the passthrough isn't working. That's another issue, but this workaround sets up a dependency where there should be none and asks extra technical knowhow of the user.
Knaldgas
Posts: 3
Joined: Sun Sep 27, 2020 10:46 am

Re: ability to rerun a video through detection process

Post by Knaldgas »

I support this too, it would really help getting better settings.

Two suggestion on how this may be implemented:

Single video:
  • Collect a series of clips from the camera, some that you would like to cause alarm, and some which should not.
  • Assemble them into one video file.
  • Assign the video file to the relevant Monitor, as a test-file (local path to file).
  • Within the Filter page, the test can be executed, using the same blend and filter settings as the live monitor.
  • Initially the results can be just as on an ordinary event, flagging alarm frames, etc. - Later we can probably come up with some smarter way of validating.
Multiple clips
  • Register a path to a directory for should-alarm-videos for each monitor.
  • Register a path to a directory for should-not-alarm-videos for each monitor.
  • As you find clips that should be included, add them as a separate video file in the corresponding directory.
  • Within the Filter page, the test can be executed, using the same blend and filter settings as the live monitor.
  • The test will then run each of the video files in the two directories, pass the test if all detects as required.
As everything is frame-based, the tests can be executed as fast as the server can keep up (possibly limit to one CPU).

The idea is that it is fairly easy to collect a bunch of should-alarm and should-not-alarm clips - which actually are good test-scenarios.
It is then possible to tweak settings until your tests passes.

Frankly, this could be a command-line tool:
  • One tool to get the relevant configuration parameters from a live Monitor and save it in a file for tests.
  • Another tool to run a set of frames (or video file), outputting statistics, annotated frames(?) and alarm-state given a configuration.
then it would be pretty trivial to make the above...
User avatar
burger
Posts: 390
Joined: Mon May 11, 2020 4:32 pm

Re: ability to rerun a video through detection process

Post by burger »

I would vote that ZM make only one long video from multiple videos. E.g. you can specify a sequential date range, and then output one encoded .mp4 file. This is actually possible now with some scripts on the forum to do timelapse (for jpeg files), though I haven't tried it.

The rest could be handled by other tools, avoiding the need to cathedralize zm. i.e. ffserver can stream the video repeatedly, and then you can do any necessary detection on that stream.

See viewtopic.php?f=38&t=28230
Probably all that is needed is for someone to update this script for mp4 (maybe it will just work if you s/jpeg/mp4/g), post a working config for ffserver, and that should suffice. Looks like jpeg is covered.
fastest way to test streams:
ffmpeg -i rtsp://<user>:<pass>@<ipaddress>:554/path ./output.mp4 (if terminal only)
ffplay rtsp://<user>:<pass>@<ipaddress>:554/path (gui)
find paths on ispydb or in zm hcl

If you are new to security software, read:
https://wiki.zoneminder.com/Dummies_Guide
Post Reply