I had no idea that taking a video using my 300 mm zoom would be that shaky. Anyway, there is help at hand. Do you spot the difference between the left-hand side (original) and the right-hand side (stablized) in the video of the seals above–in full resolution, it is much more astounding, btw.? How did I go about it? This is how:
1) I got homebrew for my Mac. From this page I copied the command and pasted it into a terminal window I had opened before. This istalled homebrew on my computer.
2) I had homebrew install ffmpeg by just typing “brew install ffmpeg” into the terminal. ffmpeg came with the vid.stab filter enabled already.
3) I went to the folder my shaky video was in by typing “ls ” into the terminal and dragging the folder from the bread crumb trail in finder.
4) Now the filter works in two passes.
4a) First pass: command: “ffmpeg -i clip.mov -vf vidstabdetect -f null -“. This writes a file named “transforms.trf” into the same folder.
4b) Second pass: command: “ffmpeg -i clip.mov -vf vidstabtransform=smoothing=5:input=”transforms.trf” clip-stabilized.mov”. This writes the stabalized clip into the folder.
5) That’s it.
Max Ogden (commands in 4 are from his text) also adds a command to creade a side-by-side comparrison here.
You might want to rescale your video. Info on that filter of ffmpeg here.
Depending on the shakiness of your video, you might want to adapt the filter options a bit. On the website of vid.stab, you will find explanations on how to do that. I have found that with this really shaky video, it seems to work fine if I put shakiness to the maximum of 10 in the first pass (default is 5) and the smoothing to 30 (default is 10) in the second (see command line summary below).
Command Line Summary:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install ffmpeg
ffmpeg -i ***seals***.MP4 -vf vidstabdetect=shakiness=10 -f null -
ffmpeg -i ***seals***.MP4 -vf vidstabtransform=smoothing=30:input="transforms.trf" ***seals***-stabilized.MP4
ffmpeg -i ***seals***.MP4 -i ***seals***-stabilized2.MP4 -filter_complex "[0:v:0]pad=iw*2:ih[bg]; [bg][1:v:0]overlay=w" merged.mov
ffmpeg -i merged.mov -vf scale=1080:-1 merged1080.mov