This tool takes a folder of sequential PNG frames (e.g. extracted from a video), detects per-pixel movement between consecutive frames, and renders a “motion ghosting” visualization as output frames you can stitch back into a video.
- Movement pixels reset their “age” to 0.
- Non-moving pixels accumulate age each frame.
- Output color is based on age (a heatmap-like HSV mapping), producing a ghosting trail effect over time.
- Python 3.9+ recommended
- Dependencies:
numpyPillow(PIL)
Optional (recommended for video workflows):
ffmpegavailable on your PATH
Install Python deps:
python -m pip install numpy pillowCreate a folder
mkdir framesSplit your input video into frames
ffmpeg -i input.mp4 -vsync 0 frames/frame_%06d.pngProcess the frames
python motion_ghosting.py --input frames --output output --fps 60 --fade-seconds 1 --pad-digits 6Merge processed frames back into a video
ffmpeg -framerate 60 -i output/output_%06d.png -c:v libx264 -pix_fmt yuv420p output.mp4