mp3info
Read information from MP3 audio files
TLDR
Show all ID3v1 tags of a specific MP3 file
Edit ID3v1 tags [i]nteractively
Set values for ID3v1 tags in a specific MP3 file ([a]rtist, [t]itle, a[l]bum, [y]ear, and [c]omment)
Set the [n]umber of the track in the album for a specific MP3 file
[G]et a list of valid genres and their numeric codes
Set the music [g]enre for a specific MP3 file
SYNOPSIS
mp3info [OPTIONS] FILE...
PARAMETERS
-r, --raw
Outputs raw, space-separated data, ideal for scripting.
-s, --summary
Displays a human-readable summary (default output format).
-x, --xml
Generates output in XML format, suitable for machine parsing.
-p format_string, --print format_string
Allows custom output formatting using specified variables. Refer to 'Format String for -p' in 'Additional Information'.
-t, --tags
Shows only information related to ID3 tags (ID3v1 and ID3v2).
-F, --frames
Provides detailed information about each MP3 frame, resulting in very verbose output.
-d, --debug
Activates debug output for troubleshooting.
--help
Displays a help message and exits.
--version
Shows the command's version information and exits.
DESCRIPTION
The mp3info command is a versatile utility designed to extract and display detailed metadata from MP3 audio files. It parses both the MP3 frame headers and embedded ID3 tags (including ID3v1 and ID3v2), providing a comprehensive overview of a song's properties without needing to play the file.
Users can retrieve essential information such as the bitrate, sample rate, channel mode (stereo/mono), and duration. Furthermore, it can read and present standard ID3 tag fields like artist, title, album, year, genre, comments, track number, and URL.
mp3info is invaluable for quick file inspection, batch processing, and scripting tasks, allowing users to organize or verify their MP3 collections efficiently. Its various output formats, including human-readable summary, raw data, and XML, make it adaptable to different use cases.
CAVEATS
While highly useful, mp3info's accuracy depends on the MP3 file's integrity and adherence to standards. Malformed MP3 headers or corrupt ID3 tags might lead to incorrect data or errors. It typically relies on the id3lib library, so its capabilities and ID3v2 tag support may vary slightly with different versions of the underlying library. It might not be installed by default on all Linux distributions.
FORMAT STRING FOR -P
The -p or --print option allows users to customize the output format using a string with special variables. Each variable represents a specific piece of information:
%f: Filename
%a: Artist
%t: Title
%l: Length (in seconds)
%r: Bitrate (in kbps)
%g: Genre
%y: Year
%c: Comment
%n: Track Number
%u: URL
%v: ID3v2 tag presence (0 for no, 1 for yes)
%C: Channels (e.g., Stereo, Mono)
%S: Sample Rate (in Hz)
Example usage: mp3info -p "%f - %a - %t [%r kbps]" my_song.mp3
OUTPUT FORMATS
mp3info offers several output formats for different needs:
Summary (Default): A human-readable, nicely formatted output showing key MP3 and ID3 tag information.
Raw (-r): Presents data in a space-separated format, optimized for easy parsing by scripts.
XML (-x): Provides structured output in XML, beneficial for integration with other applications or advanced scripting.
Custom (-p): Allows complete control over the output structure and content using format strings.
HISTORY
The mp3info utility is a component of the id3lib project, which is a C++ library designed for robust reading, writing, and manipulation of both ID3v1 and ID3v2 tags in MP3 files. Its development paralleled the evolution of the ID3 tag standard, ensuring compatibility with various tag versions. It gained widespread adoption in Linux environments as a reliable command-line tool for scripting and batch processing of MP3 metadata due to its simplicity and powerful formatting options.