[MPlayer-users] Cycle through available subtitles key binding
Eli the Bearded
mplayer at eli.users.panix.com
Thu May 30 09:38:48 EEST 2024
On Sat, 11 May 2024, Walter Alejandro Iglesias <wai at roquesor.com> wrote:
> Anyways, the only feature I miss from mpv is being able to store the
> current playback position when I exit the application.
I'll give my answer to this below
> And the only question I have now is if there's some way to bind a key to
> the "sub_select" command to be able to cycle through subtitles in the
> same way the default keybindings (J and j) allow you. My first attempt
> was to put the following in ~/.mplayer/input.conf:
>
> J sub_select +1
> K sub_select -1
I'm not sure of how to rebind it and very rarely use it, but standard
binding has this:
j and J
Cycle through the available subtitles.
y and g
Step forward/backward in the subtitle list.
Do the y/g ones work for you?
As for the playback position thing:
I started to use "touch NNN" where NNN is the seconds through playback
shown in the output, eg "30" (rounding down from 30.5) here:
V: 30.5 0/ 0 43% 39% 0.0% 0 0
Then I'd use "mplayer -ss NNN ..." with tab complete helping me.
Eventually that evolved in a full on shell script.
I've included the script below for anyone interested. Written for ksh,
bash should work instead.
Elijah
------
#!/bin/ksh
# mplayer wrapper for movies
#
# Should need no args, but any can be passed through to
# mplayer. An explicit '-ss N' will override a bookmark
# file, but a 'restart' file overrides everything.
#
# A useful arg: -vf screenshot then use 's' to screenshot
#
# Semi-Automatic bookmark:
# If there is a file of two to five digits in the
# current directory, use that as a starting point
# (100: one minute forty seconds; 10000: two hours
# forty-six minutes forty seconds). This format bookmark
# is easy to use with mplayer. When you quit mplayer,
# the last few lines of output look like:
#
# V: 811.2 0/ 0 70% 4% 0.0% 0 0
#
# Exiting... (Quit)
#
# So, "touch 800" or "touch 811" would be a good bookmark.
# If multiple such files exist, which one gets used is
# indeterminate.
#
# A file just named "restart" contains a full command line, a book for
# for a specific invokation, useful for shows with multiple episodes
# in a directory. Eg:
# echo > RESTART mplayer -fs *s01e04*
#
# Checks for a movie with suffix: *.mkv *.avi *.webm *.mpg *.mpeg *.mp4 *.wmv *.ogv
usecommand=
start=
movie=
rar=
origIFS="$IFS"
IFS='
' # just newline for the ls
# sort by size (-S), largest last (-r), to avoid samples and excerpts
for file in $(ls -rS) ; do
case "$file" in
# something to play
*.[oO][gG][vV]) movie="$file" ;;
*.[mM][pP]4) movie="$file" ;;
*.[mM][pP][eE][gG]) movie="$file" ;;
*.[mM][pP][gG]) movie="$file" ;;
*.[wW][eE][bB][mM]) movie="$file" ;;
*.[aA][vV][iI]) movie="$file" ;;
*.[mM][kK][vV]) movie="$file" ;;
*.[wW][mM][vV]) movie="$file" ;;
# might be useful to have a rar
*[pP][aA][rR][tT]01.[rR][aA][rR]) rar="$file" ;;
*[pP][aA][rR][tT][0-9][0-9].[rR][aA][rR]) : ignore others ;;
*.[rR][aA][rR]) rar="$file" ;;
# bookmark file
[1-9][0-9]) start="-ss $file" ;;
[1-9][0-9][0-9]) start="-ss $file" ;;
# older verion only used four digit bookmarks, some zero padded
0[1-9][0-9][0-9]) start="-ss ${file#0}" ;;
00[0-9][0-9]) start="-ss ${file#00}" ;;
[1-9][0-9][0-9][0-9]) start="-ss $file" ;;
[1-9][0-9][0-9][0-9][0-9]) start="-ss $file" ;;
# The restart file contains a full command line, a bookmark for a specific
# invocation, useful for shows with multiple episodes in a directory
restart|RESTART) movie="$( head -1 $file )"
usecommand="sh $file"
;;
esac
done
# restore
IFS="$origIFS"
if [ "X$movie" = X ] ; then
echo "Did not find a video file.";
if [ "X$rar" != X ] ; then
echo "But found a rar. Hang on.";
nice unrar e "$rar" && exec $0 "$@"
fi
exit 1
fi
# guard against sample and rar
if [ "Xusecommand" = X -a "X$rar" != X ] ; then
lcmovie=$(echo "$movie" | tr '[:upper:]' '[:lower:]')
case "$lcmovie" in
*sample*)
echo "We appear to have a sample next to a rar; extracting real."
nice unrar e "$rar" && exec $0 "$@"
exit 2
;;
*trailer*)
echo "We appear to have a trailer next to a rar; extracting real."
nice unrar e "$rar" && exec $0 "$@"
exit 2
;;
esac
fi
full=-fs
# unset internal parameters if similar on command line
case "$@" in *-ss\ *) start= ;; esac
case "$@" in *-fs*) full= ;; esac
if [ x"$usecommand" = x ] ; then
mplayer $start $full "$@" "$movie"
else
$usecommand
fi
exit $?
More information about the MPlayer-users
mailing list