Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Install a command-line MP3 player UNIX
I just installed mpg123, a command line MP3 player. It's not as comfortable to use as iTunes, but it works fine. A benefit of the command line interface is that it uses very little memory and less than half the CPU as compared to iTunes - a big plus if you are on an older G3. The binary is available on macosx.forked.net.

[Editor's note: In case you'd like to install this yourself from source, it's not that difficult. You'll need the Dev Tools installed, of course, but after that, just download the 0.59r source from the mpg123 homepage linked above, then visit the mpg123 OS X port page on SourceForge and download the patch files. Expand the archive, then read and follow the directions in README.MACOSX (basically rename a file, then 'make macosx' and 'sudo make install'). Once installed, typing 'mpg123 /path/to/mp3_file' will play the specified MP3 file. Type 'mpg123' without any parameters to see a command list.]
    •    
  • Currently 2.80 / 5
  You rated: 2 / 5 (5 votes cast)
 
[16,662 views]  

Install a command-line MP3 player | 20 comments | Create New Account
Click here to return to the 'Install a command-line MP3 player' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Fink makes it easier
Authored by: paulio on May 01, '02 01:13:15PM
If you have Fink installed then all you have to do is to go into Terminal and type:
fink install mpg123
Fink will download, compile, and install mpg123, including any programs or libraries that it requires.

Note that you will need the developer tools whichever way you choose to do it.

[ Reply to This | # ]

Developer Tools
Authored by: paulio on May 01, '02 01:19:52PM

Actually, I'm wrong about the Developer tools:

You will NOT need the Developer Tools if you install the binary from macosx.forked.net.

You will need the Developer Tools if you install either from source or using Fink.



[ Reply to This | # ]
Flaky behavior?
Authored by: sjonke on May 01, '02 01:31:49PM
Anyone else get flaky behavior with mpg123? It seems that usually (always?) I have to enter the command twice for it to work once. This may only be the case with mp3 streams. I have primarily been using it with streams. Anyway, the first time I (for example) type in:
mpg123 "http://205.188.234.67:8048/"
it fails. I up arrow and press enter (do the command again) and it works. Note that I installed the forked.net package form of this program.

[ Reply to This | # ]
Flaky behavior?
Authored by: dm2243 on May 09, '02 11:10:15AM

That streams works ok for me - but others (e.g., massinova) play back at triple speed.

what are other folks' experiences with streams?

dm



[ Reply to This | # ]
Flaky behavior?
Authored by: bluehz on May 29, '02 10:10:38AM

I can not get any streams to play in mpg123

I try mpg123 "http://205.188.234.67:8048/" (which happens tobe the stream I wante dto listen to anyway)
and get Error reading from socket or unexpected EOF.

Strangely enough - I can occasionally get the lower rate 32k radioParadise stream - but it plays back at triple+ speed.

Anyone have a solution?



[ Reply to This | # ]
Doesn't seem to support Standard Input from Pipe and parameters?
Authored by: josephaw on May 01, '02 03:59:24PM

mpg123 does work well at the command line on my G4 400.
But I wanted to create a drag and drop application for my dock. Figured I use applescript but I found that applescript had ':' in the path of the files selected.
So I added a sed editor to the data coming from applescript to globally strip the data coming from applescript from ':' to '/' but then I found that I could not take the data from sed and pipe it to mpg123.
Tried placing the sed command after the mpg123 command withing single quotes to get it to run the sed first, but mpg123 seems to be ignoring the results of the sed running.
Also noticed that applescript does not show the /Volumes/ in the path so I would still need to test to see if the file exists in local and Volume locations before giving up on the file dropped.
Bottom line. I guess I'll have to dabble in the Project builder to make a C program for the dock that can parse the data coming from the dropping of mp3's to it.
Or maybe someone out there has already done this and can save me the work.
Also, have you noticed that none of the command line parameters seem to work, but that may be documented already.
I have been waiting patiently for SoundApp to be ported because I want a very simple mp3 player for the dock.
Thanks, JosephAW



[ Reply to This | # ]
Doesn't seem to support Standard Input from Pipe and parameters?
Authored by: sjonke on May 01, '02 04:46:54PM
It may or may not fit the bill, but take a look at Mu which is an Aqua GUI for mpg123. Seems not too bad in my so far very brief tryout, but I can't figure out how to add a URL (stream) to the playlist. It doesn't look like it's possible.

[ Reply to This | # ]
Applescript shell script 101
Authored by: sjonke on May 01, '02 05:39:26PM

Well, precisely one lesson. You want to use "POSIX path". For example:

set someFile to choose file
get POSIX path of someFile

That will return the familiar unix style path to a file, folder or whatever. Note that you don't have to enter the capitalization - script editor will do that for you when you hit Enter, like it or not. :)



[ Reply to This | # ]
Great with MC
Authored by: jasenko on May 01, '02 06:04:30PM

I've been using it for a while now and just like in Linux you can use it within Midnight Commander (mc). Just press Enter/Return key on the song while browsing your filesystem



[ Reply to This | # ]
playlist file
Authored by: sinjin on May 01, '02 11:10:35PM

anyone know how to set one up? I've created a text file with the path names and it seems to work fine for the first song but then can't read the others. I tried both Mac and PC format carriage returns (ala Text Edit Plus).

Thanks in advance, Mark



[ Reply to This | # ]
playlist file
Authored by: sjonke on May 02, '02 09:52:27AM

You almost certainly need to use UNIX format, not Mac or Windows format. BBEdit (including, I believe, the free Lite version) will do this for you and probably others. Note, however, that I have not actually tried it.



[ Reply to This | # ]
playlist file
Authored by: sinjin on May 02, '02 12:29:03PM

BBEdit Lite worked like a charm. Save with UNIX line breaks is an option in the save dialog.

Thanks so much!



[ Reply to This | # ]
Found another use for mpg123, Startup Sound!
Authored by: josephaw on May 02, '02 11:25:32AM

Since mpg123 is a command line player I decided that I could use it as a startup sound player for OSX.

I created a folder in /Library/ called 'StartupSound' and placed a mp3 file in there called 'StartupSound.mp3' then I edited the '/etc/rc' file. (Note you want to make a backup of the 'rc' file before editing it.) If your not sure, maybe someone else can document it for the lay persons. But to those who know how, I placed the following line in just before the '# Start System Services' line at the bottom:

##
# Startup Sound
##

/usr/local/bin/mpg123 -q /Library/StartupSound/StartupSound.mp3 &


You can see that it's running the mpg123 program and playing the selected sound file. I tried to use a '*.mpg' so it would play all files, but it doesn't support that with a full path infront and I didn't want to 'cd' to that library folder because I didn't want to interfere with the default directory where ever the 'rc' file was at that line in the file. So I just used relative file paths for now. In future mpg123 version it may support wildcarding in the relative path and then it can play all sound in that folder. For now just place the sound file you want to hear in there with the right name and it will play away as the system is starting up.
Also you may notice that it's running in the background so it can be very long too. I tried to put the mpg123 in quiet mode but it doens't seem to hear that parameter, but maybe future ones will. Maybe someone can add the parameter to redirect standard output and standard error to null, I forgot the exact syntex for that for now.

Have fun and let me know what you thing and how it can be made better.
JosephAW



[ Reply to This | # ]
just some notes
Authored by: marcv on May 03, '02 05:58:57AM

A dropbox for mpg123 would be great!
Anyway here are my simple tricks:
Playlists: 1) just type mpg123 <space> in Terminal and drop a whole
bunch of mp3's at once onto the terminal window.
2) Use Mu to make the playlists. type mpg123 -@ and drop the .m3u

Mu is nice, but it uses 15x the memory of mpg123 alone, is based on
a prerelease version and crashes a lot. In one incident mpg123 kept on playing
the playlist after Mu crashed, frontend-fun.



[ Reply to This | # ]
Check this!
Authored by: marcv on May 03, '02 07:10:44AM

Found another mpg123 based player, mpegToaster, from
http://www.toastedmarshmallow.com/Applications/index.html
They claim to use an optimized version (CoreAudio) of mpg123,
there's also an Altivec optimized version.
this seems to be true, CPU usage is only ±50% of mpg123 on
my iBook.
skips less too. memory usage is very low compared to Mu.
playlist format different from mpg123.



[ Reply to This | # ]
Startup Sound works but...
Authored by: josephaw on May 03, '02 10:36:07AM

I noticed that when it's playing a mp3 when the login prompt appears, the music will cease. I think that's because the INIT level is changing and it kills anything running under the old init.
josephaw



[ Reply to This | # ]
Found another use for mpg123, Startup Sound!
Authored by: josephaw on May 07, '02 05:52:01PM

Command Line Update:
/usr/bin/find /Library/StartupSound/ -name "*.mp3" | /usr/local/bin/mpg123 -@ - -q &

Plays all sound files in folder until init change.
Thanks guys for the help.
JosephAW



[ Reply to This | # ]
Random Play
Authored by: victory on May 07, '02 09:13:23AM
The following may be useful if you want to use mpg123 as a random jukebox. (These examples assume your music folder is /Volumes/Storage/Music) mpg123 won't descend into subdirectories when looking for MP3s to play. This can be a problem when attempting to feed it a folder of music created by iTunes, which likes to store things in /Music/Artist/Album/Songs.mp3 format. Instead you can use the following:

find /Volumes/Storage/Music/ -name "*.mp3" | mpg123 -Z --list -

(On the other hand, if you *do* have all your MP3s piled in one huge folder, it would be just as easy to do 'mpg123 -Z /Volumes/Storage/AllMyMusic/*.mp3')

If you want to listen to all your songs in the order that 'find' locates them (not shuffled), use:

find /Volumes/Storage/Music/ -name "*.mp3" | mpg123 -@ -



[ Reply to This | # ]

audio skip/cut out
Authored by: John2583 on Nov 27, '02 03:04:10PM

I installed mpg123 using fink. I like it. Unfortunately it skips constantly. If I move a window, use the dock open a program, many many normal uses of the finder or other programs cause it to skip. Why!?
John



[ Reply to This | # ]
Compiling mpg123 1.5.1
Authored by: josephaw on Sep 11, '08 07:57:58AM

I was having trouble compiling any version on my G5 and I found a work around by doing the following...
Instead of:
./configure --prefix=/usr/local/mpg123
I used:
./configure --prefix=/usr/local/mpg123 --cpu=generic

for some reason I was not able to compile using altivec
This worked for me.
It would be nice if someone would create a new binary installer for this program instead of fink or port



[ Reply to This | # ]