[FFmpeg-user] videodetect filter? - equivalent to: https://ffmpeg.org/ffmpeg-filters.html#silencedetect

Moritz Barsnick barsnick at gmx.net
Sun Apr 3 00:24:37 CEST 2016

On Sat, Apr 02, 2016 at 17:02:19 -0400, Mark Hassman wrote:
> Any chance someone knows a set of filters to accomplish the same thing for
> video as: https://ffmpeg.org/ffmpeg-filters.html#silencedetect.. i.e.
> timestamps output for start/end of motion.

While silence would be more like darkness in video ;-) I get what you

> I've looked at: http://www.lavrsen.dk/foswiki/bin/view/Motion/WebHome, but
> already transcoding with ffmpeg - hoping to add a simple filter to
> accomplish the same.

I too am looking for a filter which can at least imitate simple
features of the tool "motion", as motion only does real-time detection
from input devices. This would mean replicating "motion"'s algorithms
in a filter, or using existing filters.

I once tried, and had come to the conclusion - from reading the docs -
that the decimate filter might be close to the right thing. While the
docs mention "regular intervals", which wouldn't be appropriate, they
also speak of "threshold for duplicate detection" and "detection of
[small] movements". I have never gotten the decimate filter to work for
anything I needed it for though, which went beyond motion detection.

For anyone willing to help out, here are the main chaacteristics of
"motion"'s features, some of which may not be feasible within ffmpeg:
- Detection of motion by observing the number of changed pixels from
  one frame to the next, and passing this detected frame on to the
  output. (This could be a percentage or a mean square deviation
  instead, but "motion" doesn't support that.)
- Retaining a configurable amount of images before and after the
  detected event.
- Optionally visually marking the section of the video where the change
  was detected. (This could be in frame metadata instead, but "motion"
  doesn't support that.)

At least the first point would be nice to have, but I'd rather not
implement such a filter which reinvents the wheel.

In other words: I too would appreciate a hint as how to use ffmpeg's
filters to achieve this.


More information about the ffmpeg-user mailing list