Video stabilisation software
Is there any way, either through a graphical program or a command line utility to "stabilise" video in Ubuntu?
By stabilise I am referring mainly to a feature of iMovie where shaky video is analysed, and then frame by frame altered to make it look smoother. This method looses video quality through zooming and rotating to produce the effect. Look at this video for an example of what I mean.
Solution 1:
The transcode
package bundles an image stabiliser plugin vid.stab. Their video demo certainly looks convincing (if a little vomit inducing).
Transcode package is no longer maintained and was removed from Ubuntu releases 18.04 and newer. You may still be able to run it but functions may be limited or buggy.
Solution 2:
You can try Cinelerra,
Installing cinelerra
- Add the following PPA
ppa:cinelerra-ppa/ppa
(How to add a PPA) then install cinelerra from the software center.
Tutorials
- Have a look at this.
Solution 3:
FFmpeg deshake filter.
ffmpeg -i "$INPUT" -vf deshake=rx=64:ry=64:blocksize=32 -strict -2 "$NEW_NAME" ## :opencl=1
The higher the video resolution is, the more you need in rx
, ry
and blocksize
. Check the link for documentation.
Here's a little script I use:
INPUT=$1
BASE_NAME=`basename "$INPUT"`
BASE_NAME="${BASE_NAME%.*}"
SUFFIX=${INPUT##*.}
NEW_NAME="$BASE_NAME"-deshake.$SUFFIX
set -x
ffmpeg -i "$INPUT" -vf deshake=rx=64:ry=64:blocksize=32 -strict -2 "$NEW_NAME" ## :opencl=1
set +x
## Copy the modification date too.
touch "$NEW_NAME" -r "$INPUT"
Although, I have to add, the results are not too good. I'd say it's better to upload to Youtube, let it deshake and download the result.