LinuxCommandLibrary

mpg123

Play MPEG audio (MP3) files

TLDR

Play the specified mp3 files

$ mpg123 [path/to/file1.mp3 path/to/file2.mp3 ...]
copy

Play the mp3 from stdin
$ cat [file.mp3] | mpg123 -
copy

Jump forward to the next song
$ <f>
copy

Jump back to the beginning for the song
$ <b>
copy

Stop or replay the current file
$ <s>
copy

Fast forward
$ <.>
copy

Quit
$ <q>
copy

SYNOPSIS

mpg123 [options] file1 [file2 ...]

PARAMETERS

-v, --verbose
    Increase verbosity (can be used multiple times)

-q, --quiet
    Quiet mode (less output)

-s
    Write raw audio to stdout

-w
    Write raw audio to file

-o
    Specify output device

-z
    Shuffle play

-n
    Play each file times

-k
    Seek offset in seconds

-y
    No warnings

-@
    Read filenames from

--list-modules
    List available output modules

--test
    Do not play; just decode

DESCRIPTION

mpg123 is a fast and versatile command-line MPEG audio player for Linux and other Unix-like operating systems. It supports various MPEG audio versions and layers, including MPEG 1.0/2.0/2.5 layers 1, 2, and 3 (MP3).
It can play audio from local files, network streams (URLs), and even from standard input. mpg123 offers a range of command-line options for controlling playback, volume, output device, and more.
It's widely used in scripting and embedded systems due to its lightweight design and robust performance. The application decodes the stream and produces a sound output via audio cards installed in the computer. mpg123 can also be used as a library to decode audio streams into raw PCM audio for other software.

CAVEATS

Some advanced features or decoders may require optional dependencies to be installed. Output device names can be system-dependent.

OUTPUT MODULES

mpg123 supports various output modules for different audio devices.
Use '--list-modules' to see the available modules on your system. Common examples include 'alsa', 'pulse', and 'oss'.

ERROR HANDLING

mpg123's return code indicates the success or failure of the playback process.
A return code of 0 typically indicates success, while non-zero values indicate errors.

CONTROLLING PLAYBACK

During playback, you can use keyboard shortcuts to control the player.
Common shortcuts include 'space' to pause/resume, 'q' to quit, and '<' and '>' to seek backward and forward.

HISTORY

mpg123 was initially developed in the mid-1990s by Michael Hipp. It gained popularity as one of the first readily available and efficient MP3 decoders for Unix-like systems.
Over time, it has been actively maintained and improved by a community of developers. mpg123 has been widely used in various applications, including embedded systems, audio players, and command-line tools.

SEE ALSO

mplayer(1), ffmpeg(1), aplay(1)

Copied to clipboard