mpg123 - Linux command line to play mp3Follow @ggarron
mpg123 is an application available in your repositories, so you can install for example in Debian
apt-get install mpg123
This command lets you play mp3 files from the command line quite easy.
mpg123 [options] file or URL
-k num, --skip num Skip first num frames. By default the decoding starts at the first frame. -n num, --frames num Decode only num frames. By default the complete stream is decoded. -y, --resync Do NOT try to resync and continuing decoding if an error occurs in the input file. Normally, mpg123 tries to keep the playback alive at all costs, including skipping invalid material and searching new header when something goes wrong. With this switch you can make it bail out on data errors (and perhaps spare your ears a bad time). Note that this switch may either disappear in future or its meaning be revised since it now does the opposite of what it suggests. -p URL | none, --proxy URL | none The specified proxy will be used for HTTP requests. It should be specified as full URL (‘‘http://host.domain:port/’’), but the ‘‘http://’’ prefix, the port number and the trailing slash are optional (the default port is 80). Specifying none means not to use any proxy, and to retrieve files directly from the respec? tive servers. See also the ‘‘HTTP SUPPORT’’ section. -u auth, --auth auth HTTP authentication to use when recieving files via HTTP. The format used is user:password. -@ file, --list file Read filenames and/or URLs of MPEG audio streams from the speci? fied file in addition to the ones specified on the command line (if any). Note that file can be either an ordinary file, a dash ‘‘-’’ to indicate that a list of filenames/URLs is to be read from the standard input, or an URL pointing to a an appropriate list file. Note: only one -@ option can be used (if more than one is specified, only the last one will be recognized). -l n, --listentry n Of the playlist, play specified entry only. n is the number of entry starting at 1. A value of 0 is the default and means playling the whole list, a negative value means showing of the list of titles with their numbers... -z, --shuffle Shuffle play. Randomly shuffles the order of files specified on the command line, or in the list file. -Z, --random Continuous random play. Keeps picking a random file from the command line or the play list. Unlike shuffle play above, ran? dom play never ends, and plays individual songs more than once.
You can run more than one file just entering more files at the command line, like this:
mpg123 Cinderella\ -\ Gold\ \(Remastered\ 2006\)\ CD1\ 08\ through_the_rain.mp3 Cinderella\ -\ Gold\ \(Remastered\ 2006\)\ CD1\ 09\
The output will be something like this, first the song number 1, and then the second, and third, and so on.
hard_to_find_the_words.mp3 High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3 version 0.61; written and copyright by Michael Hipp and others free software (LGPL/GPL) without any warranty but with best wishes Playing MPEG stream 1 of 2: Cinderella - Gold (Remastered 2006) CD1 08 through_the_rain.mp3 ... Note: Xing/Lame/Info header detected Title: Through The Rain Artist: Cinderella Album: Gold (Remastered) Year: 2006 Genre: Rock MPEG 1.0 layer III, VBR, 44100 Hz joint-stereo [5:08] Decoding of Cinderella - Gold (Remastered 2006) CD1 08 through_the_rain.mp3 finished. Playing MPEG stream 2 of 2: Cinderella - Gold (Remastered 2006) CD1 09 hard_to_find_the_words.mp3 ... Note: Xing/Lame/Info header detected Title: Hard To Find The Words Artist: Cinderella Album: Gold (Remastered) Year: 2006 Genre: Rock MPEG 1.0 layer III, VBR, 44100 Hz joint-stereo