Thursday, 16 June 2011

How to Speed Up Video Thumbnail Previewing Times in Nautilus (Ubuntu Linux)?

Ironically when it comes to dealing with multimedia files GNU/Linux can be both the one of the best operating systems and the worst. For instance, unlike proprietary MS Windows, in GNU/Linux we have few multimedia frameworks which are capable of both decoding and encoding video/audio files much better than MS Windows.

The Gstreamer (written in C language), the Phonon framework (KDE/Qt4's own multimedia framework) or ffmpeg libraries are among the main ones. But as said, still the availability of powerful/feature-rich applications is the downside. For instance if you want something that has the ability to replace a professional video creator suit such as the Adobe Creative suit... it ain't gonna be that easy to find.

But on the other hand, because of these wide variety of choices, if you find a certain multimedia app is buggy and slow on performance, then you can easily find a replacement, most of the time, especially if its a simple utility. In that case, have you ever felt like default video thumbnail creating times of Nautilus is a bit slow?, I did!.

The application behind this thumbnail creating is the GTK written Totem front-end that uses either Gstreamer or Xine as the multimedia engine. By default Ubuntu ships Totem that uses the Gstreamer. Gstreamer is a pretty powerful framework but personally I like the Totem-Xine front-end since it seems a bit efficient than the Gstreamer version (sometimes).

It works!...
Still when it comes to creating video previews/thumbnails, they both suck. For a long time I used to install MPlayer and use a simple script that generate video thumbnails in Nautilus using MPlayer as the engine. And I gotta tell you, it was at least twice as fast as Totem!.

The reason for that efficiency is because MPlayer uses (Xine also use it) codec library known as "libavcodec" (which is a part of the above mentioned ffmpeg project). "libavcodec" are known for being quite faster when it comes to dealing with multimedia files in comparison with others. But the sad thing is that, that script is not working quite well in Ubuntu 11.04.

But luckily we have another small application written in C/C++ that also uses the "libavcodec" (wise choice :D) and guess what!, it's certainly faster than Totem while creating video thumbnails. It's called ffmpegthumbnailer. 

You can install ffmpegthumbnailer in Ubuntu 11.04 Natty Narwhal (should work in 10.04 and 10.10) by entering the below command in your Terminal.
sudo apt-get install ffmpegthumbnailer

Now we have to replace all the configurations of Nautilus file manager attached with Totem with our new video-thumbnailer. To that we have to edit the Gnome configuration editor, but if we do that by hand, well, it'll gonna take some time!.

But there is a command that I found which will replace all those Totem related configuration entries with our ffmpegthumbnailer all by itself!. To do that, again open your Terminal and enter the below command. 
gconftool --all-dirs /desktop/gnome/thumbnailers | grep video | xargs -I DIR gconftool --set DIR/command --type string "/usr/bin/ffmpegthumbnailer -s %s -i %i -o %o -c png -f"

That should do it dudes :D. Since it's based on ffmpeg library, any file that's supported by it (that means almost all!), ffmpegthumbnailer can create thumbnails. Enjoy the fasten Nautilus video previewing!.

No comments:

Post a Comment