diff --git a/.config/mpv/mpv.conf b/.config/mpv/mpv.conf new file mode 100644 index 0000000..5ffba62 --- /dev/null +++ b/.config/mpv/mpv.conf @@ -0,0 +1,238 @@ +# MPV - mpv.conf +# classicjazz - 2023-12-18 + +# Details about configuring MPV for high quality video are covered here: https://freetime.mikeconnelly.com/archives/5371 +# The latest version of this file is located here: https://github.com/classicjazz/mpv-config + +# All MPV options are covered here: https://github.com/mpv-player/mpv/blob/master/DOCS/man/options.rst +# All of my upscaling calculations assume a native 4K resolution display + +# This configuration file uses the vo=gpu-next (which now works on MacOS) +# https://github.com/mpv-player/mpv/wiki/GPU-Next-vs-GPU + +# This config file assumes that you are using a version of MPV that supports Conditional Profiles (i.e. auto-profiles.lau is no longer required). Tested with mpv v0.37, FFmpeg 6.0, and MoltenVK v1.2.6 on MacOS Sonoma 14.1. + + +########### +# General # +########### + +# Default profile +# Selected API: select either Vulkan (preferred) or OpenGL +vo=gpu-next +gpu-api=vulkan +hwdec=auto # enable best HW decoder; turn off for software decoding + +# Additional Vulkan settings +vulkan-async-compute=yes +vulkan-async-transfer=yes +vulkan-queue-count=1 + vd-lavc-dr=yes + +# Additional OpenGL settings +# gpu-api=opengl + +reset-on-next-file=audio-delay,mute,pause,speed,sub-delay,video-aspect-override,video-pan-x,video-pan-y,video-rotate,video-zoom,volume +framedrop=no + + +###### +# UI # +###### + +border=no # hide the window title bar +msg-color=yes # color log messages on terminal +term-osd-bar=yes # display a progress bar on the terminal +force-window=immediate +cursor-autohide=1000 # autohide the curser after 1s +geometry=3840x2160 # force 4k resolution output on Macs, rather than using MacOS upscaling +no-hidpi-window-scale # used on 5K iMac to prevent scaling by OSX +fullscreen=yes # start in fullscreen mode by default + +macos-title-bar-appearance=vibrantDark +macos-title-bar-material=popover +macos-fs-animation-duration=0 + +sub-font="SFProRounded-Medium" +sub-font-size=32 +sub-border-size=1 + + +############ +# Playback # +############ + +deinterlace=no # global reset of deinterlacing to off + + +############## +# Colorspace # +############## + +target-prim=auto +# target-prim=bt.709 # target Rec.709 for SDR TVs +# target-prim=bt.2020 # target Rec.2020 (wide color gamut) for HDR TVs +target-trc=auto +vf=format=colorlevels=full:colormatrix=auto +video-output-levels=full + + +########## +# Dither # +########## + +dither-depth=auto +temporal-dither=yes +dither=fruit + + +############# +# Debanding # +############# + +deband=yes # enabled by default +deband-iterations=4 # deband steps +deband-threshold=35 # deband strength +deband-range=16 # deband range +deband-grain=5 # dynamic grain: set to "0" if using the static grain shader + + +######################### +# Motion Interpolation # +######################### + +display-fps-override=60 +video-sync=display-resample +interpolation=yes +tscale=oversample # smoothmotion + + +################ +# Anti-Ringing # +################ + +scale-antiring=0.6 # luma upscale deringing using libplacebo +# dscale-antiring=0.7 # luma downscale deringing; currently does nothing with vo=gpu-next +# cscale-antiring=0.7 # chroma upscale deringing; currently does nothing with vo=gpu-next + + +############################################################# +# Upscaling & Processing Based on Source Video's Resolution # +############################################################# + +# Chroma subsampling means that chroma information is encoded at lower resolution than luma +# In MPV, chroma is upscaled to luma resolution (video size) and then the converted RGB is upscaled to target resolution (screen size) +# For a detailed analysis of upscaler/downscaler quality, see https://artoriuz.github.io/blog/mpv_upscaling.html +# For overview of MPV's video output, see https://github.com/mpv-player/mpv/wiki/Video-output---shader-stage-diagram + +# Currently, this configuration defaults to: Ravu for luma upscaling and Chroma from Luma (CfL) for chroma upscaling +# If your computer is powerful enough to run ArtCNN, then you can change the comments, below, for luma doubling + + +############ +# Profiles # +############ + +[4k60] # 2160p @ 60fps (3840x2160 UHDTV) +profile-desc=4k60 +profile-cond=((width ==3840 and height ==2160) and p["estimated-vf-fps"]>=31) +deband=no # turn off debanding because presume wide color gamut +interpolation=no # turn off interpolation because presume 60fps +glsl-shader="~/.config/mpv/shaders/CfL_Prediction.glsl" # UHD videos are YUV420 so chroma upscaling is needed +# UHD videos are already 4K so no luma upscaling is needed +interpolation=no # no motion interpolation is required +# no deinterlacer required because presume progressive + +[4k30] # 2160p @ 24-30fps (3840x2160 UHDTV) +profile-cond=((width ==3840 and height ==2160) and p["estimated-vf-fps"]<31) +deband=no # turn off debanding because presume wide color gamut +glsl-shader="~/.config/mpv/shaders/CfL_Prediction.glsl" # UHD videos are YUV420 so chroma upscaling is needed +# UHD videos are already 4K so no luma upscaling is needed +# apply motion interpolation +# no deinterlacer required because presume progressive + +[full-hd60] # 1080p @ 60fps (progressive ATSC) +profile-desc=full-hd60 +profile-cond=((width ==1920 and height ==1080) and not p["video-frame-info/interlaced"] and p["estimated-vf-fps"]>=31) +glsl-shader="~/.config/mpv/shaders/CfL_Prediction.glsl" # HD videos are YUV420 so chroma upscaling is needed +# glsl-shader="~/.config/mpv/shaders/ArtCNN_C4F16.glsl" # luma upscaling (doubler) +glsl-shader="~/.config/mpv/shaders/ravu-lite-ar-r4.hook" # luma upscaling (doubler) +interpolation=no # no motion interpolation is required +# no deinterlacer required because presume progressive + +[full-hd30] # 1080p @ 24-30fps (NextGen TV/ATSC 3.0, progressive Blu-ray) +profile-desc=full-hd30 +profile-cond=((width ==1920 and height ==1080) and not p["video-frame-info/interlaced"] and p["estimated-vf-fps"]<31) +glsl-shader="~/.config/mpv/shaders/CfL_Prediction.glsl" # HD videos are YUV420 so chroma upscaling is needed +# glsl-shader="~/.config/mpv/shaders/ArtCNN_C4F16.glsl" # luma upscaling (doubler) +glsl-shader="~/.config/mpv/shaders/ravu-lite-ar-r4.hook" # less resource intensive luma upscaling (doubler) +# apply motion interpolation +# no deinterlacer required because presume progressive + +[full-hd-interlaced] # 1080i @ 24-30fps (HDTV, interlaced Blu-rays) +profile-desc=full-hd-interlaced +profile-cond=((width ==1920 and height ==1080) and p["video-frame-info/interlaced"] and p["estimated-vf-fps"]<31) +glsl-shader="~/.config/mpv/shaders/CfL_Prediction.glsl" # HD videos are YUV420 so chroma upscaling is needed +# glsl-shader="~/.config/mpv/shaders/ArtCNN_C4F16.glsl" # luma upscaling (doubler) +glsl-shader="~/.config/mpv/shaders/ravu-lite-ar-r4.hook" # less resource intensive luma upscaling (doubler) +# apply motion interpolation +vf=bwdif=mode=1 # apply FFMPEG's bwdif deinterlacer + +[hd] # 720p @ 60 fps (HDTV, Blu-ray - progressive) +profile-desc=hd +profile-cond=(width ==1280 and height ==720) +glsl-shader="~/.config/mpv/shaders/CfL_Prediction.glsl" # HD videos are YUV420 so chroma upscaling is needed +glsl-shader="~/.config/mpv/shaders/ravu-zoom-ar-r3.hook" # luma upscaling (fractional) +interpolation=no # no motion interpolation is required +# no deinterlacer is required + +[sdtv-ntsc] # 640x480, 704x480, 720x480 @ 30fps (NTSC DVD - interlaced) +profile-desc=sdtv-ntsc +profile-cond=((width ==640 and height ==480) or (width ==704 and height ==480) or (width ==720 and height ==480)) +glsl-shader="~/.config/mpv/shaders/CfL_Prediction.glsl" # SD videos are YUV420 so chroma upscaling is needed +glsl-shader="~/.config/mpv/shaders/ravu-zoom-ar-r3.hook" # luma upscaling (fractional) +# apply motion interpolation +vf=bwdif=mode=1 # apply FFMPEG's bwdif deinterlacer + +[sdtv-pal] # 352x576, 480x576, 544x576, 720x576 @ 30fps (PAL broadcast or DVD - interlaced) +profile-desc=sdtv-pal +profile-cond=((width ==352 and height ==576) or (width ==480 and height ==576) or (width ==544 and height ==576) or (width ==720 and height ==576)) +glsl-shader="~/.config/mpv/shaders/CfL_Prediction.glsl" # SD videos are YUV420 so chroma upscaling is needed +glsl-shader="~/.config/mpv/shaders/ravu-zoom-ar-r3.hook" # luma upscaling (fractional) +# apply motion interpolation +vf=bwdif=mode=1 # apply FFMPEG's bwdif deinterlacer + + + +################################### +# Protocol Specific Configuration # +################################### + +[protocol.http] +hls-bitrate=max # use max quality for HLS streams +cache=yes +no-cache-pause # don't pause when the cache runs low + +[protocol.https] +profile=protocol.http + +[protocol.ytdl] +profile=protocol.http + +ytdl-format=bestvideo[height<=?3080p]+bestaudio/best + +sub-antialiasing=yes +screenshot-format=png +screenshot-directory=/tmp/ +# Audio sample format +audio-channels=stereo +audio-format=f32 +# Audio resampler +scaletempo=yes +# Passthrough audio +audio-passthrough=yes +# Audio sync options +audio-delay-correction=true +demuxer-thread=yes +demuxer-rawvideo-fps=23 +demuxer-rawaudio-rate=384000