mpv: Add motion vector interpolation script

This commit is contained in:
Simon Bruder 2021-02-25 12:07:20 +01:00
parent ef9731a080
commit 0fdfec4385
Signed by: simon
GPG key ID: 8D3C82F9F309F8EC
3 changed files with 37 additions and 6 deletions

View file

@ -9,7 +9,7 @@
./htop.nix ./htop.nix
./misc.nix ./misc.nix
./mpd.nix ./mpd.nix
./mpv.nix ./mpv
./neovim.nix ./neovim.nix
./pass.nix ./pass.nix
./programs.nix ./programs.nix

View file

@ -48,6 +48,20 @@ in
# mpv can also be useful without a display (e.g. for encoding) # mpv can also be useful without a display (e.g. for encoding)
enable = nixosConfig.sbruder.gui.enable || nixosConfig.sbruder.full; enable = nixosConfig.sbruder.gui.enable || nixosConfig.sbruder.full;
package = pkgs.wrapMpv
(pkgs.mpv-unwrapped.override {
vapoursynthSupport = true;
vapoursynth = pkgs.vapoursynth.withPlugins (with pkgs; [
vapoursynth-mvtools
]);
})
{
scripts = with pkgs.mpvScripts; [
pitchcontrol
sponsorblock
];
};
defaultProfiles = [ defaultProfiles = [
"gpu-hq" # High quality by default "gpu-hq" # High quality by default
]; ];
@ -208,14 +222,11 @@ in
tscale-clamp = 0.0; tscale-clamp = 0.0;
}; };
mvinterpolate.vf-add = "vapoursynth=${./mvinterpolate.py}";
# adapted from https://github.com/mpv-player/mpv/issues/4418#issuecomment-368272929 # adapted from https://github.com/mpv-player/mpv/issues/4418#issuecomment-368272929
clear-speed.af-add = "scaletempo=stride=18:overlap=.6:search=10"; clear-speed.af-add = "scaletempo=stride=18:overlap=.6:search=10";
}; };
scripts = with pkgs.mpvScripts; [
pitchcontrol
sponsorblock
];
}; };
# mpv-gallery-view is not compatible with home-managers script injection meachanism # mpv-gallery-view is not compatible with home-managers script injection meachanism

View file

@ -0,0 +1,20 @@
import vapoursynth as vs
core = vs.core
clip = core.std.AssumeFPS(video_in, fpsnum=int(container_fps * 1000), fpsden=1000)
sup = core.mv.Super(clip, pel=2)
bvec = core.mv.Analyse(sup, isb=True)
fvec = core.mv.Analyse(sup, isb=False)
hfr = core.mv.BlockFPS(
clip,
sup,
bvec,
fvec,
num=int(display_fps * 1000),
den=1000,
thscd1=140,
thscd2=38,
)
hfr.set_output()