4

In order to get a newer version of ffmpegthumbnailer that supports embedded image metadata. I manually compiled the (currrently) lastest release version 2.2.2 from github.

  -m      : prefer embedded image metadata over video content

here are some information about my environment

➜  ~ nautilus --version
GNOME nautilus 3.26.4

➜  ~ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.4 LTS
Release:    18.04
Codename:   bionic

➜  ~ uname -a
Linux Play-PC-VPC 5.0.0-25-generic #26~18.04.1-Ubuntu SMP Thu Aug 1 13:51:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

➜  ~ echo $0
zsh

➜  ~ g++ --version
g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

here is what i did to compile/install it:

sudo apt install build-essential cmake pkg-config
sudo apt install libjpeg-dev libpng-dev zlib1g libavcodec-dev libavformat-dev libavfilter-dev

wget https://github.com/dirkvdb/ffmpegthumbnailer/releases/download/2.2.2/ffmpegthumbnailer-2.2.2.tar.bz2
tar -xvf ffmpegthumbnailer-2.2.2.tar.bz2
cd ffmpegthumbnailer-2.2.2

cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_GIO=ON -DENABLE_THUMBNAILER=ON .
make
sudo make install

and here is how I configure thumbnailer (sudo vim /usr/share/thumbnailers/ffmpegthumbnailer.thumbnailer)

[Thumbnailer Entry]
TryExec=ffmpegthumbnailer
Exec=ffmpegthumbnailer -i %i -o %o -s %s -f
MimeType=video/jpeg;video/mp4;video/mpeg;video/quicktime;video/x-ms-asf;video/x-ms-wm;video/x-ms-wmv;video/x-msvideo;video/x-flv;video/x-matroska;video/webm;video/mp2t;

Ps. please ignore the missing -m part, cause I haven't get it to show any thumbs yet.

also tried removing cache with following command

rm -r ~/.cache/thumbnails/

It looks like this.

ffmpegthumbnailer with nautilus

Ps. again i don't have totem installed since it is a minimal install

here is another pic shows ffmpegthumbnailer does work

ffmpegthumbnailer command

my nautilus preference:

enter image description here


Trobleshooting steps tried:

1. bwarp

during further search (couldn't remember what I was typing on the search box LOL) and copy & paste what it says

Ubuntu 18.04 - Solve Nautilus 3.26.4+ external thumbnailers problem

sudo wget -O /usr/local/bin/bwrap https://raw.githubusercontent.com/NicolasBernaerts/ubuntu-scripts/master/nautilus/bwrap
sudo chmod +rx /usr/local/bin/bwrap
rm -r ~/.cache/thumbnails/
sudo reboot

not working, rm /usr/local/bin/bwrap...

oh, and playing with bwarp, I tried print out the command called:

/usr/bin/bwrap --ro-bind /usr/local/bin /usr/local/bin bind /home/play_pc/ff_log /home/play_pc/ff_log --ro-bind /etc/alternatives /etc/alternatives --ro-bind /etc/ImageMagick-6 /etc/ImageMagick-6 --ro-bind /var/cache/fontconfig /var/cache/fontconfig --ro-bind /usr /usr --ro-bind /bin /bin --ro-bind /lib64 /lib64 --ro-bind /lib /lib --ro-bind /sbin /sbin --proc /proc --dev /dev --chdir / --setenv GIO_USE_VFS local --unshare-all --die-with-parent --bind /tmp/gnome-desktop-thumbnailer-FL9UJ0 /tmp --ro-bind /home/play_pc/Downloads/wo_feature.mkv /tmp/gnome-desktop-file-to-thumbnail.mkv --seccomp 17 ffmpegthumbnailer -i /tmp/gnome-desktop-file-to-thumbnail.mkv -o /tmp/gnome-desktop-thumbnailer.png -s 256 -f

2. mv ffmpegthumbnailer

so... the bwarp thing got me thinking maybe it's the binding path that cause the problem, so I moved ffmpegthumbnailer execution file

➜  ~ which ffmpegthumbnailer
/usr/local/bin/ffmpegthumbnailer

➜  ~ sudo mv /usr/local/bin/ffmpegthumbnailer /usr/bin/ffmpegthumbnailer

➜  ~ which ffmpegthumbnailer
/usr/bin/ffmpegthumbnailer

and... it still doesn't work

3. check permission

➜  ~ ls -l /usr/local/bin
total 32
-rwxr-xr-x 1 root root 30576 May  4 20:46 ffmpegthumbnailer

➜  ~ sudo ls -l /usr/share/thumbnailers/
total 20
-rw-r--r-- 1 root root 803 Jun 19  2019 evince.thumbnailer
-rw-r--r-- 1 root root 259 May  4 20:52 ffmpegthumbnailer.thumbnailer
-rw-r--r-- 1 root root 525 Mar 16  2018 gdk-pixbuf-thumbnailer.thumbnailer
-rw-r--r-- 1 root root 213 Mar 13  2018 gnome-font-viewer.thumbnailer
-rw-r--r-- 1 root root 158 Dec 31  2017 librsvg.thumbnailer

➜  ~ sudo killall nautilus         
nautilus: no process found

➜  ~ rm -r ~/.cache/thumbnails
➜  ~ mkdir ~/.cache/thumbnails
➜  ~ chown -R play_pc:play_pc ~/.cache/thumbnails
➜  ~ sudo reboot

4. use abs-path instead

[Thumbnailer Entry]
TryExec=/usr/local/bin/ffmpegthumbnailer
Exec=/usr/local/bin/ffmpegthumbnailer -i %i -o %o -s %s -f
MimeType=video/jpeg;video/mp4;video/mpeg;video/quicktime;video/x-ms-asf;video/x-ms-wm;video/x-ms-wmv;video/x-msvideo;video/x-flv;video/x-matroska;video/webm;video/mp2t;

At this point, I think I've honestly ran out of ideas. Can someone so kindly point me something I can try. plz

4
  • Have you checked the Nautilus preferences to make sure the option is enabled?
    – Ken Sharp
    May 4, 2020 at 9:34
  • @KenSharp I believe I did (updated the original post)
    – AlexLeo
    May 4, 2020 at 9:50
  • check if your ffmpegthumbnailer.thumbnailer is readable by all
    – oscar1919
    May 4, 2020 at 11:11
  • @oscar1919 just checked, and yes it seems readable -rw-r--r-- 1 root root
    – AlexLeo
    May 4, 2020 at 11:27

3 Answers 3

1

For some reason the shared libraries do not work in /usr/local/lib.
I could make the thumbnails show up by adding a few steps.
your last action is
sudo make install
continue with
sudo ldconfig
sudo mv /usr/local/lib/*ffmpegthumb* /usr/lib
Not quite sure if this is now a 'legal' location for these libraries.
I notice that the default library location is working on 16.04 and wonder what is the difference. Tested on 20.04, moving the libs is also needed there.

3
  • It works! Thanks you so much!
    – AlexLeo
    May 6, 2020 at 7:00
  • after some poking around, I found substituting set(CMAKE_INSTALL_PREFIX "/usr") in cmake_install.cmake also do the trick
    – AlexLeo
    May 6, 2020 at 7:02
  • More elegant solution. And you're welcome.
    – oscar1919
    May 6, 2020 at 7:13
0

thumbnail viewer for myvideo :


Here is an overview of what I did (on 18.04) to generate thumbnails for a proprietary filetype, let's call it myvideo, subtype of video. It should contain what you need (last bullet). Assume the binary that generates the thumbnails is already built and is called gnome-thumbnail-myvideo.

installation:

  • make a mimetype video/myvideo (myvideo as subtype of mediatype video)
    here is explained how to make this only for the current user
    mkdir ~/.local/share/mime/packages (if not existing yet)
    copy myvideo.xml to .local/share/mime/packages
    check if it is readable
    sudo update-mime-database ~/.local/share/mime/

  • installing the icon for myvideo in file manager
    make sure the icon is readable for all :
    chmod +r video-myvideo.svg
    since myvideo is part of mediatype video, it should now already have the generic icon for this type
    check the icon theme by
    gsettings get org.gnome.desktop.interface gtk-theme
    find /usr/share/icons | grep video-x-generic
    Then place a copy of the icon in a suitable format to all the locations in the relevant icon theme (e.g. Humanity) where you found video-x-generic ... Check if it is still readable by all (experienced that copying can change the rights). Update the icon caches:
    sudo update-icon-caches /usr/share/icons/*
    sudo gtk-update-icon-cache /usr/share/icons/Humanity (or another one) Ready.

  • copy program gnome-thumbnail-myvideo to /usr/local/bin (sudo)
    due to a problem with sandboxing for thumbnails (18.04 onwards), you cannot use the program in a local user folder
    check if it is executable once it is copied to /usr/local/bin
    check if it is readable
    place a thumbnailer file (e.g. myvideo.thumbnailer) in /usr/share/thumbnailers or /usr/local/share/thumbnailers
    close the file manager
    rm all *.png files under subfolders of ~/.cache/thumbnails
    restart file manager, it should work, or after logout/login

1
  • many thanks for your timely reply! a quick search on existing mime.types grep 'mkv' /etc/mime.types suggest ubuntu 18.04.04 lts clean-install does recognize .mkv file. Anyway, still trying customizing a new file type... will keep original post updated.
    – AlexLeo
    May 4, 2020 at 12:37
0

Not using Ubuntu, but a suggestion which could help.

I am actually using Xanmod kernel from AUR in Arch linux:

Linux version 5.8.6-xanmod1-1 (makepkg@archlinux) (gcc (GCC) 10.2.0, GNU ld (GNU Binutils) 2.35) #1 SMP PREEMPT Thu, 10 Sep 2020 00:51:21 +0000

During compilation I set the CONFIG_USER_NS_UNPRIVILEGED to n:

$ zcat /proc/config.gz | grep --color=auto CONFIG_USER_NS_UNPRIVILEGED
# CONFIG_USER_NS_UNPRIVILEGED is not set

As mentioned in the Archwiki

Note: On linux-hardened, thumbnails generation fails (all thumbnails go in ~/.cache/thumbnails/fail/). This is due to unprivileged user namespace being disabled by default on this kernel for security reasons. Nautilus uses bwrap (provided by bubblewrap) to sandbox thumbnailers. You may decide to replace bubblewrap with bubblewrap-suid.

That was my issue. Make sure you are not using Linux hardened or custom compiled kernel with CONFIG_USER_NS_UNPRIVILEGED unset.

This can be a little bit more hard to find so I shared my answer. I also launched bug report for this issue! Then I found out it was my fault.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.