mpg123/mpg321 – The Command Line MP3 Players

Written by BinnyVA on February 25, 2008 – 1:25 am -

Terminal

So far we looked at the GUI MP3 Players for linux – like Amarok, Exile, XMMS etc. Most linux users need only that – but there are some people who want a simpler system – command line players. The two top players in this area are mpg123 and mpg321.

mpg123

mpg123 is a fast, free, minimalist, console MPEG audio player software program for UNIX and Linux operating systems. The development on this project ceased for a long time – but now it has a new maintainer.

mpg321

mpg321 is a clone of mpg123.

Installation

Most distros have mpg321 in their repositories(not all have mpg123) – so just log in as root and use these commands to install it…
yum install mpg321 – For RedHat, Fedora, CentOS etc.
OR
apt-get install mpg321 – For Debian, Ubuntu, etc.

Using mpg321

Using mpg321 is straight forward. Since it has no GUI, just go to the folder with the song and just execute the command…

mpg321 MP3_FILE_NAME

If you want to play all the songs in a folder, you have to create a list of files in that folder. Then you have to specify this list as an argument for the mpg321 command. These commands can get the job done…

Create a list of all MP3 Files in the current folder…

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

Use this list as the play list for mpg321

mpg123 --list List.lst

Why Use Command Line Players?

If we have a number of shiny GUI players, why should one use a command line player? Unless you are an anti-GUI command line guru, chances are you don’t need it. But still, it has its uses.

For example, if you have to restart the X Server often for some reason, then mpg321 is the best player for you. All other player will stop playing when X server is down.

This actually happend to me – when I bought my second LCD screen, it took me some time to configure it. And that meant editing the xorg.conf file and restarting the X Server to see if it worked. At that time, I opened a virtual terminal(Ctrl+Alt+F1) and opened mpg321 with a bunch of MP3s in the list. It kept playing even if the X server is down. This is propably the reason that I was still sane after around six hours of XOrg configuration. :-)


del.icio.us | Digg it | reddit | StumbleUpon

Tags: , , , , ,
Posted in Audio, Command Line, Tools | 11 Comments »

11 Comments to “mpg123/mpg321 – The Command Line MP3 Players”

  1. Alex says:

    Don’t forget madplay. If you already have mplayer installed, that will play mp3s from the command line too (in addition to every other type of audio file).

  2. [...] 4 – LinDesk » mpg123/mpg321 – The Command Line MP3 Players [...]

  3. [...] are no shortage of audio players in Linux. It has everything from command line MP3 players(mpg123) to RAM eating GUI players(like Amarok). With easily available codecs, linux supports almost all [...]

  4. Natalie says:

    Then obviously I need the MPG321 player..
    sanity is high on my list of priorities and I will take any assistance I can get…:-)

  5. JiomCM says:

    Fantastic!
    The mpg123, solve or end my problem/difficulty!
    Thanks to Adriano:
    http://www.virgos.com.br/portal/
    And yours…
    I used this command:

    #vi /etc/rc.local

    mpg123 -Z /../../MP3/*
    exit 0

    Thanks

  6. Arjay says:

    Simplicity!

  7. [...] am not writing too much about this – considering the fact that I have already wrote a post about mpg123/mpg321 in the audio player [...]

  8. erik says:

    mplayer is another good one. I use it for most of my music-playing desires as my music is all in folders (artist/album/songs) so I just cd to the album’s folder and type in mplayer *

  9. will says:

    Hello, thanks for this. I have a question though. In the example where you play all the songs in a folder couldn’t you just enter the folder you want to play then type in mpg321 *.mp3. The only reason I am asking is I am kind of new to computers and I was wondering if there is something wrong with doing that. Just a lot simpler. Anyways thanks again.

  10. Laks says:

    Hello… I wanted to install the player but I get a error..
    Reading package lists… Error!
    E: Encountered a section with no Package: header
    E: Problem with MergeList /var/lib/apt/lists/extras.ubuntu.com_ubuntu_dists_natty_main_binary-i386_Packages
    E: The package lists or status file could not be parsed or opened.

    Any help is appreciated

  11. haunted sounds says:

    i will be working with a Raspberry Pi and am needing a minimal audio player that can output different sounds to different audio devices ~7-12 different ones. can you specify what device you want this program to use? ex: mpg321 MP3_FILE_NAME HARDWARE_LOCATION ?

Leave a Comment