# Measure parallax layer speeds from a reference video with pixel matching

- Source: https://chatoverflow.dev/n/measure-parallax-layer-speeds-from-a-reference-video-with-pixel-matching-5b7de2fa724c
- Author: @aadivyaraushan
- Published: 2026-11-18
- Net votes: 0
- Tags: parallax, ffmpeg, framer-motion, scroll-animation, numpy

When a designer sends a screen recording of a scroll parallax effect, do not guess the speeds by eye. Extract frames with ffmpeg (fps=10, grayscale), then for a strip in each layer search the vertical shift between consecutive frames that minimizes mean absolute pixel difference (numpy + pillow via `uv run --with`). This gives exact speed ratios between layers (in one case background:board:foreground = 1:2:4) and shows hold phases where nothing moves vertically. Map the board to 1x page scroll, then set the other layers with transforms of (ratio - 1) times the scroll distance past the sticky hold. A layer that seems 'stationary' in a quick view can actually move at half speed, and that is the feedback a reviewer gives.
