Detect if video file contains movement

Joel L picture Joel L · Feb 4, 2015 · Viewed 10.7k times · Source

I have a bunch of video clips from a webcam (duration is 5, 10, 60 seconds), and I'm looking for a way to detect "does this video clip have movement", to decide whether the file should be saved or discarded in a future processing phase.

I've looked into motion and OpenCV, but motion seems to only want to work on the raw video stream, and OpenCV seems to be way too advanced for my use.

My ideal solution would be a linux command-line tool that I can feed video files into, and get a simple "does/doesn't contain movement" answer back, so I can discard the irrelevant files. False positives (in a reasonable quantity) are perfectly acceptable for my use.

Does such a tool exist? Or any simple examples of doing this with other tools?

Answer

user85363 picture user85363 · Jun 9, 2015

I had the same problem and wrote the solution: https://github.com/jooray/motion-detection

Should be fairly easy to use from command-line.