Video Stabilization with FFmpeg and VidStab
paulirish.com
paulirish.com
- Capture the gyro and accelerometer data along with your video (slap a smartphone on your camera if it doesn't have its own sensors)
- Feed both video and sensor data to gyroflow [1], synchronize and stabilize it.
The sensor-based stabilization is easy and looks uncannily good compared to pure software stabilization which is typically hit-and-miss. A good 3 axis gimbal is still better as it also compensates for parallax, but for deshaking the results are really similar.
I heard about this at one point, by was stymied by not knowing what I could use to record that data in a useful format for gyroflow.
export vid="sourcevid.mkv"
ffmpeg -i "$vid" -vf vidstabdetect -f null -; ffmpeg -i "$vid" -vf vidstabtransform "$vid.stab.mkv"; ffmpeg -i "$vid" -i "$vid.stab.mkv" -filter_complex vstack "$vid.stacked.mkv"
can be a one liner: vid="sourcevid.mkv" ffmpeg -i "$vid" -vf vidstabdetect -f null -; ffmpeg -i "$vid" -vf vidstabtransform "$vid.stab.mkv"; ffmpeg -i "$vid" -i "$vid.stab.mkv" -filter_complex vstack "$vid.stacked.mkv"