How to show bit-rate on mp3 files from the command line?
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How to show bit-rate on mp3 files from the command line?
Sometime in the past, I had installed some Debian package that would show the bit-rate on a .mp3 file, but alas, I cannot remember the name of the package. I thought it was the id3v2 utility, but that does not apparently show the bit-rate. I installed mpg123, but the mpg123 man page says nothing about showing that type of info. I do not want a GUI, I need it from the command line.
Can someone tell me what package I can install to show the bit-rate (no, I don't want to build it from source if at all possible), and ideally it would show it along with the ID3v2 MP3 tags as well similar to what id3v2 does.
Yes, that does show the bitrate, but takes way to long to come back with the answer on long mp3 files, presumably since that -t option decodes the entire stream file. I am expecting to be able to be able to get a bitrate reading from many .mp3 files, and that delay will be too expensive. So, aren't there any other tools that just seek into the file and read out the bitrate along with the other tags?
id3info (which is a sort of demo tool in id3lib) will give you the bit rate and tags but only id3v1. There's also id3, mp3info, the aforementioned id3v2, and several others. I can't remember which are which and do what, though.
id3info (which is a sort of demo tool in id3lib) will give you the bit rate and tags but only id3v1. There's also id3, mp3info, the aforementioned id3v2, and several others. I can't remember which are which and do what, though.
Quote:
Originally Posted by bathory
In that case, you can use:
Code:
mpg123 -t -n 1 file.mp3
Regards
Thanks everyone. I'll give them a shot and report back what I find that works the best.
Thanks everyone. I'll give them a shot and report back what I find that works the best.
bg
I found some of my files that, when running both with "mpg123 -t -n 1" and "mpg123 -t", I see output of the form that does NOT include any kbit/s reading:
Code:
High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
version 1.7.2; written and copyright by Michael Hipp and others
free software (LGPL/GPL) without any warranty but with best wishes
Directory: [CENSORED]
Playing MPEG stream 1 of 1: [CENSORED] ...
Title: [CENSORED] Artist: [CENSORED]
Comment: Album: [CENSORED]
Year: 2007 Genre: Jazz,
MPEG 1.0 layer III, VBR, 44100 Hz joint-stereo
[0:00] Decoding of [CENSORED] finished.
So I don't know why that would be the case since the files do have to have some bitrate, don't they? Regardless, I'll investigate the other programs that were suggested.
I've not got time to test it, but I seem to recall that the midentify.sh script that's in the mplayer source archive might be able to give you this information.
edit: Here it is:
Code:
#!/bin/sh
#
# This is a wrapper around the -identify functionality.
# It is supposed to escape the output properly, so it can be easily
# used in shellscripts by 'eval'ing the output of this script.
#
# Written by Tobias Diedrich <ranma+mplayer@tdiedrich.de>
# Licensed under GNU GPL.
if [ -z "$1" ]; then
echo "Usage: midentify.sh <file> [<file> ...]"
exit 1
fi
mplayer -vo null -ao null -frames 0 -identify "$@" 2>/dev/null |
sed -ne '/^ID_/ {
s/[]()|&;<>`'"'"'\\!$" []/\\&/g;p
}'
Thanks a bunch everyone. the midentify.sh script fits the bill I believe, but I will have to try it on tons of files first. Some of the files I tried it on show two outputs for bitrate which I will have to puzzle over.
Gee. Can someone explain that substitution string to me?
I'm pretty sure that it defines the author as a virgo, with libra on the horizon, then you turn left, go down three flights of stairs, take the elevator up 6 floors, to the lingerie department, look up, flick your left ear, leave via the fire exit, hail the 3rd burgundy cab that comes your way, and tell the driver to "fondle mine botox", or something eerily similar.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.