mpg123(1)
hey bestie!! welcome to mpg123(1) from the General Commands Manual πβ¨ this is the page for the audio MPEG player, and we are gonna get you fluent, fr fr.
π NAME π
mpg123 β play audio MPEG 1.0/2.0/2.5 stream (layers 1, 2 and 3)
β¨ SYNOPSIS β¨
mpg123 [ options ] file-or-URL...
π¦ DESCRIPTION π¦
mpg123 reads one or more files (or standard input if - is specified) or URLs and plays them on the audio device (default) or outputs them to stdout. file/URL is assumed to be an MPEG audio bit stream.
πΈ OPERANDS πΈ
The following operands are supported:
file(s)β The path name(s) of one or more input files. They must be valid MPEG-1.0/2.0/2.5 audio layer 1, 2 or 3 bit streams. If a dash-is specified, MPEG data will be read from the standard input. Furthermore, any name starting withhttp://orhttps://is recognized as URL (see next section), while a leadingfile://is being stripped for normal local file access, for consistency (since mpg123 1.30.1).
π OPTIONS π
mpg123 options may be either the traditional POSIX one letter options, or the GNU style long options. POSIX style options start with a single -, while GNU long options start with --. Option arguments (if needed) follow separated by whitespace (not =). Note that some options can be absent from your installation when disabled in the build process.
β¨ INPUT OPTIONS β¨
-k num,--skip numβ skip firstnumframes. By default the decoding starts at the first frame. so if you wanna jump in later, this is your girlie.-n num,--frames numβ decode onlynumframes. By default the complete stream is decoded.--fuzzyβ enable fuzzy seeks (guessing byte offsets or using approximate seek points from Xing TOC). Without that, seeks need a first scan through the file before they can jump at positions. You can decide here: sample-accurate operation with gapless features or faster (fuzzy) seeking. choose your fighter π-y,--no-resyncβ do NOT try to resync and continue decoding if an error occurs in the input file. Normally,mpg123tries to keep the playback alive at all costs, including skipping invalid material and searching new header when something goes wrong. With this switch you can make it bail out on data errors (and perhaps spare your ears a bad time). Note that this switch has been renamed from--resync. The old name still works, but is not advertised or recommended to use (subject to removal in future). lowkey don't build your whole setup on the old name, bestie.-F,--no-frankensteinβ disable support for Frankenstein streams. Normally,mpg123stays true to the concept of MPEG audio being just a concatenation of MPEG frames. It will continue decoding even if the type of MPEG frames varies wildly. With this switch, it will only decode the input as long as it does not change its character (from layer I to layer III, changing sampling rate, from mono to stereo), silently assuming end of stream on such occasion. The switch also stops decoding of compatible MPEG frames if there was an Info frame (Xing header, Lame tag) that contained a length of the track in MPEG frames. This comes a bit closer to the notion of a MP3 file as a defined collection of MPEG frames that belong together, but gets rid of the flexibility that can be fun at times but mostly is hell for the programmer of the parser and decoder ... the drama of it all π--network backendβ select networkbackend(helper program), choices are usuallyauto,wget, andcurl.automeans to try the first available backend.--resync-limit bytesβ set number of bytes to search for valid MPEG data once lost in stream;<0means search whole stream. If you know there are huge chunks of invalid data in your files... here is your hammer. Note: Only since version 1.14 this also increases the amount of junk skipped on beginning. hammer time, but make it MPEG.-u auth,--auth authβ HTTP authentication to use when receiving files via HTTP. The format used isuser:password. Mpg123 will clear this quickly, but it may still appear in sight of other users or even just in your shell history. You may seek alternative ways to specify that to your network backend. be careful with secrets in shell history, bestie π«£--auth-file authfileβ provide the authentication info via given file instead of command line directly.--ignore-mimeβ ignore MIME types given by HTTP server. If you know better and wantmpg123to decode something the server thinks isimage/png, then just do it. main character energy: server says no, you say yes.--no-icy-metaβ do not accept ICY meta data.--streamdump filenameβ dump a copy of the input data (as read by libmpg123) to the given file. This enables you to store a web stream to disk while playing, or just create a concatenation of the local files you play for ... why not? why not indeed π--icy-interval bytesβ this setting enables you to play a stream dump containing ICY metadata at the given interval in bytes (the value of theicy-metaintHTTP response header). Without it, such a stream will play, but will cause regular decoding glitches with resync.--no-seekbufferβ disable the default micro-buffering of non-seekable streams that gives the parser a safer footing.-@ file,--list fileβ read filenames and/or URLs of MPEG audio streams from the specified file in addition to the ones specified on the command line (if any). Note thatfilecan be either an ordinary file, a dash-to indicate that a list of filenames/URLs is to be read from the standard input, or an URL pointing to a an appropriate list file. Note: only one-@option can be used (if more than one is specified, only the last one will be recognized). Furthermore, for HTTP resources, the MIME type information will be used to re-open an actual MPEG stream as such instead of treating it as playlist file. So you could just always use-@for web resources without bothering if it is a playlist or already the resolved stream address. one -@ to rule them all, bestie.-l n,--listentry nβ of the playlist, play specified entry only.nis the number of entry starting at 1. A value of0is the default and means playing the whole list, a negative value means showing of the list of titles with their numbers... the numbers, bestie, the numbers.--continueβ enable playlist continuation mode. This changes frame skipping to apply only to the first track and also continues to play following tracks in playlist after the selected one. Also, the option to play a number of frames only applies to the whole playlist. Basically, this tries to treat the playlist more like one big stream (like, an audio book). The current track number in list (1-based) and frame number (0-based) are printed at exit (useful if you interrupted playback and want to continue later). Note that the continuation info is printed to standard output unless the switch for piping audio data to standard out is used. Also, it really makes sense to work with actual playlist files instead of lists of file names as arguments, to keep track positions consistent.--loop timesβ for looping track(s) a certain number of times,< 0means infinite loop (not with--random!). infinite loop but make it chaotic β¨--keep-openβ for remote control mode: Keep loaded file open after reaching end.--timeout secondsβ timeout in (integer) seconds before declaring a stream dead (if<= 0, wait forever).-z,--shuffleβ shuffle play. Randomly shuffles the order of files specified on the command line, or in the list file.-Z,--randomβ continuous random play. Keeps picking a random file from the command line or the play list. Unlike shuffle play above, random play never ends, and plays individual songs more than once. never-ending random play? iconic behavior.-i,--indexβ index / scan through the track before playback. This fills the index table for seeking (if enabled in libmpg123) and may make the operating system cache the file contents for smoother operating on playback.--index-size sizeβ set the number of entries in the seek frame index table.--preframes numβ set the number of frames to be read as lead-in before a seeked-to position. This serves to fill the layer 3 bit reservoir, which is needed to faithfully reproduce a certain sample at a certain position. Note that for layer 3, a minimum of1is enforced (because of frame overlap), and for layer 1 and 2, this is limited to2(no bit reservoir in that case, but engine spin-up anyway).
β¨ OUTPUT and PROCESSING OPTIONS β¨
okay bestie, this is the glow-up section where we decide where the sound goes and how it gets processed π no cap.
-o module,--output moduleβ Pick your audio output module. You can hand it a comma-separated list to use the first one that actually works. Also see-a. π§--list-modulesβ Lists the available modules. slay.--list-devicesβ Lists the available output devices for the given output module. If there is no functionality to list devices in the chosen module, an error will be printed and mpg123 will exit with a non-zero code. rude but fair.-a dev,--audiodevice devβ Specify the audio device to use. The default as well as the possible values depend on the active output. For the JACK output, a comma-separated list of ports to connect to (for each channel) can be specified. π-s,--stdoutβ The decoded audio samples are written to standard output, instead of playing them through the audio device. This option must be used if your audio hardware is not supported by mpg123. The output format per default is raw (headerless) linear PCM audio data, 16 bit, stereo, host byte order (you can force mono or 8bit). πΎ-O file,--outfileβ Write raw output into a file (instead of simply redirecting standard output to a file with the shell). π-w file,--wavβ Write output as WAV file. This will cause the MPEG stream to be decoded and saved as file, or standard output if-is used as file name. You can also use--auand--cdrfor AU and CDR format, respectively. Note that WAV/AU writing to non-seekable files, or redirected stdout, needs some thought. Since 1.16.0, the logic changed to writing the header with the first actual data. This avoids spurious WAV headers in a pipe, for example. The result of decoding nothing to WAV/AU is a file consisting just of the header when it is seekable and really nothing when not (not even a header). Correctly writing data with prophetic headers to stdout is no easy business. π--au fileβ Does not play the MPEG file but writes it to file in SUN audio format. If-is used as the filename, the AU file is written to stdout. See paragraph about WAV writing for header fun with non-seekable streams. π--cdr fileβ Does not play the MPEG file but writes it to file as a CDR file. If-is used as the filename, the CDR file is written to stdout. πΏ--reopenβ Forces reopen of the audiodevice after ever song. π--cpu decoder-typeβ Selects a certain decoder (optimized for specific CPU), for examplei586orMMX. The list of available decoders can vary; depending on the build and what your CPU supports. This option is only available when the build actually includes several optimized decoders. π§--test-cpuβ Tests your CPU and prints a list of possible choices for--cpu. π§ͺ--list-cpuβ Lists all available decoder choices, regardless of support by your CPU. π-g gain,--gain gainβ [DEPRECATED] Set audio hardware output gain (default: don't change). The unit of the gain value is hardware and output module dependent. (This parameter is only provided for backwards compatibility and may be removed in the future without prior notice. Use the audio player for playing and a mixer app for mixing, UNIX style!) she's deprecated, bestie π-f factor,--scale factorβ Change scale factor (default:32768). βοΈ--rva-mix,--rva-radioβ Enable RVA (relative volume adjustment) using the values stored for ReplayGain radio mode / mix mode with all tracks roughly equal loudness. The first valid information found in ID3V2 Tags (Comment namedRVAor theRVA2frame) or ReplayGain header in Lame/Info Tag is used. π»--rva-album,--rva-audiophileβ Enable RVA (relative volume adjustment) using the values stored for ReplayGain audiophile mode / album mode with usually the effect of adjusting album loudness but keeping relative loudness inside album. The first valid information found in ID3V2 Tags (Comment namedRVA_ALBUMor theRVA2frame) or ReplayGain header in Lame/Info Tag is used. π½-0,--single0;-1,--single1β Decode only channel 0 (left) or channel 1 (right), respectively. These options are available for stereo MPEG streams only. β¬ οΈβ‘οΈ-m,--mono,--mix,--singlemixβ Mix both channels / decode mono. It takes less CPU time than full stereo decoding. ποΈ--stereoβ Force stereo output. πΆ-r rate,--rate rateβ Set sample rate (default: automatic). You may want to change this if you need a constant bitrate independent of the mpeg stream rate. mpg123 automagically converts the rate. You should then combine this with--stereoor--mono. β¨--resample methodβ Set resampling method to employ if forcing an output rate. Choices (case-insensitive) areNtoM,dirty, andfine. Thefineresampler is the default. It employs libsyn123's low-latency fairly efficient resampler to postprocess the output from libmpg123 instead of the fast but very crudeNtoMdecoder (drop sample method) that mpg123 offers since decades. If you are really low on CPU time, chooseNtoM, as the resampler usually needs more time than the MPEG decoder itself. The mpg123 program is smart enough to combine the2to1or4to1downsampling modes with the postprocessing for extreme downsampling. π-2,--2to1;-4,--4to1β Performs a downsampling of ratio 2:1 (22 kHz from 44.1 kHz) or 4:1 (11 kHz) on the output stream, respectively. Saves some CPU cycles, but of course throws away the high frequencies, as the decoder does not bother producing them. π--pitch valueβ Set a pitch change (speedup/down, 0 is neutral; 0.05 is 5% speedup). When not enforcing an output rate, this changes the output sampling rate, so it only works in the range your audio system/hardware supports. When you combine this with a fixed output rate, it modifies a software resampling ratio instead. ποΈ--8bitβ Forces 8bit output. π±--floatβ Forces f32 encoding. π«§-e enc,--encoding encβ Choose output sample encoding. Possible values look likef32(32-bit floating point),s32(32-bit signed integer),u32(32-bit unsigned integer) and the variants with different numbers of bits (s24,u24,s16,u16,s8,u8) and also special variants likeulawandalaw8-bit. See the output of mpg123's longhelp for actually available encodings. π€-d n,--doublespeed nβ Only play every n'th frame. This will cause the MPEG stream to be played n times faster, which can be used for special effects. Can also be combined with the--halfspeedoption to play 3 out of 4 frames etc. Don't expect great sound quality when using this option. β©-h n,--halfspeed nβ Play each frame n times. This will cause the MPEG stream to be played at 1/n'th speed (n times slower), which can be used for special effects. Can also be combined with the--doublespeedoption to double every third frame or things like that. Don't expect great sound quality when using this option. βͺ-E file,--equalizerβ Enables equalization, taken from file. The file needs to contain 32 lines of data, additional comment lines may be prefixed with#. Each data line consists of two floating-point entries, separated by whitespace. They specify the multipliers for left and right channel of a certain frequency band, respectively. The first line corresponds to the lowest, the 32nd to the highest frequency band. Note that you can control the equalizer interactively with the generic control interface. Also note that these are the 32 bands of the MPEG codec, not spaced like you would see for a usual graphic equalizer. The upside is that there is zero computational cost in addition to decoding. The downside is that you roughly have bass in band 0, (upper) mids in band 1, treble in all others. ποΈ--gaplessβ Enable code that cuts (junk) samples at beginning and end of tracks, enabling gapless transitions between MPEG files when encoder padding and codec delays would prevent it. This is enabled per default beginning with mpg123 version 1.0.0 . π--no-gaplessβ Disable the gapless code. That gives you MP3 decodings that include encoder delay and padding plus mpg123's decoder delay. π«--no-infoframeβ Do not parse the Xing/Lame/VBR/Info frame, decode it instead just like a stupid old MP3 hardware player. This implies disabling of gapless playback as the necessary information is in said metadata frame. π-D n,--delay nβ Insert a delay of n seconds before each track. β³-o h,--headphonesβ Direct audio output to the headphone connector (some hardware only; AIX, HP, SUN). π§-o s,--speakerβ Direct audio output to the speaker (some hardware only; AIX, HP, SUN). π-o l,--lineoutβ Direct audio output to the line-out connector (some hardware only; AIX, HP, SUN). π-b size,--buffer sizeβ Use an audio output buffer of size Kbytes. This is useful to bypass short periods of heavy system activity, which would normally cause the audio output to be interrupted. You should specify a buffer size of at least 1024 (i.e. 1 Mb, which equals about 6 seconds of audio data) or more; less than about 300 does not make much sense. The default is 0, which turns buffering off. π§Ί--preload fractionβ Wait for the buffer to be filled to fraction before starting playback (fraction between 0 and 1). You can tune this prebuffering to either get faster sound to your ears or safer uninterrupted web radio. Default is 0.2 (wait for 20 % of buffer to be full, changed from 1 in version 1.23). β±οΈ--devbuffer secondsβ Set device buffer in seconds; <= 0 means default value. This is the small buffer between the application and the audio backend, possibly directly related to hardware buffers. π¦--smoothβ Keep buffer over track boundaries -- meaning, do not empty the buffer between tracks for possibly some added smoothness. π§
β¨ MISC OPTIONS β¨
-t,--testβ test mode bestie π the audio stream gets decoded, but literally no output happens. Like, the vibes are decoded, the sound is not.-c,--checkβ checks for filter range violations (aka clipping π«£) and reports them per frame whenever any show up.-v,--verboseβ bumps the verbosity level up a notch. So like, it'll show you frame numbers while decoding. Main character behaviour, honestly.-q,--quietβ quiet mode, shhh πΈ. Suppresses diagnostic messages.-C,--controlβ turns on terminal control keys. This switches itself on automatically if a terminal is detected, no cap. By default:sor the space bar stops/restarts (pause, unpause) playback,fjumps forward to the next song,bjumps back to the beginning of the song,,rewinds,.fast forwards, andqquits. Typehfor the full list of available controls. The A-B loop feature with keyochanges the preset loop interval to the interval between two presses ofoβ and the third press (orp) ends the looped playback. After that, keypuses the updated loop interval. Iconic.--no-controlβ turns terminal control OFF even if a terminal is detected. Boundaries, periodt.--titleβ in anxterm,rxvt,screen,iris-ansi(or anything compatible β theTERMenvironment variable gets examined, iykyk), this changes the window's title to the name of the song currently playing. Gorgeous.--pauseloopseconds β sets the length of the loop interval in terminal control fixed looping mode, instead of the default0.5seconds, as a floating point number. You can overwrite this value at runtime with the A-B loop feature. Slay.--namename β sets the name of this instance, possibly used in various places. It sets the client name for JACK output, fr fr.--long-tagβ displays ID3 tag info always in long format, with one line per item (artist, title, ...).--utf8β regardless of environment, prints metadata in UTF-8. Otherwise, when you're not using a UTF-8 locale, you'll get the ASCII stripdown π.-R,--remoteβ activates the generic control interface. mpg123 will then read and execute commands fromstdin. Basic usage isload <filename>to play some file, and the obviouspause,command. Andjump <frame>will jump/seek to a given point (MPEG frame number). Issuehelpto get the full list of commands and syntax. Your new bestie interface π--remote-errβ prints responses for generic control mode to standard error instead of standard out. This gets triggered automatically when you use-s.--fifopath β creates a fifo / named pipe at the given path and uses that for reading commands instead of standard input. Fancy π--aggressiveβ tries to get higher priority.-T,--realtimeβ tries to gain realtime priority. Heads up though: this option usually requires root privileges to have any effect π-?,--helpβ shows short usage instructions.--longhelpβ shows long usage instructions.--versionβ prints the version string.--libversionβ prints version information on the mpg123 libraries being used (libmpg123,libout123,libsyn123).
π HTTP SUPPORT π
So besides reading MPEG audio streams from ordinary files and from standard input, mpg123 also supports grabbing MPEG audio streams or playlists over the HTTP protocol β yes, the one the World Wide Web (WWW) runs on, we love a legend. Those files get specified using a so-called URL, which starts with http:// or https://. When a file with that prefix shows up, mpg123 since 1.30.0 will by default call an external helper program (either wget(1) or curl(1) β check the --network option) to retrieve the resource. You can configure access via a proxy server using the standard environment variables those programs support. The --proxy option that mpg123 before 1.30.0 used for its internal network code is gone in the default build now, and will probably disappear for good with 1.31.1. RIP to a real one π
Note that, in order to play MPEG audio files from a WWW server, the connection to that server needs to be fast enough. Like, a128kbit/s MPEG file requires a network connection of at least128kbit/s (16kbyte/s) plus protocol overhead. No shortcuts here bestie.
If you suffer from short network outages, you should try the -b option (buffer) to bypass them. And if your network connection is generally not fast enough to retrieve MPEG audio files in realtime, you can first download the files to your local harddisk (e.g. using wget(1)) and then play them from there. Old school, works every time β¨
Streams with embedded ICY metadata are supported β the interval being communicated via HTTP headers or --icy-interval.
π INTERRUPT π
When in terminal control mode, you can quit by pressing the q key. And any time, you can abort mpg123 by pressing Ctrl-C. If you're not in terminal control mode, that Ctrl-C will skip to the next file (if any). If you want to abort playing immediately in that case, press Ctrl-C twice in short succession (within about one second). Double tap, periodt π
Note that the result of quitting mpg123 by pressing Ctrl-C might not be audible immediately, due to audio data buffering in the audio device. This delay is system dependent, but it's usually not more than one or two seconds. Patience, angel π§
π PLAYBACK STATUS LINE π
In verbose mode, mpg123 updates a line with various info all centering around the current playback position. On any decent terminal, that line also works as a progress bar for the current file β it reverses video for a fraction of the line according to the current position. Obsessed with the drama of it. An example of a full line is this:
> 0291+0955 00:01.68+00:28.22 [00:05.30] mix 100=085 192 kb/s 576
B acc 18 clip p+0.014
The information consists of, in order:
>β single-character playback state (>for playing,=for pausing/looping,_for stopped).0291+0955β the current frame offset, and the number of remaining frames after the plus sign.00:01.68+00:28.22β the current position from, and the remaining time in, human terms (hours, minutes, seconds).[00:05.30]β the fill of the output buffer in terms of playback time, if the buffer is enabled.mixβ the selected RVA mode (possible values:mix,alb(album), and---(neutral, off)).100=085β the set volume, and the RVA-modified effective volume after the equal sign.192 kb/sβ the current bitrate.576 Bβ the size of the current frame in bytes.accβ if positions are accurate. Possible values areaccfor accurate positions, orfuzfor fuzzy (with guessed byte offsets using mean frame size).18 clipβ the amount of clipped samples. Non-zero only if the decoder reports that (generic does, some optimized ones don't, rude π).p+0.014β pitch change (increased/decreased playback sampling rate on user request).
π NOTES π
MPEG audio decoding requires a good deal of CPU performance, especially layer-3. To decode it in realtime, you should have at least an i486DX4, Pentium, Alpha, SuperSparc or equivalent processor. You can also use the -m option to decode mono only, which reduces the CPU load somewhat for layer-3 streams. See also the -2 and -4 options. Multitasking queen energy π
If everything else fails, have mpg123 decode to a file and then use an appropriate utility to play that file with less CPU load. Most probably you can configure mpg123 to produce a format suitable for your audio device (see above about encodings and sampling rates).
If your system is generally fast enough to decode in realtime, but there are sometimes periods of heavy system load (such as cronjobs, users logging in remotely, starting of "big" programs etc.) causing the audio output to be interrupted β then you should use the -b option to use a buffer of reasonable size (at least 1000 Kbytes). Protect your peace πΈ
π¦ EXIT CODE π¦
Up to version 1.25.x, mpg123 always returned exit code 0, even for complete junk on the input side. Fatal errors were only considered for output. With version 1.26.0, this changed to the behaviour described below.
When not using the remote control interface (which returns input errors as text messages), the process exit code is zero (success) only if all tracks in a playlist had at least one frame parsed β even if it didn't decode cleanly, or are empty, MPEG-wise (perhaps only metadata, or really an empty file). When you decode nothing, nothing is the result and that is fine, no notes π When a track later aborts because of parser errors or breakdown of the network communication, this is treated as the end of a track, but does not make the process as such fail. One really bad (or non-existing) stream in the playlist results in a non-zero error code, consistent with other UNIX tools.
An error in audio output results in the process ending with a non-zero exit code immediately, regardless of how much data has been successfully played before. The forgiveness is only on the input side. Output said no β
π BUGS π
Mostly MPEG-1 layer 2 and 3 are tested in real life. Please report any issues and provide test files to help fixing them. Do your part bestie π«Ά
No CRC error checking is performed. But the decoder is built and tested to behave nicely with damaged streams. Mostly, damaged frames will just be silent. Lowkey iconic of it.
Some platforms lack audio hardware support; you may be able to use the -s switch to feed the decoded data to a program that can play it on your audio device.
π AUTHORS π
Maintainer: Thomas Orgis <maintainer@mpg123.org>, <thomas@orgis.org>
Original Creator: Michael Hipp
Uses code or ideas from various people, see the AUTHORS file accompanying the source code. Credit where credit is due, always β¨
βοΈ LICENSE βοΈ
mpg123 is licensed under the GNU Lesser/Library General Public License, LGPL, version 2.1.
π WEBSITE π
http://www.mpg123.org
http://sourceforge.net/projects/mpg123
And that's the whole page, babe π this one's dated 11 Jul 2022 and it's the mpg123(1) manual β go forth and decode, you absolute legend π¦β¨
π¦ where this page comes from
- debian trixie: mpg123 1.32.10-1+deb13u1 Β· LGPL-2.1-only
- ubuntu noble: mpg123 1.32.5-1ubuntu1 Β· LGPL-2.1-only
- ubuntu noble: mpg123 1.32.5-1ubuntu1.1 Β· LGPL-2.1-only
- ubuntu questing: mpg123 1.32.10-1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms