mpv: ship mpv-webm tool for clipping videos

This commit is contained in:
Colin 2024-05-25 00:55:40 +00:00
parent 30c677fafc
commit e407467e55
3 changed files with 88 additions and 1 deletions

View File

@ -5,6 +5,7 @@
# - <https://github.com/mpv-player/mpv/wiki>
# extensions i use:
# - <https://github.com/jonniek/mpv-playlistmanager>
# - <https://github.com/ekisu/mpv-webm>
# other extensions that could be useful:
# - list: <https://github.com/stax76/awesome-mpv>
# - list: <https://nudin.github.io/mpv-script-directory/>
@ -148,6 +149,7 @@ in
scripts = [
pkgs.mpvScripts.mpris
pkgs.mpvScripts.mpv-playlistmanager
pkgs.mpvScripts.mpv-webm
uosc
# pkgs.mpv-uosc-latest
];
@ -213,6 +215,9 @@ in
# for `watch_later`
".local/state/mpv"
];
persist.byStore.private = [
"Videos/mpv"
];
fs.".config/mpv/scripts/sane_cast/main.lua".symlink.target = ./sane_cast/main.lua;
fs.".config/mpv/scripts/sane_sysvol/main.lua".symlink.target = ./sane_sysvol/main.lua;
fs.".config/mpv/scripts/sane_sysvol/non_blocking_popen.lua".symlink.target = ./sane_sysvol/non_blocking_popen.lua;
@ -222,6 +227,7 @@ in
fs.".config/mpv/script-opts/console.conf".symlink.target = ./console.conf;
fs.".config/mpv/script-opts/uosc.conf".symlink.target = ./uosc.conf;
fs.".config/mpv/script-opts/playlistmanager.conf".symlink.target = ./playlistmanager.conf;
fs.".config/mpv/script-opts/webm.conf".symlink.target = ./webm.conf;
# mime.priority = 200; # default = 100; 200 means to yield to other apps
mime.priority = 50; # default = 100; 50 in order to take precedence over vlc.

View File

@ -19,7 +19,7 @@ s script-binding uosc/subtitles #! Subtitles
a script-binding uosc/audio #! Audio tracks
q script-binding uosc/stream-quality #! Stream quality
p script-binding uosc/items #! Playlist
c script-binding uosc/chapters #! Chapters
# c script-binding uosc/chapters #! Chapters
> script-binding uosc/next #! Navigation > Next
< script-binding uosc/prev #! Navigation > Prev
o script-binding uosc/open-file #! Navigation > Open file

View File

@ -0,0 +1,81 @@
# Defaults to shift+w
keybind=c
# If empty, saves on the same directory of the playing video.
# A starting "~" will be replaced by the home dir.
# This field is delimited by double-square-brackets - [[ and ]] - instead of
# quotes, because Windows users might run into a issue when using
# backslashes as a path separator. Examples of valid inputs for this field
# would be: [[]] (the default, empty value), [[C:\Users\John]] (on Windows),
# and [[/home/john]] (on Unix-like systems eg. Linux).
# The [[]] delimiter is not needed when using from a configuration file
# in the script-opts folder.
output_directory=~/Videos/mpv
run_detached=no
# Template string for the output file
# %f - Filename, with extension
# %F - Filename, without extension
# %T - Media title, if it exists, or filename, with extension (useful for some streams, such as YouTube).
# %s, %e - Start and end time, with milliseconds
# %S, %E - Start and end time, without milliseconds
# %M - "-audio", if audio is enabled, empty otherwise
# %R - "-(height)p", where height is the video's height, or scale_height, if it's enabled.
# More specifiers are supported, see https://mpv.io/manual/master/#options-screenshot-template
# Property expansion is supported (with %{} at top level, ${} when nested), see https://mpv.io/manual/master/#property-expansion
output_template=%F-%S-%E
# Scale video to a certain height, keeping the aspect ratio. -1 disables it.
scale_height=-1
# Change the FPS of the output video, dropping or duplicating frames as needed.
# -1 means the FPS will be unchanged from the source.
fps=-1
# Target filesize, in kB. This will be used to calculate the bitrate
# used on the encode. If this is set to <= 0, the video bitrate will be set
# to 0, which might enable constant quality modes, depending on the
# video codec that's used (VP8 and VP9, for example).
target_filesize=7500
# If true, will use stricter flags to ensure the resulting file doesn't
# overshoot the target filesize. Not recommended, as constrained quality
# mode should work well, unless you're really having trouble hitting
# the target size.
strict_filesize_constraint=no
strict_bitrate_multiplier=0.95
# In kilobits.
strict_audio_bitrate=128
# Sets the output format, from a few predefined ones.
# Currently we have:
# av1
# hevc
# webm-vp9 (libvpx-vp9/libopus)
# avc (h264/AAC)
# avc-nvenc (h264-NVENC/AAC)
# webm-vp8 (libvpx/libvorbis)
# gif
# mp3 (libmp3lame)
# and raw (rawvideo/pcm_s16le).
output_format=webm-vp8
# twopass=yes
twopass=no
# If set, applies the video filters currently used on the playback to the encode.
apply_current_filters=yes
# If set, writes the video's filename to the "Title" field on the metadata.
write_filename_on_metadata=no
# Set the number of encoding threads, for codecs libvpx and libvpx-vp9
threads=4
additional_flags=
# Constant Rate Factor (CRF). The value meaning and limits may change,
# from codec to codec. Set to -1 to disable.
crf=10
# Useful for flags that may impact output filesize, such as qmin, qmax etc
# Won't be applied when strict_filesize_constraint is on.
non_strict_additional_flags=
# Display the encode progress, in %. Requires run_detached to be disabled.
# On Windows, it shows a cmd popup. "auto" will display progress on non-Windows platforms.
display_progress=auto
# The font size used in the menu. Isn't used for the notifications (started encode, finished encode etc)
font_size=28
margin=30
message_duration=5
# gif dither mode, 0-5 for bayer w/ bayer_scale 0-5, 6 for paletteuse default (sierra2_4a)
gif_dither=2
# Force square pixels on output video
# Some players like recent Firefox versions display videos with non-square pixels with wrong aspect ratio
force_square_pixels=no