Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom thumbnailer not working in Nemo but working in Nautilus #2462

Open
artscoop opened this issue Jul 30, 2020 · 3 comments
Open

Custom thumbnailer not working in Nemo but working in Nautilus #2462

artscoop opened this issue Jul 30, 2020 · 3 comments
Labels

Comments

@artscoop
Copy link

 * Nemo 4.6.4 64 bit
 * Manjaro Linux 20.0.3 Lysia

Issue
I created a custom thumbnailer file to generate thumbnails for audio files (waveform rendering).
The thumbnailer file contains the following text:

[Thumbnailer Entry]
TryExec=/usr/bin/ffmpeg
Exec=/usr/bin/ffmpeg -i %i -filter_complex "showwavespic=s=128x128" -frames:v 1 %o
MimeType=audio/mpeg;audio/x-vorbis+ogg;

This should work but it fails, putting an 1x1 PNG file in the failed thumbnails directory.
However, after removing files in the failed directory, if I open Nautilus and browse the directory,
audio files thumbnails are generated perfectly.

Steps to reproduce

  • Install ffmpeg and ensure /usr/bin/ffmpeg exists (or change the thumbnailer text to the right path)
  • Put the above snippet in a file named ~/.local/thumbnailers/audio.thumbnailer.
  • Clear your ~/.cache/thumbnails folder.
  • Open Nemo
  • Enable file thumbnails in the settings
  • Browse to a directory with audio files.
  • Observe the files keeping their default icon after blinking for a bit.

Expected behaviour

  • Audio files (MP3 and OGG) have an icon which is their waveform.

Other information
There was the same issue in Nautilus, which seems to have been fixed in 2018, but I can't find the URL for that anymore.
The was a mention of ro-bind or something I did not understand.

If I use the command of my thumbnailer in a shell, the command works fine.

I have another custom thumbnailer which works fine in Nemo, I don't know what makes a difference.

@SomeTroglodyte
Copy link

Do you have overlapping thumbnailers for the mimetypes in question? I ran into some issue with two valid thumbnailers installed for cbz, and the default one still ran even after removing its association to that mime type via a modified ~/.local/thumbnailers copy. Maybe you can see the thumbnailer process in system monitor and quickly check its command line, it might turn out to be the default looking for cover art.

@Jeremy7701
Copy link
Contributor

There was the same issue in Nautilus, which seems to have been fixed in 2018, but I can't find the URL for that anymore.
The was a mention of ro-bind or something I did not understand.

I believe you might be referring to http://www.bernaerts-nicolas.fr/linux/74-ubuntu/360-ubuntu-nautilus-external-thumbnailer-failure
It appears to be a very complicated document. ;)

It refers to the bwrap program [part of the bubblewrap package], which Ubuntu claim is a flatpak thing - but LMDE uses the Debian version.

@icarter09 icarter09 added the BUG label Nov 15, 2020
@calico-cat968
Copy link

@artscoop

I found the root cause of this issue: the filename of the output thumbnail (no it's not because of bubblewrap like in the case of Nautilus. In fact, it appears Nemo doesn't sandbox thumbnailer with bubblewrap at all).

Details

Nautilus and Nemo respectively write the output thumbnail to:

/tmp/gnome-desktop-thumbnailer-XXXXXX/gnome-desktop-thumbnailer.png
/tmp/.gnome_desktop_thumbnail.XXXXXX

XXXXXX is a 6-character string consisting of uppercase letters and numbers (probably generated by mktemp). Each output image file is given a unique XXXXXX, for example: /tmp/.gnome_desktop_thumbnail.5OUW70

As you can see, since XXXXXX is not an image extension, if the thumbnailer program does not default to writing files in PNG format (or a format supported by gdk-pixbuf-thumbnailer), it will not be able to create thumbnails for Nemo. And yes, ffmpeg does not default to this.

Solution

This is actually pretty easy to fix. We just need to explicitly specify the output format. In the case of ffmpeg, we can use -f apng. For example:

[Thumbnailer Entry]
TryExec=/usr/bin/ffmpeg
Exec=/usr/bin/ffmpeg -y -i %i -filter_complex showwavespic=s=%sx%s -f apng %o
MimeType=audio/mpeg;audio/x-vorbis+ogg;

Notes:

  • -y is specified to force ffmpeg to overwrite output thumbnails in the temporary directory. Without this option, failed thumbnails may not be regenerated.
  • showwavespic already creates only a single video frame so -frames:v 1 is not really necessary.
  • apng is actually for creating animated PNG files, but if the input is a still image, only a normal PNG is created.
  • -f image2 also works (a JPEG image will be created), but creating files in PNG seems more secure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants