Home Download Ubuntu

How to play mp3's from terminal on Ubuntu server 9.10

If you have only terminal and you want to play some mp3 files, you can do it with a little application called mpg123 which is probably the most resource-efficient MP3 player. It has a built in equalizer, can be controled with terminal control keys, run playlists and much more.

You can install it from repositories by running:

sudo apt-get install mpg123


Examples:

1.To run a single file:

sudo mpg123 file.mp3


2.Run a playlist:

First we make a playlist for /home/user/music/ :

sudo find /home/user/music/ -name "*.mp3"|sed 's/\.\///;'|sort>List.lst


Now we play it and enable control keys (-C) :

sudo mpg123 --list List.lst -C


3.Shuffle-play a directory of MP3s:

sudo mpg123 -CZ /path/to/mp3/folder/*


-Z option is for shuffle, -C is for control

Control options:

By default use ’s’ to stop, ’p’ to pause, ’f’ to jump forward to the next song, ’b’ to jump back to the beginning of the song, ’,’ to rewind, ’.’ to fast forward, and ’q’ to quit.

4.Running with equalizer:

mpg123 comes with 32-band equalizer, but there's no graphical UI for that, you need to create the plain-text file.

sudo mpg123 -CZ -E party.txt mp3_file


Example of an .txt equalizer file:

# mpg123 equalizer file
# party theme
#
1 1
1 1
1 1
1 1
1 1
1 1
0.5 0.5
0.5 0.5
0.5 0.5
0.5 0.5
0.5 0.5
0.5 0.5
0.5 0.5
0.5 0.5
0.5 0.5
0.5 0.5
0.5 0.5
0.5 0.5
0.5 0.5
0.5 0.5
0.5 0.5
0.5 0.5
0.5 0.5
0.5 0.5
0.5 0.5
0.5 0.5
1 1
1 1
1 1
1 1
1 1
1 1



All command lines options:

usage: mpg123 [option(s)] [file(s) | URL(s) | -]
supported options [defaults in brackets]:
-v increase verbosity level -q quiet (don't print title)
-t testmode (no output) -s write to stdout
-w write Output as WAV file
-k n skip first n frames [0] -n n decode only n frames [all]
-c check range violations -y DISABLE resync on errors
-b n output buffer: n Kbytes [0] -f n change scalefactor [32768]
-r n set/force samplerate [auto] -g n set audio hardware output gain
-os,-ol,-oh output to built-in speaker,line-out connector,headphones
-a d set audio device
-2 downsample 1:2 (22 kHz) -4 downsample 1:4 (11 kHz)
-d n play every n'th frame only -h n play every frame n times
-0 decode channel 0 (left) only -1 decode channel 1 (right) only
-m mix both channels (mono) -p p use HTTP proxy p [$HTTP_PROXY]
-@ f read filenames/URLs from f -T get realtime priority
-z shuffle play (with wildcards) -Z random play
-u a HTTP authentication string -E f Equalizer, data from file
-C enable control keys --no-gapless not skip junk/padding in mp3s
-? this help --version print name + version
See the manpage mpg123(1) or call mpg123 with --longhelp for more parameters and information.


Resources: mpg123.de, facebook notes

0 comments:

Post a Comment