“mpg123” is a command-line audio player for Linux and Unix-like systems that is designed to play MPEG audio files (MP3, MP2, and MP1). It is a fast and lightweight player that is well-suited for use in shell scripts and other automated processes. “mpg123” supports a variety of audio output methods, including ALSA, OSS, and PulseAudio, and can be used to play audio files on a variety of hardware platforms, including laptops, desktops, and embedded systems.
One of the key features of “mpg123” is its ability to play audio files directly from the command line, without the need for a graphical user interface. This makes it ideal for use in scripts and other automated processes, where it is important to be able to play audio files quickly and easily.
“mpg123” also provides a number of options for controlling the playback of audio files, including volume control, seeking, and the ability to repeat or shuffle tracks. It supports a wide range of audio file formats, and can be used to play audio files in the background, allowing you to continue working in other applications while the audio is playing.
If you encounter the below error while running the command mpg123:
mpg123: command not found
you may try installing the below package as per your choice of distribution:
|Debian||apt-get install mpg123|
|Ubuntu||apt-get install mpg123|
|Alpine||apk add mpg123|
|Arch Linux||pacman -S mpg123|
|Kali Linux||apt-get install mpg123|
|CentOS||yum install mpg123|
|Fedora||dnf install mpg123|
|OS X||brew install mpg123|
|Raspbian||apt-get install mpg123|
mpg123 Command Examples
1. Play the specified mp3 files:
# mpg123 path/to/file1.mp3 path/to/file2.mp3 ...
2. Play the mp3 from stdin:
# cat file.mp3 | mpg123 -
3. Jump forward to the next song:
4. Jump back to the beginning for the song:
5. Stop or replay the current file:
6. Fast forward:
In general, “mpg123” is a simple and effective tool for playing MPEG audio files on the command line. Its lightweight design, compatibility with a wide range of audio output methods, and ability to play audio files directly from the command line make it an ideal choice for users who need a fast and reliable audio player for use in shell scripts and other automated processes.