Dave’s Motion Detector

 
Sample output from Dave’s Motion Detector

Dave’s Motion Detector (DMD) is a robust motion detector for analysing videos to extract action scenes. I have tried for years to write an automatic version but it could never cope with changing light, moving background or other distractions. DMD instead relies on the human eye which is remarkably efficient at recognising small changes to a scene.

DMD works by presenting a grid of video thumbnails on screen. The user can see at a glance where an event occurs and can click to mark the in and out frames for each event. DMD then generates a ShotCut video file comprising all events with an optional dissolve between them.

This may seem a long winded approach but it has some great advantages:-

  1. No false positives or missed events – ever.
  2. User can select only events of interest – e.g. only robins at bird feeder.
  3. Human eye is fantastic at spotting movement.
  4. User can ignore events – e.g. rain on lens, etc.
  5. Hours of video can be analysed in a few minutes.

DMD is still in development but a free, fully functioning test version is available here.

Preparation – Set your camera to record video continuously and then transfer these video files into a dedicated folder on your PC.

Create Thumbnails

DMD Generate Thumbnails

Adjust the frames between thumbnails entry to suit your videos. Reducing the number of frames between will result in more thumbnails to view but will be more accurate. 1 thumbnail per second of video is a good starting point.

The shrinkage entry determines the size of the thumbnail on disk. A setting of 4 means the thumbnail width and height will be 1/4 of the video frame size.

Click the Generate Thumbnails button and select the videos to process. You can display the thumbnails as they are generated but this slows down the process. You can also cancel at any time.

The thumbnails will be stored in a folder called “thumbs” inside your videos folder.

Analyze Videos – Once your thumbs are generated click the Analyze tab and then the Load Thumbs button. DMS will then display the first page of thumbs. You can adjust the number of rows and columns to suit.

You can move between the pages of thumbs using these keyboard shortcuts:

  • Next page = Space or Page Down or Down Arrow
  • Previous page = Page Up or Up Arrow

The thumbs are arranged from top left to bottom right. When you see an event, left-click on the thumb immediately before it. The thumb will be outlined in green and show the event number.

Left Click on In-Frame

Right-click on the thumb immediately after the last thumb of an event. It will be outlined in red.

Right Click on Out-Frame

You can review your events using the left or right arrows or Next or Previous buttons to move between events. Left clicking on a green thumb (or right-clicking a red) will delete that event.

The Load ShotCut Events button will load the events from an existing ShotCut file which you can then edit. Re-save your new events using the ShotCut tab.

ShotCut Videos – Click the ShotCut tab to show the ShotCut video editor options. You can set the number of frames to add before or after each event as well as the number of frames to dissolve between each event.

ShotCut options

Once you are happy, click the Create ShotCut File button to save the file. The file name will consist of the video folder name plus the number of events plus the ShotCut variables you chose. You can also edit an existing DMD ShotCut file using the edit button.

In ShotCut you can click Open File to load all the events and dissolves. ShotCut sometimes stumbles with huge files but restarting it usually solves the problem. You can also click File>Open MLT XML as clip to load the file as a single clip. This is easier if you want to add filters.

Note that DMS autosaves a ShotCut file called “0temp.MLT” as you analyse your thumbs which you can use as a recovery backup.

Tips and Tricks

  • Set up your camera so the background is not too cluttered to make it easier to spot events.
  • Manually focus your camera on the target location so the lens doesn’t hunt for focus between events.
  • Analyze your thumbs on a giant TV so you can get hundreds of thumbs per page.
  • Use an SSD for faster thumbs loading.
 Posted by at 12:26 pm