nix: Add mpv

This commit is contained in:
Geoffrey Frogeye 2023-11-19 21:48:35 +01:00
parent 2d89e1b224
commit c9e0c79ab2
Signed by: geoffrey
GPG key ID: C72403E7F82E6AD8
6 changed files with 14 additions and 79 deletions

View file

View file

@ -1,71 +0,0 @@
# The thumbnail cache directory.
# On Windows this defaults to %TEMP%\mpv_thumbs_cache,
# and on other platforms to /tmp/mpv_thumbs_cache.
# The directory will be created automatically, but must be writeable!
# Use absolute paths, and take note that environment variables like %TEMP% are unsupported (despite the default)!
# cache_directory=%HOME%/.cache/mpv/thumbnails
cache_directory=/tmp/my_mpv_thumbnails
# THIS IS NOT A WINDOWS PATH. COMMENT IT OUT OR ADJUST IT YOURSELF.
# Whether to generate thumbnails automatically on video load, without a keypress
# Defaults to yes
autogenerate=no
# Only automatically thumbnail videos shorter than this (in seconds)
# You will have to press T (or your own keybind) to enable the thumbnail previews
# Set to 0 to disable the check, ie. thumbnail videos no matter how long they are
# Defaults to 3600 (one hour)
autogenerate_max_duration=3600
# Use mpv to generate thumbnail even if ffmpeg is found in PATH
# ffmpeg is slightly faster than mpv but lacks support for ordered chapters in MKVs,
# which can break the resulting thumbnails. You have been warned.
# Defaults to yes (don't use ffmpeg)
prefer_mpv=no
# Explicitly disable subtitles on the mpv sub-calls
# mpv can and will by default render subtitles into the thumbnails.
# If this is not what you wish, set mpv_no_sub to yes
# Defaults to no
mpv_no_sub=no
# Enable to disable the built-in keybind ("T") to add your own, see after the block
disable_keybinds=no
# The maximum dimensions of the thumbnails, in pixels
# Defaults to 200 and 200
thumbnail_width=200
thumbnail_height=200
# The thumbnail count target
# (This will result in a thumbnail every ~10 seconds for a 25 minute video)
thumbnail_count=150
# The above target count will be adjusted by the minimum and
# maximum time difference between thumbnails.
# The thumbnail_count will be used to calculate a target separation,
# and min/max_delta will be used to constrict it.
# In other words, thumbnails will be:
# - at least min_delta seconds apart (limiting the amount)
# - at most max_delta seconds apart (raising the amount if needed)
# Defaults to 5 and 90, values are seconds
min_delta=5
max_delta=90
# 120 seconds aka 2 minutes will add more thumbnails only when the video is over 5 hours long!
# Below are overrides for remote urls (you generally want less thumbnails, because it's slow!)
# Thumbnailing network paths will be done with mpv (leveraging youtube-dl)
# Allow thumbnailing network paths (naive check for "://")
# Defaults to no
thumbnail_network=no
# Override thumbnail count, min/max delta, as above
remote_thumbnail_count=60
remote_min_delta=15
remote_max_delta=120
# Try to grab the raw stream and disable ytdl for the mpv subcalls
# Much faster than passing the url to ytdl again, but may cause problems with some sites
# Defaults to yes
remote_direct_stream=yes

View file

@ -1,4 +0,0 @@
no-audio-display
save-position-on-quit
# Required by thumbnails script
osc=no

View file

@ -1 +0,0 @@
/usr/share/mpv/scripts/mpv_thumbnail_script_client_osc.lua

View file

@ -1 +0,0 @@
/usr/share/mpv/scripts/mpv_thumbnail_script_server.lua

View file

@ -380,6 +380,20 @@
pass.enable = true; pass.enable = true;
}; };
autorandr.enable = true; autorandr.enable = true;
mpv = {
enable = true;
config = {
audio-display = false;
save-position-on-quit = true;
osc = false; # # Required by thumbnail script
};
scripts = with pkgs.mpvScripts; [ thumbnail ];
scriptOpts = {
mpv_thumbnail_script = {
cache_directory = "/tmp/mpv_thumbs_${config.home.username}";
};
};
};
}; };
xdg = { xdg = {
@ -493,8 +507,6 @@
# multimedia common # multimedia common
gimp gimp
inkscape inkscape
mpv
mpvScripts.thumbnail
libreoffice libreoffice
# data management # data management