One Python class to cure shaky-cam footage
This package wraps OpenCV feature tracking into a single class that smooths jittery footage from files or live streams, with hooks for custom frame-by-frame processing.

What it does
python_video_stab is a thin, practical wrapper around OpenCV that smooths jittery video. It tracks keypoints across frames, estimates motion, and warps each frame to cancel out camera shake. You hand it a file path or a live stream, and it hands back stabilized frames.
The interesting bit
The core algorithm is lifted straight from a classic Nghia Ho blog post (and a comment by someone named koala), so the project is less about inventing new math and more about packaging it for real use. The author added the boring-but-useful bits: configurable borders to hide black edges, frame layering for trail effects, and a frame-by-frame API that lets you inject your own computer vision logic mid-pipeline.
Key highlights
- Single
VidStabclass handles CLI and programmatic use. - Supports live video and frame-by-frame processing for custom pre/post-processing.
- Multiple border strategies (
black,reflect,replicate,auto) to handle the empty edges stabilization creates. - Built-in plotting for trajectories and transforms to diagnose motion.
- Can write and read transform files to skip recomputing motion vectors on re-runs.
Caveats
- OpenCV dependency management can be finicky; the README warns that PyPI’s
opencv-pythonmay clash with existing source builds. - Frame-by-frame mode produces black frames during an initial warmup window while it accumulates smoothing data.
Verdict
Handy if you need to batch-stabilize drone or action-cam footage in a Python pipeline. Skip it if you need cinema-grade stabilization or heavy rolling-shutter correction—this is a straightforward feature-tracker, not a post-production suite.
Frequently asked
- What is AdamSpannbauer/python_video_stab?
- This package wraps OpenCV feature tracking into a single class that smooths jittery footage from files or live streams, with hooks for custom frame-by-frame processing.
- Is python_video_stab open source?
- Yes — AdamSpannbauer/python_video_stab is open source, released under the MIT license.
- What language is python_video_stab written in?
- AdamSpannbauer/python_video_stab is primarily written in Python.
- How popular is python_video_stab?
- AdamSpannbauer/python_video_stab has 773 stars on GitHub.
- Where can I find python_video_stab?
- AdamSpannbauer/python_video_stab is on GitHub at https://github.com/AdamSpannbauer/python_video_stab.