Skip to Content
Linux Multimedia Hacks
book

Linux Multimedia Hacks

by Kyle Rankin
November 2005
Beginner
330 pages
9h 44m
English
O'Reilly Media, Inc.
Content preview from Linux Multimedia Hacks

Command-Line Streaming MP3 Player

Use basic command-line tools to create your own streaming MP3 player.

When setting up Obsequeium (http://obsbox.sf.net) or Jinzora (http://jinzora.org) web jukeboxes [Hack #84] , I’ve found it helpful to set up a dedicated streaming player so I can listen to my net jukebox constantly while testing. Preferably the MP3 stream should never stop and, should something happen to the playback, it should pause for a moment and try the stream again. It may seem the mpg123/mpg321 command-line players are perfect for this task, but they have a habit of locking up and not exiting or retrying when something goes wrong with the stream. This makes them unsuitable for use as dedicated streaming players.

You can build a robust command-line streaming player with one command if you have madplay and wget installed. wget and madplay are both popular programs and should be prepackaged by your Linux distribution. Use your distribution’s software installation tool to install these programs. If for some reason you don’t have these tools prepackaged, download the tarballs from http://www.underbit.com/products/mad/ and http://www.gnu.org/software/wget/wget.html, compile, and install them according to the included installation instructions.

With wget and madplay installed, the following command will play the stream from http://example.com/mystream:

	$ wget–q–O– http://example.com/mystream | madplay -Q --no-tty-control-

wget reads the MP3 stream and quietly writes it to

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

CentOS Bible

CentOS Bible

Christopher Negus, Timothy Boronczyk
Microsoft® SQL Server 2012 Unleashed

Microsoft® SQL Server 2012 Unleashed

Ray Rankins, Paul T. Bertucci, Chris Gallelli, Alex T. Silverstein

Publisher Resources

ISBN: 0596100760Errata Page