Deshaking videos with Linux

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:

  1. 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:

    transcode -J stabilize --mplayer_probe -i yourmovie.avi
    (this will use mplayer to decode the file, which should be able to decode everything :) )

  2. 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 --mplayer_probe -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 --mplayer_probe -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:

About these ads

,

  1. #1 by masteryod on 22. March 2011 - 14:06

    wow!

  2. #2 by Ken Yu on 31. May 2011 - 07:31

    Really appreciated your hard works for this important tools for Linux. Looks forward to see a GUI for this tools. Thanks

  3. #3 by mentar on 19. July 2011 - 18:11

    Great and much needed tool! Still trying to get it to analyse it though but even with mplayer_probe still ends up with the likes of:
    [filter_stabilize.so] warning: unsupported Codec: 2 (10| 1| 9)
    Will try playing around a bit more and worst comes to worst convert it to raw with ffmpeg and feed it back in
    Many thanks!

  4. #4 by Ash on 6. February 2012 - 16:07

    Thanks for posting the instructions here. It’s unsurprisingly difficult searching for help on “transcode”, because it’s such a common word.

  5. #5 by Joseph on 6. October 2012 - 02:28

    @mentar: I originally had the same issue, it seemed to go away after getting the most recent binary from here: http://public.hronopik.de/vid.stab/download.php?lang=en

    @OP: However, now the first command seems to hang on “[decoder.c] cancelling the import threads: 0:00:57, (15| 0| 5)”, any advice?

  6. #6 by Daniel on 29. December 2012 - 23:03

    @OP/Joseph
    I stumbled into the same issue. Couldn’t get it to work. I assume it’s either transcoder or mplayer not supporting YUV4, but I coulnd’t recompile transcoder 1.1.7 for testing this out, because I ran into a c error in ‘filter_pp.c’ “Unknown type name ‘pp_mode_t’ and ‘pp_context_t'”. The error when running the stabilize-command above is:

    [extract_yuv.c] critical: No support for YUV4MPEG compiled in.
    [extract_yuv.c] critical: Recompile with mjpegtools support enabled.
    [decoder.c] cancelling the import threads

    Transcode version 1.1.7

    • #7 by atom on 23. March 2013 - 02:33

      Get rid of “–mplayer_probe”.

  1. Janhouse » Linux video stabilizators

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: