summaryrefslogtreecommitdiff
path: root/.local/bin/mpvsel
diff options
context:
space:
mode:
authorxyz <gky44px1999@gmail.com>2021-08-11 19:26:57 -0700
committerxyz <gky44px1999@gmail.com>2021-08-11 19:26:57 -0700
commit646545945cbaacd85ac637bc2b4e58ecd399050a (patch)
treedf5a2614f92ca27e2b2c1ee81f260d91374b1529 /.local/bin/mpvsel
parentf06f03b1c1c06ddb8568e81a435cfd99ff9d5d29 (diff)
mpvsel options for fps and height
Diffstat (limited to '.local/bin/mpvsel')
-rwxr-xr-x.local/bin/mpvsel15
1 files changed, 14 insertions, 1 deletions
diff --git a/.local/bin/mpvsel b/.local/bin/mpvsel
index 6bb9641c..b6bc34ea 100755
--- a/.local/bin/mpvsel
+++ b/.local/bin/mpvsel
@@ -3,4 +3,17 @@
# https://www.rockyourcode.com/til-how-to-watch-youtube-videos-with-mpv-and-keyboard-shortcuts/
# https://github.com/mpv-player/mpv/issues/7792
-mpv --ytdl-format='bestvideo[height<=?900][fps<=?30][vcodec!^=?vp9][vcodec!^=?av01]+bestaudio/best[height<=?900][fps<=?30][vcodec!^=?vp9][vcodec!^=?av01]' --ytdl-raw-options='write-sub=,sub-lang="en,en-US,en-GB,zh-CN,zh-Hans,zh-Hant,zh-HK,zh-SG,zh-TW"' --fs --speed=2 --af=rubberband=pitch-scale=0.981818181818181 "$(xsel -ob)"
+fps=30
+height=900
+
+while getopts h:f: f; do
+ case $f in
+ f) fps="$OPTARG";;
+ h) height="$OPTARG";;
+ \?) exit 1;;
+ esac
+done
+
+vformat="[height<=?$height][fps<=?$fps][vcodec!^=?vp9][vcodec!^=?av01]"
+
+mpv --ytdl-format="bestvideo$vformat+bestaudio/best$vformat" --ytdl-raw-options='write-sub=,sub-lang="en,en-US,en-GB,zh-CN,zh-Hans,zh-Hant,zh-HK,zh-SG,zh-TW"' --fs --speed=2 --af=rubberband=pitch-scale=0.981818181818181 "$(xsel -ob)"