How to stabilize a goPro video with ffmpeg?
Asked Answered
J

1

10

I want to know an EASY way to stabilize a goPro video on Windows, using a simple batch and ffmpeg.

Jodee answered 3/8, 2017 at 12:3 Comment(0)
J
15

1) Install ffmpeg on your computer : follow those steps

2) Create a batch file next to the video you want to process. Write the following code :

set input_file=GOPR2665
ffmpeg -i %input_file%.MP4 -vf vidstabdetect=shakiness=10:accuracy=15 -f null -
ffmpeg -i %input_file%.MP4 -vf vidstabtransform=zoom=5:smoothing=30 -vcodec libx264 -preset slow -tune film -crf 20 -an %input_file%_stabilized.MP4
del transforms.trf

3) Run the script, changing the name of the "input_file". Once the script execution is over, your file FILENAME_stabilized.MP4 is created.

NB: the execution of this script reduces a bit the video quality, and remove the audio track.

Jodee answered 3/8, 2017 at 12:3 Comment(6)
This doesn't seem to work anymore, I get an error message No such filter: 'vidstabdetect' using ffmpeg version 3.4.6-0ubuntu0.18.04.1.Rikkiriksdag
Why not somehow use the gyroscope metadata recorder by GoPro? You're just throwing away potential perfect stabilisation.Lowbrow
@Rikkiriksdag AFAIK vidstab filter is included in FFMPEG only if FFMPEG is specifically compiled to include it. Type ffmpeg -version to see what is enabled in your version or ffmpeg -filters to see a list of embedded filters.Animatism
@Animatism I saw that, too but not yet tried it. Thanks for the hint, I will give it a try!Rikkiriksdag
It works, but audio is lostAmblyoscope
@Lowbrow got a way that we could use the gyroscope metadata to do the stabilization? Ideally with ffmpeg or free tools?Listen

© 2022 - 2024 — McMap. All rights reserved.