A Python tool that applies the mesmerizing XOR persistence of vision effect to videos. Shapes are only visible while they're moving. Pause the video and they disappear into noise!
This effect exploits how your brain perceives motion:
- Edge Detection: Each frame is processed with Canny edge detection
- XOR Drawing: Edges are XOR'd onto a persistent canvas
- Pixel Toggle: When a pixel is drawn where one exists, it toggles off
- Noise Accumulation: Static areas become random noise patterns
- Motion Visibility: Moving edges remain visible due to persistence of vision
The result: you can clearly see shapes moving, but pause the video and there's no visible shape, you'll just see random dots!
pip install -r requirements.txtBasic usage:
python xor_vision.py input_video.mp4 output.mp4Remove audio:
python xor_vision.py input_video.mp4 output.mp4 --no-audioCustomize the pixel effect:
python xor_vision.py input_video.mp4 output.mp4 --resolution 80x60 --line-width 2White edges on black background:
python xor_vision.py input_video.mp4 output.mp4 --invert| Option | Default | Description |
|---|---|---|
--keep-audio |
✓ | Keep original audio track |
--no-audio |
Remove audio from output | |
--resolution WxH |
160x120 | Processing resolution (lower = bigger pixels) |
--line-width 1-5 |
1 | Edge line thickness |
--max-duration N |
30 | Max video length in seconds |
--fps N |
30 | Output frame rate |
--invert |
White edges on black background |
- Best results: Videos with clear movement and distinct edges
- Lower resolution: Creates bigger, more retro pixels
- Higher line-width: Makes edges more visible but adds more noise
- Invert mode: More dramatic effect, closer to the original demo