Merge pull request #4027 from lemmi/mpv
Mpv: add motion estimation via vapoursynth
This commit is contained in:
commit
3026871bf8
8 changed files with 191 additions and 4 deletions
|
@ -2433,3 +2433,9 @@ libts-1.0.so.0 tslib-1.1_1
|
|||
libobs.so.0 obs-0.14.1_2
|
||||
libobsglad.so.0 obs-0.14.1_2
|
||||
libobs-opengl.so.0 obs-0.14.1_2
|
||||
libzimg.so.2 zimg-2.0.4_1
|
||||
libvapoursynth.so vapoursynth-R31_1
|
||||
libvapoursynth-script.so.0 vapoursynth-R31_1
|
||||
libvapoursynth.so vapoursynth-devel-R32_1
|
||||
libvapoursynth-script.so.0 vapoursynth-R32_1
|
||||
libmvtools.so vapoursynth-mvtools-12_1
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Template file for 'mpv'
|
||||
pkgname=mpv
|
||||
version=0.17.0
|
||||
revision=1
|
||||
revision=2
|
||||
short_desc="Video player based on MPlayer/mplayer2"
|
||||
maintainer="Juan RP <xtraeme@voidlinux.eu>"
|
||||
license="GPL-3"
|
||||
|
@ -9,7 +9,7 @@ homepage="http://mpv.io"
|
|||
build_style=waf
|
||||
configure_args="--confdir=/etc/mpv --docdir=/usr/share/examples/mpv
|
||||
--enable-cdda --enable-libmpv-shared --disable-oss-audio --disable-sdl2
|
||||
--enable-gpl3"
|
||||
--enable-gpl3 --enable-vapoursynth"
|
||||
hostmakedepends="pkg-config python-docutils perl"
|
||||
makedepends="
|
||||
ffmpeg-devel libass-devel lcms2-devel libXinerama-devel lua52-devel v4l-utils-devel
|
||||
|
@ -17,8 +17,8 @@ makedepends="
|
|||
pulseaudio-devel libbluray-devel libcdio-paranoia-devel libdvdread-devel
|
||||
MesaLib-devel harfbuzz-devel libXScrnSaver-devel jack-devel libdvdnav-devel
|
||||
wayland-devel libuuid-devel libguess-devel libXrandr-devel samba-devel
|
||||
rubberband-devel"
|
||||
depends="desktop-file-utils hicolor-icon-theme youtube-dl"
|
||||
rubberband-devel vapoursynth-devel zimg-devel python3.4-devel"
|
||||
depends="desktop-file-utils hicolor-icon-theme youtube-dl vapoursynth-mvtools"
|
||||
distfiles="https://github.com/mpv-player/${pkgname}/archive/v${version}.tar.gz"
|
||||
checksum=602cd2b0f5fc7e43473234fbb96e3f7bbb6418f15eb8fa720d9433cce31eba6e
|
||||
|
||||
|
|
1
srcpkgs/vapoursynth-devel
Symbolic link
1
srcpkgs/vapoursynth-devel
Symbolic link
|
@ -0,0 +1 @@
|
|||
vapoursynth
|
89
srcpkgs/vapoursynth-mvtools/files/example.py
Normal file
89
srcpkgs/vapoursynth-mvtools/files/example.py
Normal file
|
@ -0,0 +1,89 @@
|
|||
import vapoursynth as vs
|
||||
|
||||
# see http://avisynth.org.ru/mvtools/mvtools2.html
|
||||
# these configs will have around 75% usage with an FX-8350
|
||||
|
||||
def main():
|
||||
# don't interpolate if input is close to 60fps anyway
|
||||
if container_fps > 59:
|
||||
video_in.set_output()
|
||||
return
|
||||
|
||||
# basic config
|
||||
config = {
|
||||
'blksize': 16,
|
||||
'chroma': True,
|
||||
'search': 4,
|
||||
'searchparam': 4,
|
||||
}
|
||||
recalcconfig = {
|
||||
'blksize': 8,
|
||||
'chroma': True,
|
||||
'search': 5,
|
||||
'searchparam': 2,
|
||||
}
|
||||
|
||||
# use higher quality on 720p or lower
|
||||
if video_in.width * video_in.height <= 1280*720:
|
||||
config.update({
|
||||
'search': 5,
|
||||
'searchparam': 16,
|
||||
'blksize': 32,
|
||||
'badsad': 1000,
|
||||
'badrange': 32,
|
||||
'divide': 2,
|
||||
'overlap': 8,
|
||||
})
|
||||
recalcconfig.update({
|
||||
'search': 3,
|
||||
'blksize': 16,
|
||||
'overlap': 8,
|
||||
'dct': 8,
|
||||
})
|
||||
|
||||
interpolate(config, recalcconfig)
|
||||
|
||||
# first pass
|
||||
def analyse(sup, config):
|
||||
core = vs.get_core()
|
||||
bvec = core.mv.Analyse(sup, isb=True, **config)
|
||||
fvec = core.mv.Analyse(sup, isb=False, **config)
|
||||
return bvec, fvec
|
||||
|
||||
# optional second pass
|
||||
def recalculate(sup, bvec, fvec, config):
|
||||
core = vs.get_core()
|
||||
bvec = core.mv.Recalculate(sup, bvec, **config)
|
||||
fvec = core.mv.Recalculate(sup, fvec, **config)
|
||||
return bvec, fvec
|
||||
|
||||
def interpolate(config, recalcconfig=None):
|
||||
core = vs.get_core()
|
||||
clip = video_in
|
||||
|
||||
# Interpolating to fps higher than 60 is too CPU-expensive
|
||||
# Use interpolation from opengl video output
|
||||
dst_fps = display_fps
|
||||
while (dst_fps > 60):
|
||||
dst_fps /= 2
|
||||
|
||||
src_fps_num = int(container_fps * 1e8)
|
||||
src_fps_den = int(1e8)
|
||||
dst_fps_num = int(dst_fps * 1e4)
|
||||
dst_fps_den = int(1e4)
|
||||
|
||||
# Needed because clip FPS is missing
|
||||
clip = core.std.AssumeFPS(clip, fpsnum = src_fps_num, fpsden = src_fps_den)
|
||||
print("Reflowing from ",src_fps_num/src_fps_den," fps to ",dst_fps_num/dst_fps_den," fps.")
|
||||
|
||||
pad = config.get('blksize', 8)
|
||||
sup = core.mv.Super(clip, pel=1, hpad=pad, vpad=pad)
|
||||
bvec, fvec = analyse(sup, config)
|
||||
if recalcconfig:
|
||||
bvec, fvec = recalculate(sup, bvec, fvec, recalcconfig)
|
||||
clip = core.mv.FlowFPS(clip, sup, bvec, fvec, num=dst_fps_num, den=dst_fps_den, thscd2=90)
|
||||
|
||||
clip.set_output()
|
||||
|
||||
if __name__ == '__vapoursynth__':
|
||||
main()
|
22
srcpkgs/vapoursynth-mvtools/template
Normal file
22
srcpkgs/vapoursynth-mvtools/template
Normal file
|
@ -0,0 +1,22 @@
|
|||
# Template file for 'vapoutsynth-mvtools'
|
||||
pkgname=vapoursynth-mvtools
|
||||
version=13
|
||||
revision=1
|
||||
build_style=gnu-configure
|
||||
hostmakedepends="automake pkg-config libtool yasm"
|
||||
makedepends="fftw-devel vapoursynth-devel zimg-devel"
|
||||
short_desc="Set of filters for motion estimation and compensation"
|
||||
maintainer="lemmi <lemmi@nerd2nerd.org>"
|
||||
license="GPL-2"
|
||||
homepage="http://avisynth.org.ru/mvtools/mvtools2.html"
|
||||
distfiles="https://github.com/dubhater/vapoursynth-mvtools/archive/v${version}.tar.gz"
|
||||
checksum=941d204b82a99df837a36a0fbb733fef279a16525fd1676123eedd98a2a097ba
|
||||
|
||||
pre_configure() {
|
||||
./autogen.sh
|
||||
}
|
||||
|
||||
post_install() {
|
||||
vdoc readme.rst
|
||||
vsconf ${FILESDIR}/example.py
|
||||
}
|
36
srcpkgs/vapoursynth/template
Normal file
36
srcpkgs/vapoursynth/template
Normal file
|
@ -0,0 +1,36 @@
|
|||
# Template file for 'vapoursynth'
|
||||
pkgname=vapoursynth
|
||||
version=R32
|
||||
revision=1
|
||||
build_style=gnu-configure
|
||||
hostmakedepends="automake pkg-config libtool yasm python3 python-Cython python3.4-Cython"
|
||||
makedepends="python3.4-devel zimg-devel libmagick-devel libass-devel"
|
||||
short_desc="Application for video manipulation"
|
||||
maintainer="lemmi <lemmi@nerd2nerd.org>"
|
||||
license="LGPL-2"
|
||||
homepage="http://www.vapoursynth.com"
|
||||
distfiles="https://github.com/vapoursynth/vapoursynth/archive/$version.tar.gz"
|
||||
checksum=e9560f64ba298c2ef9e6e3d88f63ea0ab88e14bbd0e9feee9c621b9224e408c8
|
||||
|
||||
pre_configure() {
|
||||
./autogen.sh
|
||||
case $XBPS_TARGET_MACHINE in
|
||||
arm*musl)
|
||||
sed -i '/#include <sys\/auxv.h>/a #include <asm/hwcap.h>' src/core/cpufeatures.c
|
||||
sed -i -e 's/HWCAP_ARM_/HWCAP_/' src/core/cpufeatures.c
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
vapoursynth-devel_package() {
|
||||
depends="${sourcepkg}>=${version}_${revision}"
|
||||
short_desc+=" - development files"
|
||||
pkg_install() {
|
||||
vmove usr/include
|
||||
vmove usr/lib/pkgconfig
|
||||
vmove "usr/lib/*.a"
|
||||
vmove "usr/lib/*.so"
|
||||
}
|
||||
}
|
1
srcpkgs/zimg-devel
Symbolic link
1
srcpkgs/zimg-devel
Symbolic link
|
@ -0,0 +1 @@
|
|||
zimg
|
32
srcpkgs/zimg/template
Normal file
32
srcpkgs/zimg/template
Normal file
|
@ -0,0 +1,32 @@
|
|||
# Template file for 'zimg'
|
||||
pkgname=zimg
|
||||
version=2.0.4
|
||||
revision=1
|
||||
wrksrc=zimg-release-${version}
|
||||
build_style=gnu-configure
|
||||
hostmakedepends="automake libtool pkg-config"
|
||||
short_desc="Image processing library"
|
||||
maintainer="lemmi <lemmi@nerd2nerd.org>"
|
||||
license="WTFPL"
|
||||
homepage="https://github.com/sekrit-twc"
|
||||
distfiles="https://github.com/sekrit-twc/zimg/archive/release-${version}.tar.gz"
|
||||
checksum=e3b1f5b9f8ce750f96b9bc9801ff5d6aa931d35300d67711826e397df43c5245
|
||||
|
||||
pre_configure() {
|
||||
./autogen.sh
|
||||
}
|
||||
|
||||
post_install() {
|
||||
vlicense COPYING
|
||||
}
|
||||
|
||||
zimg-devel_package() {
|
||||
depends="${sourcepkg}>=${version}_${revision}"
|
||||
short_desc+=" - development files"
|
||||
pkg_install() {
|
||||
vmove usr/include
|
||||
vmove usr/lib/pkgconfig
|
||||
vmove "usr/lib/*.a"
|
||||
vmove "usr/lib/*.so"
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue