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.
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.
You can try Cinelerra,
Installing cinelerra
ppa:cinelerra-ppa/ppa
(How to add a PPA) then install cinelerra from the software center.Tutorials
FFmpeg deshake filter.
The higher the video resolution is, the more you need in
rx
,ry
andblocksize
. Check the link for documentation.Here's a little script I use:
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.
You can easily stabilize videos with Kdenlive:
Right-click on a clip in the project library and select Clip Jobs -> Stabilize
Worked with Kdenlive 20.08.2 on Ubuntu 20.10
You can try Shotcut (http://shotcut.org/). It's a NLE (Non linear editor) that comes with a lot of filters, including video stabilizing. check out this tutorial: https://www.youtube.com/watch?v=C3v-jYJJfuM
Apparently, ffmpeg can be used now with vid.stab to produce good quality stabilized videos. There are a few sources (1, 2, 3) that report this.
If your video is named
input.mp4
executeThe first step creates the stabilization profile. The second step creates the stabilized video. Other options for the second step are
(the last is for high quality output).
More information on the parameters can be found in the vid.stab GitHub page.
Related:
Extra
Blender is a free and open-source 3D creation suite. You can define tracking points to remove shakiness, bumps and jerks from video footage using the 2D video stabilization feature.
To install Blender Run:
Alternatively, The latest version (3.0.1) can be Downloaded from the Blender Website.
Video stabilization instructions are documented in the Blender 3.0 Manual
Here is a basic overview to use the Stabilization Feature:
Tap on "open" to load the video clip.
Click on the "set scene frame" located on the left to generate the video timeline.
Click on "Tracking settings" and select locRot. Add as many markers as you want for location and rotation.
Now click on the "Stabilization" tab to enable 2D stabilization.
Select the tracks for location and rotation you marked earlier.
Tap on "clip display" located at the top and select "show stable".
Now click on "Autoscale". Or if you prefer to adjust according to your preference then you can move the slider to get the desired results.
Play the video and enjoy the stable version of your footage.
Tap on "save" to save the video clip.
You could use MLT, which is versatile and well maintained. A command line tool for this is
melt
. There are detailed instructions, and a script for that. It is 3 years old, but I think is is still functional.Related:
vidstab1.1 will work but is not simple to implement vidstab1.1 website and it's componenets are available via synaptic.