LinuxCommandLibrary

mpg321

command-line MP3 player, a free clone of mpg123

TLDR

Play MP3 file

$ mpg321 [file.mp3]
copy
Play multiple files
$ mpg321 [file1.mp3] [file2.mp3]
copy
Play from URL
$ mpg321 [http://example.com/audio.mp3]
copy
Play with shuffle
$ mpg321 -z [*.mp3]
copy
Play with volume adjustment
$ mpg321 -g [50] [file.mp3]
copy
Quiet mode (no output)
$ mpg321 -q [file.mp3]
copy
Output to WAV file
$ mpg321 -w [output.wav] [input.mp3]
copy
Loop playback
$ mpg321 --loop [3] [file.mp3]
copy

SYNOPSIS

mpg321 [-w output.wav] [-g gain] [-z] [-q] [options] files

DESCRIPTION

mpg321 is a command-line MP3 player, a free clone of mpg123. It decodes and plays MPEG audio files using the libmad library.
The player supports local files, playlists, and HTTP streams. Shuffle mode randomizes playback order. Loop mode repeats tracks or playlists.
WAV output decodes MP3 to uncompressed audio, useful for burning CDs or converting formats. Combined with pipes, it can feed audio to other programs.
The remote control mode accepts commands on stdin, enabling integration with front-end applications. Commands control playback, seeking, and volume.
Gain adjustment scales the audio output. Values above 100 may cause clipping. The setting helps normalize volume across tracks.

PARAMETERS

-w FILE

Output to WAV file instead of playing.
-g GAIN
Audio gain (0-100).
-z
Shuffle playlist.
-q, --quiet
Quiet mode.
--loop N
Loop playback N times.
-@ FILE
Read playlist from file.
-o DRIVER
Audio output driver.
-a DEVICE
Audio device.
-b SIZE
Buffer size in kilobytes.
-r
Use remote control interface.
-s
Output to stdout (for piping).
-v
Verbose output.

CAVEATS

MP3 only - no other formats. Some streams may not work. Audio quality limited by libmad decoder. No gapless playback.

HISTORY

mpg321 was created by Joe Drew in 2001 as a free replacement for mpg123 during a time when mpg123's license was unclear. It used the libmad decoder which was clearly free software. When mpg123 became LGPL, both players continued development.

SEE ALSO

mpg123(1), mplayer(1), mpv(1), sox(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community