#!/usr/bin/env bash
apt install -y mpv

mkdir -p ~/.config/mpv

## https://www.dotslashlinux.com/2017/03/31/optimal-mpv-configuration/
## Low cpu
cat > ~/.config/mpv/mpv.conf<< 'EOF'
#profile=opengl-hq
#scale=ewa_lanczossharp
#cscale=ewa_lanczossoft
#dscale=mitchell
#scale-antiring=0.7
#cscale-antiring=0.7
#dither-depth=auto
#correct-downscaling=yes
#sigmoid-upscaling=yes
#deband=no
#volume-max=100
#hwdec=vaapi
ytdl-format=bestvideo[height<=?640][fps<=?30][vcodec!=?vp9]+bestaudio/best

[default]


#########
# Cache #
#########

cache=yes
demuxer-max-bytes=400MiB
demuxer-max-back-bytes=150MiB

###################################
# Protocol Specific Configuration #
###################################

[protocol.https]
cache=yes
user-agent='Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:57.0) Gecko/20100101 Firefox/58.0'

[protocol.http]
cache=yes
user-agent='Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:57.0) Gecko/20100101 Firefox/58.0'
EOF

#
## Quality over performance
#cat > ~/.config/mpv/mpv.conf << 'EOF'
#profile=opengl-hq
#scale=ewa_lanczossharp
#cscale=ewa_lanczossoft
#dscale=mitchell
#scale-antiring=0.7
#cscale-antiring=0.7
#dither-depth=auto
#correct-downscaling=yes
#sigmoid-upscaling=yes
#deband=no
#volume-max=100
#hwdec=auto
#EOF
