mplayer (nogui) cheat sheet

Discuss a HowTo.

Moderator: How-to Curator

mplayer (nogui) cheat sheet

Postby meandean » February 17th, 2011, 12:17 am

meandean
 

Re: mplayer (nogui) cheat sheet

Postby huggybear » February 17th, 2011, 12:57 am

Nice!

Code: Select all
Skip 10 s forward         Right
Skip 10 s back            Left

Skip 1 min forward         Up
Skip 1 min back            Down

Skip 10 min forward         Page Up
Skip 10 min back            Page Down

Zoom in                  e
Zoom out                  w

Toggle subtitles               v
<< I guess that makes them "DEBITARDS" ..... >>
User avatar
huggybear
 
Posts: 1408
Joined: February 9th, 2011, 6:54 pm
Location: Gargantua's cookie jar

Re: mplayer (nogui) cheat sheet

Postby Grifter » February 17th, 2011, 4:20 am

1 brightness down
2 brightness up
3 contrast down
4 contrast up
5 hue down
6 hue up
7 saturation down
8 saturation up
9 volume down
0 volume up

[ speed down 10%
{ speed down 50%

] speed up 10%
} speed up 50%

j switch subtitles (if multiple are loaded)
User avatar
Grifter
 
Posts: 23
Joined: February 10th, 2011, 1:16 pm

Re: mplayer (nogui) cheat sheet

Postby demosthenese » March 30th, 2011, 11:51 pm

I sometimes find + and - useful to tweak the audio sync.
User avatar
demosthenese
 
Posts: 112
Joined: February 14th, 2011, 11:19 pm
Location: Liverpool, UK

Re: mplayer (nogui) cheat sheet

Postby weedeater64 » April 18th, 2011, 5:55 pm

I never figured out how to play every song in a directory, but I did figure out how to make a playlist.

<edit;
don't know why I couldn't figure this out before, but
~$ mplayer *
/edit>

I have all of my music in one folder, so

~$ ls > playlist

mplayer -playlist playlist

Similarly I can make playlists from chunks, for instance

jeff@optiplex:/media/usb0/MUSIC$ ls |grep AC
AC-DC - Back In Black.mp3
ACDC - Big Balls.mp3
ACDC - DC - Dirty Deeds Done Dirt Cheap.mp3
AC-DC - Girls Got Rhythm.mp3
AC-DC - Have A Drink On Me.mp3
AC-DC - Hells Bells.mp3
ACDC - Highway To Hell.mp3
AC-DC - It's A Long Way To The Top (If You Wanna Rock 'N' Roll).mp3
AC-DC - Moneytalks.mp3
AC-DC - Rock & Roll Ain't Noise Pollution.mp3
AC-DC - Shoot To Thrill.mp3
AC-DC - Thunderstruck.mp3
AC-DC - T-N-T-.mp3
ACDC - you shook me all night long - AC-DC.mp3

jeff@optiplex:/media/usb0/MUSIC$ ls |grep AC > acdc.pls

Loves me some mplayer, gnome-mplayer, clive.
I'm done with flash-plugin crap. yay
Last edited by weedeater64 on April 19th, 2011, 12:16 am, edited 1 time in total.
weedeater64
 
Posts: 27
Joined: April 18th, 2011, 4:45 pm

Re: mplayer (nogui) cheat sheet

Postby debil » April 18th, 2011, 7:00 pm

Here's a little (and rather futile) wrapper for mplayer-nogui. It creates a playlist of all audio files in the specified directory and plays the stuff in random order. Also, it can doze (ie. sleep) for a time specified before it starts playing. Maybe it does something else as well, can't remember. Name it how you like (I use doze), chmod 755, put into your ~/bin and run doze -h for usage. Modify as you please.

Code: Select all
#!/bin/bash

# --- Change the values according to your taste ---
AUDIOPATH="$HOME"/audio/
PLAYLISTDIR="$HOME"/audio/playlists
# -------------------------------------------------

AUDIOPLAYER=$(which mplayer)
PLAYLIST="$PLAYLISTDIR"/$(basename "$0")-all

if [ ! -n $AUDIOPLAYER ]; then
    echo "Install mplayer and try again."
    exit 1
fi

make_playlist () {

   TEMPLIST=$(mktemp -p "$HOME" $(basename "$0").XXXXXXXX --suffix=.tmp)

    if [ -d "$PLAYLISTDIR" ]; then
        touch "$PLAYLIST"
    else
        mkdir -p "$PLAYLISTDIR"
        touch "$PLAYLIST"
    fi

   find $AUDIOPATH -print -type f > "$TEMPLIST"
    grep -i 'mp3$' "$TEMPLIST" > "$PLAYLIST"
   grep -i 'ogg$' "$TEMPLIST" >> "$PLAYLIST"
   grep -i 'm4a$' "$TEMPLIST" >> "$PLAYLIST"
   # Mplayer doesn't support MIDI files but they're audio anyway, kind of.
   # Uncomment if wanted.
   #grep -i 'mid$' "$TEMPLIST" >> "$PLAYLIST"
   grep -i 'wma$' "$TEMPLIST" >> "$PLAYLIST"
   grep -i 'flac$' "$TEMPLIST" >> "$PLAYLIST"
   grep -i 'mp4$' "$TEMPLIST" >> "$PLAYLIST"

   rm "$TEMPLIST"

    echo Total files: $(wc -l "$PLAYLIST")
}

checkplay() {
   if [ ! -f "$PLAYLIST" ]; then
      make_playlist
      $AUDIOPLAYER -shuffle -playlist $PLAYLIST
   else
      $AUDIOPLAYER -shuffle -playlist $PLAYLIST
   fi
}

usage() {
    cat << EOF
Usage: $(basename "$0") [ARG]

  <digit>         Doze for <digit> seconds and start playing
  <digit>m         Doze for <digit> minutes and start playing
  <digit>h         Doze for <digit> hours and start playing
  -c | --create         Create playlist w/o playing it
  -h | --help         Show this help
  -d | --dir <dir>      Play all audio files in <dir>
  -t | --track <path>      Play just one track
  <digit> path-to-track      "Alarm with a certain track." Doze for <digit>
            and play specified track, continuing with
            random play

            w/o ARG playing starts immediately
EOF
}

# Show usage
if [ "$1" == "-h" -o "$1" == "--help" ]; then
    usage
    exit 0
fi

# Just create playlist w/o playing it
if [ "$1" == "-c" -o "$1" == "--create" ]; then
    make_playlist
    exit 0
fi

# Play directory
if [ "$1" == "-d" -o "$1" == "--dir" ]; then
    if [ ! -n "$2" ]; then
        echo "No argument given. Aborting."
        exit 1
    else
        if [[ "$2" != */ ]]; then
            DIR="$2"/
        else
            DIR="$2"
        fi
        $AUDIOPLAYER "$DIR"*
        exit 0
    fi
fi

# Play a track
if [ "$1" == "-t" -o "$1" == "--track" ]; then
    if [ ! -n "$2" ]; then
        echo "No argument given. Aborting."
        exit 1
    else
        $AUDIOPLAYER "$2"
        exit 0
    fi
fi

if [ "$1" == "-p" -o "$1" == "--playlist" ]; then
    if [ ! -n "$2" ]; then
        echo "No argument given. Aborting."
        exit 1
    else
        $AUDIOPLAYER -playlist "$2"
        exit 0
    fi
fi

if [ "$1" == "-ps" -o "$1" == "--playlistshuffle" ]; then
    if [ ! -n "$2" ]; then
        echo "No argument given. Aborting."
        exit 1
    else
        $AUDIOPLAYER -shuffle -playlist "$2"
        exit 0
    fi
fi

# Start playing immediately
if [ "$#" -eq 0 ]; then
    checkplay
    exit 0
fi

# Doze first
if [ "$#" -eq 1 ]; then
    sleep "$1"
    checkplay
    exit 0
fi

# Doze and play "alarm"
if [ "$#" -eq 2 ]; then
    sleep "$1"
    $AUDIOPLAYER "$2"
    checkplay
    exit 0
fi
Q: Why is the Eunux kernel so bloated?
A: It was made in the image of its founder.
User avatar
debil
 
Posts: 494
Joined: February 9th, 2011, 12:02 pm
Location: Mazes of Menace with all the puddings...


Return to HowTo Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

x