Video stabilization using VidStab and FFMPEG
Examples here use the default settings, see the VidStab readme on GitHub for more advanced instructions.
Here's an example video I made
Install ffmpeg with the vidstab plugin from homebrew
brew install ffmpeg --with-libvidstab
Analyze your video to create a
This won't modify your video or create a new video, but it should create a new file called
ffmpeg -i clip.mov -vf vidstabdetect -f null -
.trf file to create a stabilized video
ffmpeg -i clip.mov -vf vidstabtransform=smoothing=5:input="transforms.trf" clip-stabilized.mov
This should create a new stabilized video called
Bonus: create a side by side comparison video
Found on a forum here
ffmpeg -i Clip8.mov -i Clip8-vidstab.mov -filter_complex "[0:v:0]pad=iw*2:ih[bg]; [bg][1:v:0]overlay=w" merged.mov
@mrgloom ..that is the syntax of the 1st-phase,
here is an extended version, that I use in a Windows-compatible batch-file.
nullis a ffmpeg-preserved phrase, for forced-format encoding, to essentially do not output anything from the encoder-phase, but to still run it, it is used in various filters that need to 'walk over' the video-frames, the output-file is usually handled by the filter, as one of its-given variables. In the example above the output is actually written by the filter, using the file name, given in the
result=part (and then again in the
input=part for the 2nd-phase).
nulat the end (missing
l) is Windows-related and essentially same as
/dev/nullon *nix systems, it keeps the standard/error streams empty (less I/O).