mpv scripts

This commit is contained in:
Q
2024-10-11 22:01:36 +03:00
parent a1736fc56c
commit e89408bbdb
6 changed files with 213 additions and 0 deletions

67
av/mpvsub Executable file
View File

@@ -0,0 +1,67 @@
#!/bin/bash
if [[ "$1" = "-h" ]]; then
echo "View video with subs with mpv. Arguments: video-file subs-file"
echo "if subs omitted, tries to search for the file"
exit
fi
. qolop &> /dev/null
_qCol export &> /dev/null
echo -e "${_cW}${_cU}# MPV shortcuts
${_cZ}${_cG}
Modifiers: c = CTRL
| Key | Playback | | Key | Audio |
|:-------|:---------------------------| |:-------|:----------------------|
| p | Pause | | m | Mute |
| s | Screenshot | | 9/0 | Modify volume |
| S | Screenshot without subs | | c-+/- | Change audio delay |
| Q | Quit saving position | | # | Change audio track |
| ,/. | Seek frame |
| <-/-> | Seek 5 seconds | | Key | Subtitles |
| up/dn | Seek 60 seconds | |:-------|:----------------------|
| < / > | Prev/Next file | | v | Subtitle toggle |
| [/] | Change speed | | j/J | Change subtitle |
| o | Show progress | | z/x | Change subtitle delay |
| O | Progress toggle | | r/t | Subtitles up / down |
| Key | Video |
|:-------|:---------------------------|
| f | Fullscreen |
| T | Toggle video on top |
| A | Cycle aspect ratio |
| 1/2 | Modify contrast |
| 3/4 | Modify brightness |
| 5/6 | Modify gamma |
| 7/8 | Modify saturation |
| w/e | Zoom in / out (fullscreen) |
${_cZ}"
if [[ -f "$1" ]]; then
vid="$1"
else
vid=$( ls -S | head -n 1 )
fi
if [[ -f "$2" ]]; then
sub="$2"
else
sub=$( ls | grep -i srt$ | head -n 1 )
if [[ ! -f "$sub" ]]; then
sub=$( find . -maxdepth 2 -type f | grep -i srt$ | head -n 1 )
fi
fi
echo Video: $vid
echo Subs: $sub
read -t4 -n1 foo
if [[ -f "$sub" ]]; then
mpv --really-quiet --sub-file="$sub" "$vid"
else
mpv --really-quiet "$vid"
fi