2021-01-11 08:54:33 +01:00
|
|
|
{ lib, stdenv, gcc, libav_12, fetchFromGitHub }:
|
2018-02-27 21:09:36 +01:00
|
|
|
|
2019-08-13 23:52:01 +02:00
|
|
|
stdenv.mkDerivation {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "untrunc";
|
2020-09-21 09:36:53 +02:00
|
|
|
version = "2020.02.09";
|
2018-02-27 21:09:36 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ponchio";
|
|
|
|
repo = "untrunc";
|
2020-09-21 09:36:53 +02:00
|
|
|
rev = "4eed44283168c727ace839ff7590092fda2e0848";
|
|
|
|
sha256 = "0nfj67drc6bxqlkf8a1iazqhi0w38a7rjrb2bpa74gwq6xzygvbr";
|
2018-02-27 21:09:36 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
buildInputs = [ gcc libav_12 ];
|
|
|
|
|
|
|
|
# Untrunc uses the internal libav headers 'h264dec.h' and 'config.h'.
|
|
|
|
# The latter must be created through 'configure'.
|
|
|
|
libavConfiguredSrc = libav_12.overrideAttrs (oldAttrs: {
|
|
|
|
name = "libav-configured-src";
|
|
|
|
outputs = [ "out" ];
|
|
|
|
phases = [ "unpackPhase" "patchPhase" "configurePhase" "installPhase" ];
|
|
|
|
installPhase = "cp -r . $out";
|
|
|
|
});
|
|
|
|
|
|
|
|
buildCommand = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
g++ -o $out/bin/untrunc \
|
|
|
|
-Wno-deprecated-declarations \
|
|
|
|
$src/file.cpp $src/main.cpp $src/track.cpp $src/atom.cpp $src/mp4.cpp \
|
|
|
|
-I$libavConfiguredSrc -lavformat -lavcodec -lavutil
|
|
|
|
'';
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2018-02-27 21:09:36 +01:00
|
|
|
description = "Restore a damaged (truncated) mp4, m4v, mov, 3gp video from a similar, undamaged video";
|
|
|
|
license = licenses.gpl2;
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://github.com/ponchio/untrunc";
|
2018-02-27 21:09:36 +01:00
|
|
|
maintainers = [ maintainers.earvstedt ];
|
|
|
|
};
|
|
|
|
}
|