4

I have some video files with a reasonably static background and the occasional movement in the scene. I would like to edit down the footage to just the sections with movement in. As there are several hours of footage I would rather not do it by hand.

I hoped to find a script or utility that I could pipe the media into and get segments with motion out the other side. My limited searching has not suggested anything that could do this, unless I can get VLC to use its motion filter somehow to tag things.

I would rather use a free or FOS system, as I am cheap. If that is not an option then I will consider paying. I am happy for the software to be Windows or Linux based. I would rather not dump all the frames as stills, run a diff and re-encode but if that is the only way then I can probably work with that. I can do coding in C, C++, Ruby and a couple of other scripting languages if pushed. I don't mind spending a bit of time to write something if nothing is available and others might find it helpful. I don't have a background in media processing though, so although I understand the concepts I would be rather lost at picking libraries to use as a starting point and so on.

Video is of a bird feeder with a hedge and fence behind it. There is some slow shadow travel as the sun moves but otherwise the background seems stable. I think about 5% of the frame will be filled by the movement I need to pick up on. I only mention that because I have setup ZoneMinder motion capture in the past so I am familiar with its filter settings.

Even if someone cannot give me a complete answer, I would be grateful to some hints, suggestions and keywords that help me carry this forward.

3
  • I would start by researching opencv. Perhaps there is an open-source application that uses it and already does what you want.
    – kazanaki
    Jun 4, 2015 at 7:35
  • Also I think that imageMagick can process video and it includes a diff function that compares too images. Perhaps you can instruct to discard frames where the diff is 0 and keep frames when there is an actual difference
    – kazanaki
    Jun 4, 2015 at 8:07
  • Bit of clicking though lead to something helpful sounding "Look here in order to find use on your video stream algorithms like: motion extraction..." docs.opencv.org/doc/tutorials/video/table_of_content_video/… Sadly it seems there is no tutorial there yet. I'll see about either finding or setting something up with OpenCV though, then maybe add some notes there. Thank you for the suggestion.
    – TafT
    Jun 4, 2015 at 13:52

2 Answers 2

0

There is a similar question in stack overflow

https://stackoverflow.com/questions/28320004/detect-if-video-file-contains-movement

Apart from OpenCV they also suggest SimpleCV http://simplecv.org/ and "Motion" http://www.lavrsen.dk/foswiki/bin/view/Motion/WebHome

1
  • If you add a downvote, at least add a comment on why. Otherwise how can I improve this answer?
    – kazanaki
    Jun 5, 2015 at 22:11
0

I have not tested it, but i believe that it would be possible to do it with select scene change filter of ffmpeg. You can try something like:

ffmpeg -i input.ext -filter:v "select=gt(scene\,0.2)" -c:v copy output.ext

Note that you need to escape the comma, even though the value is in quotes. The second parameter is what you need to play with to determine what you consider to be 'motion'.

I got the idea from: https://www.bogotobogo.com/FFMpeg/ffmpeg_thumbnails_select_scene_iframe.php

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.