mpv scripts
This commit is contained in:
53
av/mpvmontage
Executable file
53
av/mpvmontage
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ "$1" = "-h" ]]; then
|
||||
echo "View multiple videos together. Maximum three files."
|
||||
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 [[ -z "$3" ]]; then
|
||||
mpv \
|
||||
--lavfi-complex="[vid1][vid2]hstack[vo]" \
|
||||
"$1" --external-file="$2"
|
||||
else
|
||||
|
||||
mpv \
|
||||
--lavfi-complex="[vid1][vid2][vid3]hstack=inputs=3[vo]" \
|
||||
"$1" --external-files="$2:$3"
|
||||
|
||||
fi
|
||||
90
av/mpvmusic
Executable file
90
av/mpvmusic
Executable file
@@ -0,0 +1,90 @@
|
||||
#!/bin/bash
|
||||
|
||||
_list_audio_files() {
|
||||
if [[ $recursive -eq 0 ]]; then
|
||||
files=$( ls -p | grep -v /$ )
|
||||
else
|
||||
files=$( find . -type f )
|
||||
fi
|
||||
echo "$files" | \
|
||||
grep -i -e \.mp3$ -e \.ogg$ -e \.flac$ | \
|
||||
sort -V | \
|
||||
awk '{print "'"$PWD"'/"$0}'
|
||||
}
|
||||
|
||||
_print_audio_files() {
|
||||
n=$( wc -l "$1" | awk '{print $1}' )
|
||||
i=0
|
||||
while read line; do
|
||||
i=$(( i + 1 ))
|
||||
printf "%s/%s %s\n" \
|
||||
$i $n "$( basename "$line" )"
|
||||
done < "$1"
|
||||
}
|
||||
|
||||
_play() {
|
||||
mpv \
|
||||
--keep-open=no \
|
||||
--audio-display=no \
|
||||
--term-osd-bar \
|
||||
--msg-level=ffmpeg/audio=fatal,ad=fatal \
|
||||
--playlist="$1" $MPV_ARGS
|
||||
}
|
||||
|
||||
echo ' -r recursive
|
||||
MPV_ARGS=.. to pass them..
|
||||
|
||||
# MPV audio shortcuts'
|
||||
qolop c Y
|
||||
echo '
|
||||
| Key | Command |
|
||||
|:-------|:---------------------------|
|
||||
| p | Pause |
|
||||
| Q | Quit saving position |
|
||||
| <-/-> | Seek 5 seconds |
|
||||
| up/dn | Seek 60 seconds |
|
||||
| < / > | Prev/Next file |
|
||||
| [/] | Change speed |
|
||||
| m | Mute |
|
||||
| 9/0 | Modify volume |
|
||||
| * / | Modify volume |
|
||||
'
|
||||
qolop c Z
|
||||
|
||||
recursive=0
|
||||
for (( i=1; i<=$#; i++ )); do
|
||||
[[ "${!i}" = "-r" ]] && {
|
||||
recursive=1;
|
||||
continue
|
||||
}
|
||||
done
|
||||
|
||||
if [[ -e "$1" ]]; then
|
||||
if [[ "$1" = *".m3u8" ]]; then
|
||||
_play "$1"
|
||||
exit $?
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
playlistfile=$( mktemp )
|
||||
if [[ $recursive -eq 1 ]]; then
|
||||
_list_audio_files > "$playlistfile"
|
||||
else
|
||||
if [[ -n "$1" ]]; then
|
||||
for (( i=1; i<=$#; i++ )); do
|
||||
readlink -f "${!i}" >> "$playlistfile"
|
||||
done
|
||||
else
|
||||
_list_audio_files > "$playlistfile"
|
||||
fi
|
||||
fi
|
||||
|
||||
_print_audio_files "$playlistfile"
|
||||
if [[ -s "$playlistfile" ]]; then
|
||||
_play "$playlistfile"
|
||||
else
|
||||
echo Playlist empty
|
||||
fi
|
||||
|
||||
rm -f "$playlistfile"
|
||||
67
av/mpvsub
Executable file
67
av/mpvsub
Executable 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
|
||||
Reference in New Issue
Block a user