Dave’s Motion Stacker


Dave’s Motion Stacker (DMS) automatically detects moving targets in video files and creates movies with fading trails or target collages from them like this.

DMS can work in day mode where it identifies targets that are darker than the background – birds against sky, ants on cement, etc. It can also work in night mode where the targets are brighter than the background – meteors, bats in infrared, lightning, sprites, etc.

DMS outputs a series of PNG image files which can be imported into video editors like ShotCut to produce movies.

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

DMS controls are arranged along the top bar and are designed so your workflow is from left to right. These controls are:-

Convert – Use this button to select your videos and convert them into single frames. You are asked to specify an output directory and DMS will create a timestamped directory starting with “fr” inside this directory. There are controls to skip several frames at the start of each video or to only convert a certain percentage.

Preview – This loads a directory of frames and you can scrub thru them using the long frame slider control. DMS will automatically load the relevant frames after any operation.

B&W – This button converts the display to black and white. Use the threshold slider to adjust the display so that the background is just all white. Scrub thru the frames and check that the background stays white. In night mode DMS will automatically invert the frames so the targets are black on a white background.

Original frame #1126
B&W frame #1126 with threshold = 98

Cull – Once you are happy the threshold is correct for all frames then press the cull button. (Adjust the minimum target pixels box beforehand if you want to ignore smaller targets.) Select the directory to cull and the output directory. DMS will create a timestamped directory starting “cull” and any frames containing targets will be saved there. There is an option box to delete or retain any frames without targets.

Prev/Play/Next/Delete/Renumber – After culling, the target frames will comprise a sequence of frames for each target. You can use these controls to play these target sequences individually and delete them if required. If you delete any sequences you should renumber the remaining frames.

Deinterlace – This only applies to interlaced video and will split each frame into 2 frames – one for each video field. Not needed for modern progressive video.

Add Buffers – This will add a number of blank background frames between each sequence.

Divide – This will divide the frames by the amount in the box below. Useful if your targets are too close together like slow flying birds.

Trails – This will add trails to your targets like so:-

Target Trails

You can select the color of the background, target and trail start and end by pressing the buttons below. You can also select the number of fading targets in the trail.

Make the trail end and background the same color if you want the trails to fade into the background. Choose a different color if you intend to chromakey in a different background in your video editor.

Stack – This will stack all your targets into a collage like so :-

Stacked Collage

The generated frames will start with a blank frame and subsequent frames will have growing numbers of targets. Each target sequence will be a different color if you check the random box. Otherwise all targets will be the target color.

Cancel – Stops the current operation.

Autocull option – Check this box if you want to cull the frames during the conversion step. You should adjust the threshold to the proper value before you convert. I check my videos in VirtualDub by applying a threshold video filter. The slider settings for DMS and VirtualDub are identical. This is useful if disk space is a problem for you.

ShotCut Videos – DMS generates image sequences for its trails and stack output options. These sequences can be imported to ShotCut video editor as video clips as follows:-

  1. Click Open File and select first sequence image and click Open.
  2. Click Properties and tick the Image sequence box.
  3. Drag the clip to the timeline.
 Posted by at 2:43 pm