View Full Version : Extracting the relevant frames from security cam videos


whugemann
16th August 2011, 20:53
Hi all,

I have to deal with security cam videos transferred to "normal" video. The point is that the recordings of a security cam are mostly in propriatory format. When some video evidence is secured, the recording is transferred to MPEG with a constant frame rate, say 25 fps.

The framerate of the security cam is however much lower, typically about 1 fps, and not always constant. It can go up and down, according to the video content or what other cameras have to be served by the recorder.

So what we see is typically a sequence of identical frames, say 15, and than the change to a new frame content, which then stays the same for qite a lot of frames, too.

I would like to extract only the first frame of each of these sequences.

I have come so far that I can write the relevant frame number to a file:

Clip=DirectShowSource("test.mpg")
WriteFileIf(clip,"test.txt","YDifferenceFromPrevious>3","current_frame",append=false)

This is quite helpful, but could I also somehow dump those frames as JPEGs or concatenate them to a new clip?

Wolfgang Hugemann

TheFluff
16th August 2011, 21:38
use dedup, that's what it was made for (well, almost)

whugemann
17th August 2011, 08:08
Thanks, this plugin did the job very reliably!

I appreciate its two-pass approach, so that after the first run I have a quite good measure for the adequate value of my threshold.

The parameter "maxdrops" can however become a problem, as it needs to be less than "maxcopies" which in turn has to be less then 20. For security cams, the number of identical frames cans be even higher than that. But I dump the frames to JPEGs anyway, so I can sort out any remaining duplicates.

The documentation however doesn't tell the meaning of the boolean parameter "blend" (if I didn't overread something). Anyone who has a clue?

Motenai Yoda
18th August 2011, 19:57
blend all frames together instead of copy the last of the drop-sequence

from dup doc
copy (true/false, default true): If this option is set to true, declared duplicates will be replaced with a single copy. If there is a string of duplicates, the last frame in the string is used for all copies. If blend=true, the copy frame will be generated by blending together all the duplicates in the string.

IanB
18th August 2011, 23:11
@whugemann,

You could chain a 2nd dedup, this would cater for up to 20*20=400 duplicates in a row. Of course the job then becomes 3 pass, i.e pass1 dup1, pass2 dup1+pass1 dup2, pass2 dup1+pass2 dup2.