mpg123 (with examples)

mpg123 (with examples)

Play the specified mp3 files

The command mpg123 can be used to play specific mp3 files. This is done by providing the path to the mp3 files as arguments to the command.

Code:

mpg123 path/to/file1.mp3 path/to/file2.mp3 ...

Motivation:

This use case is useful when you want to play specific mp3 files in your console. For example, if you have a playlist of favorite songs, you can use this command to play them without the need for a graphical media player.

Arguments:

  • path/to/file1.mp3 path/to/file2.mp3 ...: The paths to the mp3 files that you want to play.

Example output:

Playing: path/to/file1.mp3
Decoding of path/to/file1.mp3 finished.
Playing: path/to/file2.mp3
Decoding of path/to/file2.mp3 finished.

Play the mp3 from stdin

The command mpg123 can also play an mp3 file from stdin. This is useful when you want to stream audio data to mpg123 from another command.

Code:

cat file.mp3 | mpg123 -

Motivation:

This use case is handy when you have an mp3 file in stdin. For example, if you want to play an mp3 file that is being generated or processed by another command, you can pipe the output of that command to mpg123.

Arguments:

  • file.mp3: The name of the mp3 file that is being streamed to mpg123.

Example output:

Decoding of file.mp3 finished.

Jump forward to the next song

In mpg123, you can jump forward to the next song using the f key.

Code:

Press f during playback.

Motivation:

This command is useful when you want to skip to the next song in a playlist, without having to stop and manually select the next file to play.

Example output:

Forwarding to next song.

Jump back to the beginning of the song

The mpg123 command allows you to jump back to the beginning of the current song using the b key.

Code:

Press b during playback.

Motivation:

This command is handy when you want to replay the current song from the beginning, without having to stop and manually restart it.

Example output:

Jumping back to beginning of song.

Stop or replay the current file

To stop or replay the current file being played, you can use the s key in mpg123.

Code:

Press s during playback.

Motivation:

This command is useful when you want to pause the current song or replay it from the beginning. It allows you to control the playback without having to stop and manually restart the file.

Example output:

Stopping or replaying the current file.

Fast forward

In mpg123, you can fast forward the current song by using the . (period) key.

Code:

Press . (period) during playback.

Motivation:

This command is useful when you want to skip ahead in the current song without having to stop and manually seek to a specific position.

Example output:

Fast forwarding the current file.

Quit

To quit mpg123 and exit the program, simply press q.

Code:

Press q to quit.

Motivation:

This command is useful when you want to stop playback and exit the mpg123 program. It allows you to cleanly terminate the application.

Example output:

Exiting mpg123.

By understanding and utilizing these various use cases, you can fully unleash the power of the mpg123 command and enjoy console-based mp3 playback.

Related Posts

How to use the command 'alpine' (with examples)

How to use the command 'alpine' (with examples)

The ‘alpine’ command is an email client and Usenet newsgroup program with a pico/nano-inspired interface.

Read More
How to use the command xml validate (with examples)

How to use the command xml validate (with examples)

The xml validate command is used to validate XML documents against specified schemas.

Read More
How to use the command "sqlite3" (with examples)

How to use the command "sqlite3" (with examples)

The command “sqlite3” is the command-line interface to SQLite 3, which is a self-contained file-based embedded SQL engine.

Read More