av1an: init at 0.4.2

This commit is contained in:
seth 2024-03-02 20:18:28 -05:00
parent 3e1b36a740
commit 767cf0c714
No known key found for this signature in database
GPG Key ID: D31BD0D494BBEE86
2 changed files with 135 additions and 0 deletions

View File

@ -0,0 +1,58 @@
{
lib,
rustPlatform,
fetchFromGitHub,
pkg-config,
ffmpeg,
nasm,
vapoursynth,
libaom,
rav1e,
nix-update-script,
}:
rustPlatform.buildRustPackage rec {
pname = "av1an-unwrapped";
version = "0.4.2";
src = fetchFromGitHub {
owner = "master-of-zen";
repo = "av1an";
rev = version;
hash = "sha256-A4/1UdM8N5CHP44PBNB+ZH2Gcl84rcpUBwQRSnubBGc=";
};
cargoHash = "sha256-ahoiCAUREtXgXLNrWVQ2Gc65bWMo4pIJXP9xjnQAlaI=";
nativeBuildInputs = [
rustPlatform.bindgenHook
pkg-config
nasm
];
buildInputs = [
ffmpeg
vapoursynth
];
nativeCheckInputs = [
libaom
rav1e
];
passthru = {
updateScript = nix-update-script { };
};
meta = {
description = "Cross-platform command-line encoding framework";
longDescription = ''
Cross-platform command-line AV1 / VP9 / HEVC / H264 encoding framework with per scene quality encoding.
It can increase your encoding speed and improve cpu utilization by running multiple encoder processes in parallel.
'';
homepage = "https://github.com/master-of-zen/Av1an";
changelog = "https://github.com/master-of-zen/Av1an/releases/tag/${src.rev}";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [ getchoo ];
mainProgram = "av1an";
};
}

View File

@ -0,0 +1,77 @@
{
lib,
symlinkJoin,
makeBinaryWrapper,
testers,
av1an-unwrapped,
ffmpeg,
python3Packages,
libaom,
svt-av1,
rav1e,
libvpx,
x264,
x265,
libvmaf,
withAom ? true, # AV1 reference encoder
withSvtav1 ? false, # AV1 encoder/decoder (focused on speed and correctness)
withRav1e ? false, # AV1 encoder (focused on speed and safety)
withVpx ? true, # VP8 & VP9 de/encoding
withX264 ? true, # H.264/AVC encoder
withX265 ? true, # H.265/HEVC encoder
withVmaf ? false, # Perceptual video quality assessment algorithm
}:
# av1an requires at least one encoder
assert lib.assertMsg (lib.elem true [
withAom
withSvtav1
withRav1e
withVpx
withX264
withX265
]) "At least one encoder is required!";
symlinkJoin {
name = "av1an-${av1an-unwrapped.version}";
paths = [ av1an-unwrapped ];
nativeBuildInputs = [ makeBinaryWrapper ];
postBuild =
let
runtimePrograms =
[ (ffmpeg.override { inherit withVmaf; }) ]
++ lib.optional withAom libaom
++ lib.optional withSvtav1 svt-av1
++ lib.optional withRav1e rav1e
++ lib.optional withVpx libvpx
++ lib.optional withX264 x264
++ lib.optional withX265 x265
++ lib.optional withVmaf libvmaf;
in
''
wrapProgram $out/bin/av1an \
--prefix PATH : ${lib.makeBinPath runtimePrograms} \
--prefix PYTHONPATH : ${python3Packages.makePythonPath [ python3Packages.vapoursynth ]}
'';
passthru = {
# TODO: uncomment when upstream actually bumps CARGO_PKG_VERSION
#tests.version = testers.testVersion {
# package = av1an;
# inherit (av1an-unwrapped) version;
#};
};
meta = {
inherit (av1an-unwrapped.meta)
description
longDescription
homepage
changelog
license
maintainers
mainProgram
;
};
}