1{ lib, stdenv
2, fetchFromGitHub
3, libaom
4, cmake
5, pkg-config
6, zlib
7, libpng
8, libjpeg
9, dav1d
10, libyuv
11}:
12
13stdenv.mkDerivation rec {
14 pname = "libavif";
15 version = "0.11.1";
16
17 src = fetchFromGitHub {
18 owner = "AOMediaCodec";
19 repo = pname;
20 rev = "v${version}";
21 sha256 = "sha256-mUi0DU99XV3FzUZ8/9uJZU+W3fc6Bk6+y6Z78IRZ9Qs=";
22 };
23
24 # reco: encode libaom slowest but best, decode dav1d fastest
25
26 cmakeFlags = [
27 "-DBUILD_SHARED_LIBS=ON"
28 "-DAVIF_CODEC_AOM=ON" # best encoder (slow but small)
29 "-DAVIF_CODEC_DAV1D=ON" # best decoder (fast)
30 "-DAVIF_CODEC_AOM_DECODE=OFF"
31 "-DAVIF_BUILD_APPS=ON"
32 ];
33
34 nativeBuildInputs = [
35 cmake
36 pkg-config
37 ];
38
39 buildInputs = [
40 libaom
41 zlib
42 libpng
43 libjpeg
44 dav1d
45 libyuv
46 ];
47
48 meta = with lib; {
49 description = "C implementation of the AV1 Image File Format";
50 longDescription = ''
51 Libavif aims to be a friendly, portable C implementation of the
52 AV1 Image File Format. It is a work-in-progress, but can already
53 encode and decode all AOM supported YUV formats and bit depths
54 (with alpha). It also features an encoder and a decoder
55 (avifenc/avifdec).
56 '';
57 homepage = "https://github.com/AOMediaCodec/libavif";
58 changelog = "https://github.com/AOMediaCodec/libavif/blob/v${version}/CHANGELOG.md";
59 maintainers = with maintainers; [ mkg20001 ];
60 platforms = platforms.all;
61 license = licenses.bsd2;
62 };
63}