This blog post is more or less for my own, that I don’t forget how to deshake a video if I need it again. Reading several blog posts and forum threads how to deshake a video, I have found the solution. Most Linux distributions have already installed it, without any knowledge of their users.
I’m speaking about “transcode”. If you don’t have transcode installed, install it:
pacman -S transcode
transcode includes a video stabilizier and you just have to know how to use it. You can update only the stabilizer by downloading a new version here and overwrite the exisiting files, but I don’t recommend it. You must download the binary version if you want to update.
Now we will start to deshake our video. Open a terminal, change to your directory with your videos and let us start:
- transcode must analyze our video, so start the command:
transcode -J stabilize -i yourmovie.avi
If transcode complains about not supported format, then try the following:
(this will use mplayer to decode the file, which should be able to decode everything 🙂 )
transcode -J stabilize --mplayer_probe -i yourmovie.avi
- The next step will stabilize your video. You have several options here, have a look at the plugins project page to find out what is possible.
transcode -J transform
-i yourmovie.avi -y raw -o yourstabilizedmovie.avi(Here is an example video from the project page. This will produce a large new video file, because I have taken the output “raw”. If you want another output then you have to specify it after -y, e.g . “-y xvid4”. Or you can send the output to ffmpeg, how to do this you have to look into the manual of transcode.)
The result will be zoomed so you don’t see how transcode moved the image to deshake it. If you want to see it, then try the following command:
transcode -J transform=crop=1:optzoom=0
-i yourmovie.avi -y raw -o yourstabilizedmovie.avi
This will end up with a video and a black border around it which is moving around. Here is an example video from the project page.
That’s all. Now you have a stablilized video. You can change some parameters like shakiness and zoom factor and so on, but the standard values making good results.
You can find the deshake plugin project page for transcode here: http://public.hronopik.de/vid.stab/features.php?lang=en
All parameters and options are described there. If you want to output the result to ffmpeg you have to read the wiki or manual of transcode, you can find the project page here: http://www.transcoding.org
This is an example from the project page, it looks amazing how good it stabilize the original source: