Video deshake con Linux: stabilize a shaky video with Transcode
Today we talk about another piece of software command line for Linux: Transcode. This little tool allows you to stabilize a video in which the cameraman (the alleged tale) does not have the hand too firm. It can happen on many occasions: over-excitement, crowd, cold, little space, fever, riot, guerriglia urbana, war that the recovery is to move and avoid the urge of vomiting every time we revisit the movies of the holidays a small team of developers wrote transcode, few line of code to Linux. The program “understand” thanks to the initial mapping of the video frame As the camera is moved, calculates the optimal shooting and writes a second file the correct video. Let's see how it works in detail:
We download transcode from official website and compiliamolo, or run it through the repository of our operating system (I will use Ubuntu in this tutorial).
sudo apt-get install transcode
The stabilization process is done in two steps: the first analyzes the video and produces a file with the information for the stabilization. This is the first command:
transcode -J stabilize -i video.mov
There is a possibility that the version is automatically installed from the repositories does not have the full support of our codec camera and show this error: “
transcode [filter_stabilize.so] warning: unsupported Codec: 2 (11| 0| 9)“. Some sites suggest using codecs mplayer with the command thus formed:
transcode -J stabilize --mplayer_probe -i video.mov
Although this seems to work in many, unfortunately not me, and since I do not really want to investigate mplayer I went to manually install its codec (I find much more expeditious).
We find the codec in a site dedicated to the still transcode video stabilization. From this site you can download the codec most suitable to our hardware (in my case x86_64). It is a compressed archive. Tgz, unload, unpack and are inside the file
filter_transform.so. At this point we have only move the two files (libraries) in “
/usr/lib/transcode“, simply with this command:
sudo mv / path / to / the / file / filter_ * / usr / lib / transcode /
Obviously replacing “
/percorso/per/il/file/” with the correct path. Enter the password and we are riding. We repeat the first command and we should not have any problems at all.
The second step will use the file created by the first step to correct the video frame by frame:
transcode-J transform-i video.mov-y xvid-o video_stabilizzato.avi
You do not need me to say it: the stabilized video will be in the same directory as the original video.
Important final considerations
Transcode is an ingenious program, very light and very helpful, but I found that the video has stabilized the small imperfections in the parts where the image is so overexposed by “burning” (part of the image where the light is more intense than that which can “record” the camera sensor, appear white no correction possible posthumous). Specifically I see in each frame of dots and lines, which serve as a guide to the software to straighten wavy frame, but in the edited video you should see. This is a small flaw that does not affect the operation of the software, and if the recovery (even move) è fatta bene senza frame bruciati, you will not hear. The fact remains that it is a small bug definitely solvable, but still not resolved.