Command to get information about a mp3 using ffmpeg?

19,549

Solution 1

you can try:

ffmpeg -i filename

Solution 2

There is a ffprobe.

Simple usage:

ffprobe foo.mp3 2>&1 | grep -A1 Duration:

will give you output (without displaying any extra window) like:

  Duration: 00:03:10.48, start: 0.000000, bitrate: 128 kb/s
    Stream #0.0: Audio: mp3, 22050 Hz, 2 channels, s16, 128 kb/s

Solution 3

You can also use:

$ mpg123 -t example.mp3 2>&1 | grep -A1 -E "^MPEG"
MPEG 2.5 L III cbr32 11025 mono
  • Notice cbr32 stand for (stream) constant bit rate, here at 32 kbps.
  • And 11025 is the Sample Rate.
Share:
19,549
user784637
Author by

user784637

Updated on June 13, 2022

Comments

  • user784637
    user784637 about 2 years

    Is there a command with ffmpeg that returns information about an mp3 like the bitrate or sampling frequency?

  • Maxwel Leite
    Maxwel Leite about 6 years
    ffmpeg -i foo.mp3 2>&1 | grep -A1 Duration: works too!
  • Liu Silong
    Liu Silong over 4 years
    This command will go in and out of the warning below "At least one output file must be specified". using this will not "ffprobe -i filename"