Thumbnails: Difference between revisions

Lelgenio (talk | contribs)
Create a basic tutorial on how to create custom thumbnailers
 
Ekosz (talk | contribs)
No edit summary
Line 43: Line 43:
           Exec=sh -c "${pkgs.unzip}/bin/unzip -p %i preview.png > %o"
           Exec=sh -c "${pkgs.unzip}/bin/unzip -p %i preview.png > %o"
           MimeType=application/x-krita;
           MimeType=application/x-krita;
        '';
      }
    )
  ];
}
</syntaxhighlight>
=== FFmpeg thumbnailer ===
On minimal GNOME environments (for example ones with the option <code>services.gnome.core-utilities.enable</code> set to <code>false</code>, or ones without <code>pkgs.gnome.totem</code>), video thumbnails do not work by default. To fix this, you can use <code>ffmpegthumbnailer</code> (thumbnailer entry taken from [https://raw.githubusercontent.com/dirkvdb/ffmpegthumbnailer/master/dist/ffmpegthumbnailer.thumbnailer ffmpegthumbnailer repo]):
<syntaxhighlight lang="nix">
# configuration.nix
{ pkgs, ... }: {
  environment.systemPackages = [
    (
      pkgs.writeTextFile {
        name = "ffmpegthumbnailer.thumbnailer";
    destination = "/share/thumbnailers/ffmpegthumbnailer.thumbnailer";
    text = ''
  [Thumbnailer Entry]
          TryExec=${pkgs.ffmpegthumbnailer}/bin/ffmpegthumbnailer
          Exec=sh -c "${pkgs.ffmpegthumbnailer}/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-ms-asx;video/x-ms-wmx;video/x-ms-wvx;video/x-msvideo;video/x-flv;video/x-matroska;application/x-matroska;application/mxf;video/3gp;video/3gpp;video/dv;video/divx;video/fli;video/flv;video/mp2t;video/mp4v-es;video/msvideo;video/ogg;video/vivo;video/vnd.avi;video/vnd.divx;video/vnd.mpegurl;video/vnd.rn-realvideo;application/vnd.rn-realmedia;video/vnd.vivo;video/webm;video/x-anim;video/x-avi;video/x-flc;video/x-fli;video/x-flic;video/x-m4v;video/x-mpeg;video/x-mpeg2;video/x-nsv;video/x-ogm+ogg;video/x-theora+ogg
         '';
         '';
       }
       }