Skip to content

Instantly share code, notes, and snippets.

@iGlitch
Created August 4, 2019 23:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save iGlitch/8f8f54dcd7ced9bcb32188aafd9ec800 to your computer and use it in GitHub Desktop.
Save iGlitch/8f8f54dcd7ced9bcb32188aafd9ec800 to your computer and use it in GitHub Desktop.
my mpv config
###########
# General #
###########
vo=libmpv
cocoa-force-dedicated-gpu=yes
#load-stats-overlay=no
# OpenGL settings
gpu-api=opengl
opengl-pbo=yes
vd-lavc-dr=no
swapchain-depth=8
# vd-lavc-dr=yes # requires at least OpenGL v4.4
##################
# video settings #
##################
video-sync=display-resample
hwdec=auto
reset-on-next-file=audio-delay,mute,pause,speed,sub-delay,video-aspect,video-pan-x,video-pan-y,video-rotate,video-zoom,volume
######
# UI #
######
border=no # hide the window title bar
osc=no
#############
# OSD / OSC #
#############
osd-level=1 # enable osd and display --osd-status-msg on interaction
osd-duration=2500 # hide the osd after x ms
osd-status-msg='${time-pos} / ${duration}${?percent-pos: (${percent-pos}%)}${?frame-drop-count:${!frame-drop-count==0: Dropped: ${frame-drop-count}}}\n${?chapter:Chapter: ${chapter}}'
osd-font='Source Sans Pro'
osd-font-size=32
osd-color='#CCFFFFFF' # ARGB format
osd-border-color='#DD322640' # ARGB format
#osd-shadow-offset=1 # pixel width for osd text and progress bar
osd-bar-align-y=0 # progress bar y alignment (-1 top, 0 centered, 1 bottom)
osd-border-size=2 # size for osd text and progress bar
osd-bar-h=2 # height of osd bar as a fractional percentage of your screen height
osd-bar-w=60 # width of " " "
#macos-title-bar-material=dark # fullscreen (10.14+)
msg-color=yes # color log messages on terminal
term-osd-bar=yes # display a progress bar on the terminal
#no-hidpi-window-scale # used on 5K iMac to prevent scaling by OSX
force-window=immediate
cursor-autohide=1000 # autohide the curser after 1s
geometry=50%:50% # force 4k resolution output from on Macs, rather than using MacOS upscaling
# fullscreen = yes # start in fullscreen mode by default
############
# Playback #
############
deinterlace=no # global reset of deinterlacing to off
# don't allow a new window to have a size larger than 90% of the screen size
autofit-larger=90%x90%
# Disable the On Screen Controller (OSC).
osc=no
border=no
##############
# Colorspace #
##############
# see https://github.com/mpv-player/mpv/wiki/Video-output---shader-stage-diagram
icc-contrast=1000 # hides warnings about ICC errors; disable for OLED displays
# icc-profile-auto=yes # enable for OLED displays
target-prim=auto
# target-prim=bt.709
# target-prim=bt.2020 # target Rec.2020 (wide color gamut) for HDR TVs
target-trc=auto
gamma-auto
vf=format=colorlevels=full:colormatrix=auto
video-output-levels=full
tsacle=oversample
opengl-early-flush=no
##########
# Dither #
##########
dither-depth=auto
temporal-dither=yes
#############
# Debanding #
#############
deband=yes # enabled by default but disabled for 4K videos, below
deband-iterations=4 # deband steps
deband-threshold=20 # deband strength
deband-range=16 # deband range
deband-grain=0 # dynamic grain: set to "0" if using the static grain shader
#############
# Subtitles #
#############
sub-auto=fuzzy # external subs don't have to match the file name exactly to autoload
sub-file-paths-append=ass # search for external subs in these relative subdirectories
sub-file-paths-append=srt
sub-file-paths-append=sub
sub-file-paths-append=subs
sub-file-paths-append=subtitles
demuxer-mkv-subtitle-preroll # try to correctly show embedded subs when seeking
embeddedfonts=yes # use embedded fonts for SSA/ASS subs
sub-fix-timing=no # do not try to fix gaps (which might make it worse in some cases)
sub-ass-force-style=Kerning=yes # allows you to override style parameters of ASS scripts
sub-use-margins
sub-ass-force-margins
# the following options only apply to subtitles without own styling (i.e. not ASS but e.g. SRT)
sub-font="Source Sans Pro Semibold"
sub-font-size=36
sub-color="#FFFFFFFF"
sub-border-color="#FF262626"
sub-border-size=3.2
sub-shadow-offset=1
sub-shadow-color="#33000000"
sub-spacing=0.5
blend-subtitles=yes
#########################
# Motion Interpolation #
#########################
display-fps=60
video-sync=display-resample
interpolation=yes
tscale=oversample # smoothmotion
################
# Anti-Ringing #
################
scale-antiring=0.7 # luma upscale deringing
dscale-antiring=0.7 # luma downscale deringing
cscale-antiring=0.7 # chroma upscale deringing
############
# Profiles #
############
[4k60] # 2160p @ 60fps (3840x2160 UHDTV)
profile-desc=cond:((p["video-params/w"]>1920 and p["video-params/h"]>1080) and p["estimated-vf-fps"]>=31)
deband=no # turn off debanding because presume wide color gamut
interpolation=no # turn off interpolation because presume 60fps
# UHD videos are YUV420 so chroma upscaling is still needed
glsl-shaders-clr
glsl-shaders="~/.config/mpv/shaders/KrigBilateral.glsl"
interpolation=no # turn off interpolation because presume 60fps
[4k30] # 2160p @ 30fps (3840x2160 UHDTV)
profile-desc=cond:((p["video-params/w"]>1920 and p["video-params/h"]>1080) and p["estimated-vf-fps"]<31)
deband=no # turn off debanding because presume wide color gamut
# UHD videos are YUV420 so chroma upscaling is still needed
glsl-shaders-clr
glsl-shaders="~/.config/mpv/shaders/KrigBilateral.glsl"
[full-hd60] # 1080p @ 60fps (progressive ATSC)
profile-desc=cond:((p["video-params/w"]==1920 and p["video-params/h"]==1080) and not p["video-frame-info/interlaced"] and p["estimated-vf-fps"]>=31)
interpolation=no # turn off interpolation because already 60fps
[full-hd30] # 1080p @ 30fps (progressive Blu-ray)
profile-desc=cond:((p["video-params/w"]==1920 and p["video-params/h"]==1080) and not p["video-frame-info/interlaced"] and p["estimated-vf-fps"]<31)
[full-hd-interlaced] # 1080i @ 30fps (HDTV, interlaced Blu-rays)
profile-desc=cond:((p["video-params/w"]==1920 and p["video-params/h"]==1080) and p["video-frame-info/interlaced"])
vf=bwdif # apply FFMPEG's bwdif deinterlacer
[hd] # 720p @ 60 fps (HDTV, Blu-ray - progressive)
profile-desc=cond:(p["video-params/w"]==1280 and p["video-params/h"] == 720)
interpolation=no # turn off interpolation because already 60fps
[sdtv-pal] # 352x576, 480x576, 544x576, 720x576 @ 30fps (PAL broadcast or DVD - interlaced)
profile-desc=cond:((p["video-params/w"]==352 or p["video-params/w"]==480 or p["video-params/w"]==544 or p["video-params/w"]==720) and p["video-params/h"] == 576)
vf=bwdif # apply FFMPEG's bwdif deinterlacer
[sdtv-ntsc] # 640x480, 704x480, 720x480 @ 30fps (NTSC DVD - interlaced)
profile-desc=cond:((p["video-params/w"]==640 or p["video-params/w"]==704 or p["video-params/w"]==720) and p["video-params/h"]==480)
vf=bwdif # apply FFMPEG's bwdif deinterlacer
[default]
###################################
# 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
# Screenshot settings
screenshot-format=jpg
screenshot-jpeg-quality=95
screenshot-png-compression=8
screenshot-template='~/Downloads/%F (%P) %n'
# Helps play back UHDTV HEVC
vd-lavc-threads=16
# STREAMING
ytdl=yes
ytdl-format=0/(bestvideo[vcodec=vp9]/bestvideo[height>720]/bestvideo[fps=60])[tbr<13000]+(bestaudio[acodec=opus]/bestaudio)/best
###################################
# 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
# Etc
priority=abovenormal
[extension.webm]
loop-file=inf
[extension.jpg]
pause
[extension.png]
pause
[extension.gif]
loop-file=inf
# Keep the player window on top of all other windows.
#ontop=yes
##################
# audio settings #
##################
# Specify default audio driver (see --ao=help for a list).
#ao=alsa
# Disable softvol usage, and always use the system mixer if available.
#softvol=no
# Scale audio tempo by playback speed without altering pitch. (By default does
# nothing if playback speed is not changed. May introduce artifacts.)
#af=scaletempo
# Output 5.1 audio natively, and upmix/downmix audio with a different format.
#audio-channels=5.1
# Disable any automatic remix, _if_ the audio output accepts the audio format.
# of the currently played file.
#audio-channels=empty
#For both AC-3 and DTS passthrough, use ad=spdif:ac3,spdif:dts,
#ad=spdif:ac3,spdif:dts,
#On the fly decode 6 channel AAC to AC3 aka DolbyDigital, lavcac3enc[=tospdif[:bitrate[:minchn]]]
#af=scaletempo,lavcac3enc=yes:640:3
##################
# other settings #
##################
# If the file seems to be valid UTF-8, prefer UTF-8.
sub-codepage=utf8:cp1250
sub-scale-with-window=no
sub-text-font="Liberation Sans:style=Bold"
sub-text-font-size=60
sub-text-color=1/1/0
# disable screensaver
stop-screensaver = "yes"
# Pretend to be a web browser. Might fix playback with some streaming sites,
# but also will break with shoutcast streams.
#user-agent="Mozilla/55.0"
# cache settings
#
# Use 8MB input cache by default. The cache is enabled for network streams only.
#cache-default=8192
#
# Use 8MB input cache for everything, even local files.
#cache=8192
#
# If a seek is issued, and the target is 1024KB past the cached range, then
# keep reading until the seek target is hit, instead of doing a real seek.
#cache-seek-min=1024
#
# Disable the behavior that the player will pause if the cache goes below a
# certain fill size.
#cache-pause=no
#
# Read ahead about 5 seconds of audio and video packets.
#demuxer-readahead-secs=5.0
# SUBTITLE
slang=English,en,eng,und
ass-scale-with-window=yes
# AUDIO
alang=Japanese,jp,jpn,ja,English,en,eng
softvol=no
# Change subtitle encoding. For Arabic subtitles use 'cp1256'.
# If the file seems to be valid UTF-8, prefer UTF-8.
sub-codepage=utf8:cp1256
# Enable hardware decoding if available. Often, this requires using an certain
# video output, otherwise no hardware decoding will be used.
#hwdec=auto
# VIDEO
-hq:scale=ewa_lanczossharp:cscale=ewa_lanczossoft:interpolation:tscale=mitchell:scaler-resizes-only:dither-depth=8:temporal-dither:pbo:blend-subtitles:target-prim=bt.709:target-trc=bt.1886:source-shader=~/.config/mpv/deband.glsl
#vo=opengl:scale=ewa_lanczossharp:scale-antiring=0.5:cscale=ewa_lanczossharp:cscale-antiring=0.5:dscale=oversample:dscale-antiring=0.5:dither=ordered:dither-depth=auto:sigmoid-upscaling:sigmoid-center=0.80:sigmoid-slope=8.0:scaler-resizes-only:fancy-downscaling:pbo:fbo-format=rgba32f:source-shader=deband.glsl:interpolation:tscale=mitchell:tscale-antiring=0.5
framedrop=vo
############
# Profiles #
############
# The options declared as part of profiles override global default settings,
# but only take effect when the profile is active.
# The following profile can be enabled on the command line with: --profile=vdpau
#[vdpau]
# The profile forces the vdpau VO.
#vo=vdpau
# Use hardware decoding (this might break playback of some h264 files)
#hwdec=vdpau
# Most video filters do not work with hardware decoding.
#vf-clr=yes
#purple dankness
# Font for displaying the title and times.
font=Source Sans Pro Semibold
# Font size for the title. Integer
title-font-size=25
# Font size for time elapsed and remaining.
time-font-size=25
# Font size for hover time.
hover-time-font-size=26
# Manually calculated collision/placement metrics based on font
# sizes. Probably want to change these if you change the font or
# sizes. Unfortunately, my automated solution isn't easy to set up.
# Pixels.
hover-time-left-margin=120
hover-time-right-margin=130
# These primarily affect animations. If the script thinks the items
# are off screen, they won't be drawn. Positive numbers will look
# goofy.
elapsed-offscreen-pos=-100
remaining-offscreen-pos=-100
title-offscreen-pos=-40
# Progress bar foreground color. Format is BGR hex because ASS is dumb.
bar-foreground=FC799E
bar-background=2D2D2D
# Elapsed time foreground and background colors. BGR hex.
elapsed-foreground=FC799E
elapsed-background=2D2D2D
# Remaining time foreground and background colors. BGR hex.
remaining-foreground=FC799E
remaining-background=2D2D2D
# Hover time foreground and background colors. BGR hex.
hover-time-foreground=FC799E
hover-time-background=2D2D2D
# Title/playlist foreground and background colors. BGR hex.
title-foreground=FC799E
title-background=2D2D2D
# Pause indicator foreground and background colors. BGR hex.
pause-indicator-foreground=FC799E
pause-indicator-background=2D2D2D
# Height of area that shows bar when mouse is hovered over it, in
# pixels.
hover-zone-height=40
# The height of the top hover zone, in pixels.
top-hover-zone-height=40
# Inactive bar height in pixels. Can be 0.
bar-height-inactive=2
# Active (i.e. hovered) bar height in pixels. Should probably not be
# smaller than the inactive bar height, but this isn't actually
# checked.
bar-height-active=8
# Flash an icon in the center of the screen when pausing/unpausing.
pause-indicator=true
# How often the display is redrawn, in seconds. Affects smoothness of
# animations, but lower values may use more CPU (the default is
# negligible on my old C2D, and looks okay to me)
#redraw-period=0.03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment