Inspect Audio Streams with ffprobe

At a glance
ffprobe is a read-only tool for extracting technical metadata—such as codec, bitrate, sample rate, and tags—from audio files, including MP3s. It outputs information in human- and machine-friendly formats, is useful for verifying file details and scripting audits, but cannot confirm true source quality. Combine with hash checks for best results.
In this guide
To accurately inspect the technical characteristics of an audio file—such as codec, bitrate, sample rate, and channel configuration—without modifying your files, ffprobe is a highly effective, read-only solution. As part of the FFmpeg suite, ffprobe extracts extensive multimedia metadata, making it particularly useful for analyzing MP3s and other music audio formats for technical validation, troubleshooting, and automated reporting tasks. This guide details effective usage, supported output formats, common scenarios, and limitations based on official project research.
What ffprobe does and does not do
ffprobe provides in-depth information about multimedia files without ever altering your source material. Its capabilities include:
- Detecting and reporting the audio codec (for example, MP3, AAC, FLAC)
- Identifying the sample rate, channel number, and stream duration
- Exporting embedded metadata such as title, artist, tags, and comments
- Supporting various output formats for both manual and scripted use
However, it’s essential to understand what ffprobe output means—and what it does not guarantee. For example, encoded properties such as bitrate and codec type strictly reflect how the file is stored and do not confirm source fidelity. A re-encoded or upconverted low-quality file can report a high bitrate or standard sample rate, but the underlying audio may still be subpar. ffprobe remains universally read-only, never writing or changing the files it inspects.
Basic command to inspect audio files
To quickly obtain essential technical details—codec, sample rate, channels, and duration—use this streamlined ffprobe command:
ffprobe -v error -show_entries stream=codec_name,sample_rate,channels:format=duration -of default=noprint_wrappers=1 example.mp3
This command performs the following:
-v errorsuppresses all output except actual errors for a clean result-show_entriesrestricts output to specified fields: codec, sample rate, channels, and duration-of default=noprint_wrappers=1prints only the requested fields for easy reading
Replace example.mp3 with your file name. A typical output might be:
codec_name=mp3
sample_rate=44100
channels=2
duration=241.227000
This reveals the codec used (here, standard mp3), sample rate in Hz (44100, matching audio CD quality), audio channel count (2 for stereo), and total duration in seconds.
Interpreting ffprobe output
To effectively evaluate audio quality and characteristics from ffprobe’s results, consider:
- Codec Name: Indicates the file’s compression method and playback compatibility. MP3 is nearly universal; newer formats may be unsupported on some players.
- Sample Rate: Determines maximum fidelity preserved; 44100 Hz is typical for full-range audio, while lower rates suggest telephone or speech uses.
- Channels: 1 for mono, 2 for stereo, higher for surround or multichannel files.
- Duration: Useful for confirming track completeness or verifying match against expected timing.
Remember, high numeric values do not guarantee original quality—especially for music files with unknown provenance. For file identity confirmation or duplication checks, a SHA-256 hash comparison complements metadata inspection and guards against hidden re-encoding or tampering.
Digging deeper into streams and formats
In more advanced cases—such as multimedia files with audio, video, or embedded artwork—ffprobe can target specific streams. For example:
ffprobe -v error -show_streams -select_streams a:0 example.mp3
This limits the output to just the first audio stream, which is useful in files containing more than audio (like music videos or podcasts with artwork attachments). To show both container (format) and stream-specific details, including any embedded tags, try:
ffprobe -show_format -show_streams example.flac
This extensively lists format-level and stream-level metadata, including tag fields for artist, album, genre, or other user-supplied details when present.
Example: checking a downloaded MP3
Suppose you’ve saved mystery_song.mp3 and want to verify its technical specs and general quality before adding it to your music library.
- Run:
ffprobe -v error -show_entries stream=codec_name,sample_rate,channels:format=duration -of default=noprint_wrappers=1 mystery_song.mp3 - Review the report. If you see:
That means stereo MP3 at CD-quality sample rate, with a duration just over 185 seconds.codec_name=mp3 sample_rate=44100 channels=2 duration=185.335000 - If you also want to check the bitrate (a helpful but not definitive indicator of audio quality):
If it reportsffprobe -v error -show_entries stream=bit_rate -of default=noprint_wrappers=1 mystery_song.mp3bit_rate=192000, that’s 192 kbps—decent for general listening but not proof of high source quality.
To further review embedded tags, use:
ffprobe -show_format mystery_song.mp3
This displays title, artist, album, date, or other tag fields if present.
Choosing output formats for scripting or reporting
ffprobe’s output can be tailored to suit manual review or automated workflows. For direct scripting or bulk processing, use:
ffprobe -v error -show_entries stream=codec_name,sample_rate,channels:format=duration -of json example.mp3
This yields machine-readable JSON, suitable for library scans or integration into music database tools. Alternatives include:
-of csv=p=0for CSV tables or inventory lists-of xmlfor structured, extensible data exchange
Advice for investigating multiple audio files
- When analyzing irreplaceable files, always use a working copy to eliminate risk during examination—even with read-only tools.
- For collections, automate with shell loops and export data to summary files. For instance, a bash one-liner to audit an entire directory:
This appends a CSV report for each file tofor f in *.mp3; do ffprobe -v error -show_entries stream=codec_name,sample_rate,channels:format=duration -of csv=p=0 "$f" >> summary.csv; donesummary.csv. - If richer tag perspectives are needed, cross-reference outputs with MediaInfo for alternative container and tag parsing.
Practical next step
After inspecting your audio files with ffprobe, save the metadata outputs as a reference state before editing, converting, or archiving your collection. For critical files or release candidates, supplement technical checks with hash comparisons to safeguard against accidental changes or unnoticed re-encoding. This combined approach ensures both catalog integrity and file authenticity within your music library workflows.


