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!... |
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!.
23 comments:
Thanks, works really fast!
@Anonymous,
The pleasure is all mine :)...
This is fantastic! Took me a while to understand how the gconftool/xargs command worked, but the thumbnail is so-ooo much faster now. Thanks so much!
@Anonymous,
You are welcome :D.
Would you have any ideas why it doesn't work in Ubuntu 11.10? When I followed your instructions while using 11.04 everything worked. Then, after distribution upgrade, which installed totem back, I did those again. However, now I have no (video) thumbnails whatsoever...
@lje,
Okay sorry that I had to take few minutes to figure things out. But I've written a post on how to fix in my new blog which you can read by clicking here. Enjoy!.
Thanks... it is visibly faster. Is there a way to edit ffmpegthumbnailer default settings? I find that by default Totem/Gstreamr does better job of calculating what frame to use as a thumbnail... I guess that might be the reason for its slowness.
@Anonymous,
Sorry about the late response :).
Anyhow answering your question, yes you can!.
For instance you can manually change the "seek-time" (default = 10%) before generating the thumbnail and the output size, etc.
The easy way is to read its manual which you can access by using the below command
man ffmpegthumbnailer
From your comment I can guess that you're an experienced user but just in case:) ...
For instance, say that you wanted to change the seek-time of a file then you can add the below parameter with ffmpegthumbnailer's command in the post.
.../usr/bin/ffmpegthumbnailer -s %s -i %i -o %o -c png -f -t 15%
You can change the percentage or use the hh:mm:ss format as well. Good luck.
Thanks. I really should have figured that out (apparently just copy-pasted the gconftool command without even looking at what was there).
Unfortunately the seek time alone doesn't do much i.e. doesn't try to skip "uninteresting" frames. mtn for example is a bit more advanced thumbnailer (http://moviethumbnail.sourceforge.net, also based on libavcodec). I guess mtn could be used too but it doesn't seem to support outputting png (you can still save the thumbnail as .png, but it's really a JPG) and the height is minimum 150 px.
After all quite happy with the default seek time (10) and definitely not going back to Totem's thumbnailer.
@Anonymous,
Hmm I've never tried MTN before!. Gonna try that out as well. So, thank you too :).
(Same Anonymous again.) I've noticed some sort of issue with incomplete (torrent) .mkv files. ffmpegthumbnailer tries to preview them, takes up 100% CPU usage and then the computer starts a lenghty SWAP session... No problem with complete .mkv files. I wish Deluge (torrent software I use) would have a possibility to append a different file extension to incomplete files or something.
Hi, thought I should share how I use ffmpegthumbnailer here. Just in case it's of use to somebody :-)
I've kept a script ffmpegthumbnailer_script in /usr/bin and that's what I pass in gconftool. The script itself is just a wrapper over ffmpegthumbnailer but it does three important thins: a. get the absolute file path from the file URI which nautilus passes, b. lets it handle a single-quote in the file name and c. choose a random seek time (so that just by deleting thumbnails and refreshing I can generate a fresh batch of images).
#!/bin/bash
while getopts :s:i:o: OPTION
do
case "$OPTION" in
s) size="$OPTARG";;
i) inputURL="$OPTARG";;
o) outputImage="$OPTARG";;
[?]) exit -1;;
esac
done
shift $(($OPTIND - 1))
inputURLWithEscapedSingleQuote=$(echo "$inputURL" | sed "s/'/\\'/g")
inputFile=$(python -c 'import gio,sys; print(gio.File(sys.argv[1]).get_path())' "$inputURLWithEscapedSingleQuote")
seekThumbnailAt=$((RANDOM%60 + 20))
ffmpegthumbnailer -f -s "$size" -i "$inputFile" -o "$outputImage" -t "$seekThumbnailAt"
@An Unlikely Sociopath,
Thanks mate :).
The ability to have the thumnails of embedded MKV (MP4 etc.) covers, that is, the DVD/BD cover art embedded in the audio file itself rathen than a screenshot of a movie scene, is great advantage for a functional video library. I couldn't get them with ffmpegthumbnailer in Xfce or LXDE. So Totem might be better in that aspect.
That said, VLC may be able to soon load those embedded covers in its library view and still better SMplayer2 seems to be willing to do the same and much more.
@Anonymous,
Well perhaps you're right about the "cover-arts" (haven't tried them).
However, I don't think that it'll work in Xfce or LXDE as this uses the "gocontools", which is primarily a Gnome desktop tool. But then again, there could be some other way that you can set it up in Xfce/LXDE (which again, depends on the file manager, I think).
Damn! I would expect such an answer: "Hey! You don't need any of these Gnome tools for that. Just follow these instructions to have them in LXDE and you're free from Gnome!"
So I'll wait for SMplayer2 or VLC to have that feature.
@Anonymous,
lol ;-).
Hey Gayan! If you install from the daily ppa (haven't tried the stable), VLC loads the embedded MKV cover arts in its library view. Just double click on the movie. Video starts to play and when you look back you see that it's thumbnailed.
@Anonymous,
Hey man,
To be honest, I never quite liked VLC that much. I mean, it has a shi* loads of features and all, but I don't know what it is ... it never was good enough for me ;-).
However, the latest 2.0, looks really clean, and thanks to your bragging about it ;-), I'm gonna try it :D.
Glad to hear that it works out for you.
Wow... this should be the default for Nautilus! It used to be totally unresponsive when generating the thumbnails, but no more! Thanks for the tip!!!
@Anonymous,
You are welcome :D.
A side note: I've just resolved an issue with thumbnails not being generated at all (only fails) in Gnomebuntu (I think it's officially called Ubuntu 12.10 Gnome REMIX but I hope Canonical will change it :P) by installing gstreamer1.0-libav so I guess Gstreamer now uses libavcodec to generate thumbnails (and totem-video-thumbnail uses gstreamer). It seems better from the architectural point of view.
@cgdude,
Thanks for the update mate :).
Post a Comment