LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How to access mp3 bitrate info in a shell script? (https://www.linuxquestions.org/questions/linux-software-2/how-to-access-mp3-bitrate-info-in-a-shell-script-470612/)

ppk007 08-03-2006 10:34 PM

How to access mp3 bitrate info in a shell script?
 
I have a large collection of mp3 files and they are encoded at various bitrates. I want to sort them into different directory hierarchies based on the bitrate. How can I access the bitrate info from a shell script so that I can do this?

Thanks in advance.

adz 08-04-2006 02:33 AM

You can fairly easily just filter the output of a playback program of some sort.

For example, mplayer. If you try the command:

Code:

mplayer filename.mp3 -frames 0 |grep kbit |cut -b 31-35
it should do what you want. Incidentally, it will work for any audio file that mplayer can play, not just mp3.

unSpawn 08-04-2006 03:50 AM

And if you find mplayer a wee bit to bulky for just that if you haven't installed it there's always one-purpose tools on Freshmeat and Sourceforge like for instance mp3info.

ppk007 08-04-2006 05:07 PM

Thanks a million. That helps.


All times are GMT -5. The time now is 09:18 PM.