summaryrefslogtreecommitdiff
path: root/.local/bin/mpvsel
blob: 3ffd8e8208c83c654e0fc6788aac57d9e4f8e63c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh
# references:
# https://www.rockyourcode.com/til-how-to-watch-youtube-videos-with-mpv-and-keyboard-shortcuts/
# https://github.com/mpv-player/mpv/issues/7792

fps=30
height=$SCRHEIGHT

while getopts f:h: opt; do
	case $opt 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 "$(xsel -ob)" || notify-send "mpvsel failed"