1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 cmake,
6 pkg-config,
7 ffmpeg-headless,
8 libpng,
9 libjpeg,
10}:
11
12stdenv.mkDerivation {
13 pname = "ffmpegthumbnailer";
14 version = "unstable-2024-01-04";
15
16 src = fetchFromGitHub {
17 owner = "dirkvdb";
18 repo = "ffmpegthumbnailer";
19 rev = "1b5a77983240bcf00a4ef7702c07bcd8f4e5f97c";
20 hash = "sha256-7SPRQMPgdvP7J3HCf7F1eXxZjUH5vCYZ9UOwTUFMLp0=";
21 };
22
23 nativeBuildInputs = [
24 cmake
25 pkg-config
26 ];
27
28 buildInputs = [
29 ffmpeg-headless
30 libpng
31 libjpeg
32 ];
33
34 cmakeFlags = [ "-DENABLE_THUMBNAILER=ON" ];
35
36 # https://github.com/dirkvdb/ffmpegthumbnailer/issues/215
37 postPatch = ''
38 substituteInPlace libffmpegthumbnailer.pc.in \
39 --replace '$'{exec_prefix}/@CMAKE_INSTALL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@
40 '';
41
42 postInstall = ''
43 substituteInPlace $out/share/thumbnailers/ffmpegthumbnailer.thumbnailer \
44 --replace-fail '=ffmpegthumbnailer' "=$out/bin/ffmpegthumbnailer"
45 '';
46
47 meta = with lib; {
48 description = "Lightweight video thumbnailer";
49 longDescription = "FFmpegthumbnailer is a lightweight video
50 thumbnailer that can be used by file managers to create thumbnails
51 for your video files. The thumbnailer uses ffmpeg to decode frames
52 from the video files, so supported videoformats depend on the
53 configuration flags of ffmpeg.
54 This thumbnailer was designed to be as fast and lightweight as possible.
55 The only dependencies are ffmpeg and libpng/libjpeg.
56 ";
57 homepage = "https://github.com/dirkvdb/ffmpegthumbnailer";
58 license = licenses.gpl2Plus;
59 maintainers = [ maintainers.jagajaga ];
60 platforms = platforms.unix;
61 mainProgram = "ffmpegthumbnailer";
62 };
63}