minor mpv config cleanup
This commit is contained in:
@@ -1,28 +0,0 @@
|
||||
# vim: set ft=python:
|
||||
|
||||
import vapoursynth as vs
|
||||
from vapoursynth import core
|
||||
clip = video_in
|
||||
|
||||
#You can change the desired framerate here
|
||||
dst_fps = display_fps
|
||||
|
||||
#BlockSize can be changed to 16 for better performance
|
||||
BlockSize=8
|
||||
|
||||
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.")
|
||||
|
||||
#Pel can be changed to 4 for better accuracy or 1 for better speed
|
||||
sup = core.mv.Super(clip, pel=2, hpad=BlockSize, vpad=BlockSize)
|
||||
bvec = core.mv.Analyse(sup, blksize=BlockSize, isb=True , chroma=True, search=3, searchparam=1)
|
||||
fvec = core.mv.Analyse(sup, blksize=BlockSize, isb=False, chroma=True, search=3, searchparam=1)
|
||||
clip = core.mv.BlockFPS(clip, sup, bvec, fvec, num=dst_fps_num, den=dst_fps_den, mode=3, thscd2=12)
|
||||
|
||||
clip.set_output()
|
||||
@@ -1,78 +0,0 @@
|
||||
# vim: set ft=python:
|
||||
|
||||
# see the README at https://gist.github.com/phiresky/4bfcfbbd05b3c2ed8645
|
||||
# source: https://github.com/mpv-player/mpv/issues/2149
|
||||
# source: https://github.com/mpv-player/mpv/issues/566
|
||||
# source: https://github.com/haasn/gentoo-conf/blob/nanodesu/home/nand/.mpv/filters/mvtools.vpy
|
||||
|
||||
import vapoursynth
|
||||
|
||||
core = vapoursynth.core
|
||||
# ref: http://avisynth.org.ru/mvtools/mvtools2.html#functions
|
||||
# default is 400, less means interpolation will only happen when it will work well
|
||||
ignore_threshold = 400
|
||||
# if n% of blocks change more than threshold then don't interpolate at all (default is 51%)
|
||||
scene_change_percentage = 51
|
||||
|
||||
dst_fps = 144
|
||||
# Interpolating to fps higher than 60 is too CPU-expensive, smoothmotion can handle the rest.
|
||||
while dst_fps > 60:
|
||||
dst_fps /= 2
|
||||
|
||||
if "video_in" in globals():
|
||||
# realtime
|
||||
clip = video_in
|
||||
# Needed because clip FPS is missing
|
||||
src_fps_num = int(container_fps * 1e8)
|
||||
src_fps_den = int(1e8)
|
||||
clip = core.std.AssumeFPS(clip, fpsnum=src_fps_num, fpsden=src_fps_den)
|
||||
else:
|
||||
# run with vspipe
|
||||
clip = core.ffms2.Source(source=in_filename)
|
||||
dst_fps = float(dst_fps)
|
||||
|
||||
# resolution in megapixels. 1080p ≈ 2MP, 720p ≈ 1MP
|
||||
mpix = clip.width * clip.height / 1000000
|
||||
|
||||
# Skip interpolation for >1080p or 60 Hz content due to performance
|
||||
if not (mpix > 2.5 or clip.fps_num / clip.fps_den > 59):
|
||||
analParams = {
|
||||
"overlap": 0,
|
||||
"search": 3,
|
||||
"truemotion": True,
|
||||
#'chrome': True,
|
||||
#'blksize':16,
|
||||
#'searchparam':1
|
||||
}
|
||||
blockParams = {
|
||||
"thscd1": ignore_threshold,
|
||||
"thscd2": int(scene_change_percentage * 255 / 100),
|
||||
"mode": 3,
|
||||
}
|
||||
|
||||
# default 1.5 or so
|
||||
if mpix > 4.5:
|
||||
# can't handle these on Full HD with Intel i5-2500k
|
||||
# see the description of these parameters in http://avisynth.org.ru/mvtools/mvtools2.html#functions
|
||||
analParams["search"] = 0
|
||||
blockParams["mode"] = 0
|
||||
quality = "low"
|
||||
else:
|
||||
quality = "high"
|
||||
|
||||
dst_fps_num = int(dst_fps * 1e4)
|
||||
dst_fps_den = int(1e4)
|
||||
print(
|
||||
"Reflowing from {} fps to {} fps (quality={})".format(
|
||||
clip.fps_num / clip.fps_den, dst_fps_num / dst_fps_den, quality
|
||||
)
|
||||
)
|
||||
|
||||
sup = core.mv.Super(clip, pel=2)
|
||||
bvec = core.mv.Analyse(sup, isb=True, **analParams)
|
||||
fvec = core.mv.Analyse(sup, isb=False, **analParams)
|
||||
clip = core.mv.BlockFPS(
|
||||
clip, sup, bvec, fvec, num=dst_fps_num, den=dst_fps_den, **blockParams
|
||||
)
|
||||
|
||||
clip.set_output()
|
||||
@@ -1,45 +0,0 @@
|
||||
# vim: set ft=python:
|
||||
|
||||
import vapoursynth as vs
|
||||
|
||||
core = vs.core
|
||||
core.std.LoadPlugin(
|
||||
path="/usr/lib/python3.14/site-packages/vapoursynth/plugins/mvtools.so"
|
||||
)
|
||||
clip = video_in
|
||||
|
||||
dst_fps = display_fps
|
||||
# Interpolating to fps higher than 60 is too CPU-expensive, smoothmotion can handle the rest.
|
||||
while dst_fps > 60:
|
||||
dst_fps = 60
|
||||
|
||||
dst_fps = 144
|
||||
|
||||
# Skip interpolation for > 4K or 60 Hz content due to performance
|
||||
if not (clip.width > 3840 or clip.height > 2160 or container_fps > 59):
|
||||
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.",
|
||||
)
|
||||
|
||||
sup = core.mv.Super(clip, pel=2, hpad=16, vpad=16)
|
||||
bvec = core.mv.Analyse(
|
||||
sup, blksize=16, isb=True, chroma=True, search=3, searchparam=1
|
||||
)
|
||||
fvec = core.mv.Analyse(
|
||||
sup, blksize=16, isb=False, chroma=True, search=3, searchparam=1
|
||||
)
|
||||
clip = core.mv.BlockFPS(
|
||||
clip, sup, bvec, fvec, num=dst_fps_num, den=dst_fps_den, mode=3, thscd2=12
|
||||
)
|
||||
|
||||
clip.set_output()
|
||||
@@ -3,8 +3,8 @@
|
||||
# needs this in mpv's input.conf:
|
||||
# f run "/bin/sh" "-c" "hyprctl dispatch fullscreen toggle"; cycle fullscreen
|
||||
|
||||
|
||||
ü vf toggle format=yuv420p,vapoursynth="~/.config/mpv/filters/mvtools.vpy":4:4
|
||||
# using mvtools frame interpolation vapoursynth filter - needs mvtools python package:
|
||||
ü vf toggle format=yuv420p,vapoursynth="~/.config/mpv/filters/motioninterpolation-mvtools.vpy":4:4
|
||||
|
||||
### cool profiles function:
|
||||
# _ set profile FrameInterpolation #menu: Profiles > profile FrameInterpolation
|
||||
|
||||
+5
-65
@@ -1,55 +1,21 @@
|
||||
# profile=svp
|
||||
# profile=smoothmotion
|
||||
|
||||
# written by fennek182
|
||||
# version 1
|
||||
# last change: Wed 2026-01-21
|
||||
|
||||
#[smoothmotion]
|
||||
# see 2.1.2 High quality configurations
|
||||
# https://wiki.archlinux.org/title/mpv#High-quality-configurations
|
||||
#profile=high-quality
|
||||
#video-sync=display-resample
|
||||
#interpolation
|
||||
#tscale=oversample
|
||||
|
||||
# vf=vapoursynth="~/.config/mpv/filters/mvtools.vpy":buffered-frames=4:concurrent-frames=4
|
||||
|
||||
# video-sync=display-resample
|
||||
# interpolation = yes
|
||||
# tscale = box
|
||||
# tscale-clamp = 0.0
|
||||
# tscale-radius = 1.0
|
||||
# tscale-window = sphinx
|
||||
|
||||
# ========== PROFILES ==========
|
||||
# [svp]
|
||||
# input-ipc-server=/tmp/mpvsocket
|
||||
# version 2
|
||||
# last change: Thu 2026-06-11
|
||||
|
||||
input-ipc-server=/tmp/mpvsocket
|
||||
hr-seek-framedrop=no
|
||||
# watch-later-options-remove=vf
|
||||
hwdec=auto-copy
|
||||
hwdec-codecs=all
|
||||
|
||||
# [FrameInterpolation]
|
||||
# vf=vapoursynth="~/.config/mpv/filters/mvtools.vpy"
|
||||
# profile-restore = copy
|
||||
# ============================================
|
||||
|
||||
resume-playback=no
|
||||
volume-max=200
|
||||
cache=yes
|
||||
cache=auto
|
||||
keep-open
|
||||
ytdl-format=bestvideo+bestaudio/best
|
||||
|
||||
# set max cache size to 20 Gigabytes
|
||||
demuxer-max-bytes=21474836480
|
||||
|
||||
# ============== YT-DLP ==============
|
||||
# limit yt-dlp to 1440p60
|
||||
# ytdl-format=bestvideo[height<=?1440]+bestaudio/best
|
||||
ytdl-format=bestvideo+bestaudio/best
|
||||
# ============== YT-DLP ==============
|
||||
|
||||
# open window immediately (not waiting for yt-dlp)
|
||||
force-window=immediate
|
||||
|
||||
@@ -64,34 +30,8 @@ demuxer-lavf-o=activation_bytes=162dfd19
|
||||
# then mpv's built-in osc must be disabled
|
||||
# osc=no
|
||||
|
||||
# =============== TEST HDR 2026-01-21 ==============
|
||||
# Renderer:
|
||||
# gpu-next requires the latest (unreleased) git version of libplacebo and the latest (unreleased) git version of mpv.
|
||||
# It's still in testing/fixing/development stages and isn't recommended unless people want to test unfinished, bleeding-edge code.
|
||||
# The main benefits of GPU-Next are that it has much more efficient rendering code, and that it supports HDR tonemapping, including HDR/DV, and including HDR/DV to SDR (useful for Linux users since Linux lacks HDR support).
|
||||
# differences gpu/gpu-next: https://github.com/mpv-player/mpv/wiki/GPU-Next-vs-GPU
|
||||
|
||||
# vo=gpu-next
|
||||
# target-colorspace-hint=yes
|
||||
|
||||
# get apis by "mpv --gpu-api=help":
|
||||
# gpu-api=vulkan
|
||||
# gpu-context=waylandvk
|
||||
# =============== TEST HDR 2026-01-21 ==============
|
||||
|
||||
|
||||
# ----------- old - delete
|
||||
# --keepaspect-window (the default) will lock the window size to the video aspect.
|
||||
# --no-keepaspect-window disables this behavior, and will instead add black bars if window aspect and video aspect mismatch.
|
||||
# Whether this actually works depends on the VO backend. (Ignored in fullscreen mode.)
|
||||
# no-keepaspect-window
|
||||
|
||||
# target-colorspace-hint=yes
|
||||
# --tone-mapping=spline
|
||||
# profile=gpu-hq
|
||||
|
||||
# always open a new instance of mpv instead of replacing currently playing video
|
||||
#process-instance=multi
|
||||
|
||||
# use yt-dlp instead of youtube-dl since it's slow now (Oct 21)
|
||||
# script-opts=ytdl_hook-ytdl_path=/usr/bin/yt-dlp
|
||||
|
||||
Reference in New Issue
Block a user