Results 1 to 2 of 2

Thread: Issues pre-generating thumbnails for Nautilus.

  1. #1
    Join Date
    Oct 2010

    Question [SOLVED] Issues pre-generating thumbnails for Nautilus.

    [SOLVED, 28.10.2010 10:21 CET]

    Hello everybody,

    recently I've been working on a set of scripts for pre-generating thumbnails of video and picture files in a set of given directories. The idea is to be able to run thumbnail-generation in the background, per cron, per cmdline, not-in-X, not-using-nautilus, etc.

    I've been reading a lot of documentation regarding this topic and I think I have come quite far in understanding all the details and requirements.

    However I still need a little help (obviously...), but first, let me share my work with you...

    Here is my three scripts:




    batch_thumbnailer is the main scripts that calls vids+pics_thumbnailer, if in $PATH.

    The syntax is: batch_thumbnailer [<dir> ...]

    What it does is basically:

    1. search the given directories (non-recursive) for files
    2. determine the files mimetype and filter out all of type video/*, image/*
    3. create a batch list for video files and process it with vids_thumbnailer
    4. create a batch list for picture files and process it with pics_thumbnailer

    The steps 3 and 4 are similar and can be broken down in sub-steps:
    a. for each file, determine absolute path (file -> /path/to/file)
    b. for each file, determine URI (/path/to/file -> file:///path/to/file)
    c. for each URI, determine MD5 checksum (echo -n file:///path/to/file | md5sum | cut -c -32)
    d. for each file, determine modification time (file.mtime = $(stat -c "%Y" file))
    e. for each file, store a thumbnail under $HOME/.thumbnails/normal/$MD5.png with required metadata Thumb::URI := $URI and Thumb::MTime := file.mtime
    (f.) if thumbnail generation has failed, move thumbnail to $HOME/.thumbnails/fail[/$0]/$MD5.png

    The one place to start reading about thumbnails is probably:


    So that's that.

    Now I've created a whole batch of thumbnails with my scripts, however my problem is that nautilus is still recreating every single media file when I change to it's directory. I notice this because obviously it takes some time to display the thumbnails and also the mtime of the thumbnail is updated when re-/overwritten.

    My idea in the first place was to have the thumbnails created and then nautilus is just displaying them superfast, since they already exist. However, this is not the case.

    I spent some time figuring out the differences between my thumbnails and nautilus thumbnails, but I cant really tell the differences nor explain the "overwriting/recreating" behavior of nautilus. What I have tried so far is, I noticed another optional tag in the pings "Software: GNOME::ThumbnailFactory" and recreated that in my scripts, ... still with no change. Nautilus seems to allways overwrite my thumbnails.

    That makes me wanna stop any further work on my scripts, because I must first know what the real problem is or else I waste my time.

    FYI, these are my thumbnailers in nautilus (gconf-editor -> /desktop/gnome/thumbnailers/...):
    - image@x-pict := /usr/bin/gm convert -size %s -resize %s +profile "*" %i[0] %o
    - video@<any> := /usr/bin/ffmpegthumbnailer -s %s -c png -f -t 50%% -i %i -o %o

    I would like to know in what way GNOME's thumbnail creation standard differs from the one described in [1] or whether nautilus/gnome stores extra-information elsewhere (outside $HOME/.thumbnails). My goal is the pre-create thumbnails in my scripts, that nautilus can actually use and instantly display, without re-creation/overwrites.

    Thank you for all support, answers and feedback in advance,
    it's all welcome.


    PS: FYI, I posted this also on the

    UPDATE: FYI, I posted this also on the

    [SOLVED] It's a bug! I forgot to prefix the "file://" for the URIs in the batch_thumbnailer main script (the Perl parts).
    The pastebin links have been updated.
    Last edited by paxsali; October 28th, 2010 at 09:26 AM. Reason: [SOLVED]

  2. #2
    Join Date
    Aug 2007

    Re: Issues pre-generating thumbnails for Nautilus.

    Found this potentialy great script.
    I'm using Linux Mint 13 Mate with Caja.
    To generate thumbs for Coverthumbnailer I installed Nautilus.
    Any thumbnail generated by Nautilus is then picked up by Caja.
    The only drawback is that I have to visit every one of my music and/or pics map to get the requested thumbnail.
    So I tried your script:

    $:sh ./ /nfs/media/music/Blondie

    which returns the following errors:

    ./ 8: ./ [[: not found
    ./ 13: ./ [[: not found
    ./ 29: ./ [[: not found
    ./ 37: ./ [[: not found

    Can you help?

    Thanx, Frank

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts