Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine the bitrate of mp3 files with Python? [closed]

How to determine the type of the bitrate used for an mp3 file, e.g. CBR, VBR or ABR?

like image 479
Cosmologist Avatar asked Mar 16 '11 21:03

Cosmologist


People also ask

How do I find the bitrate of an audio file?

Install Spek on your computer. Spek is a free program that performs a spectrum analysis on an audio file. The spectrum (or chart) is a graph which shows the frequency (in kHz) and the loudness (in dB), and you can use this information to determine the true bitrate.

How to get the duration of any audio file using Python?

Now let us see, how we can get the duration of any audio file using python: Mutagen is a Python module to handle audio metadata. It supports various formats of audio files like wavpack, mp3, Ogg, etc. Below are the steps to use it for computing the duration of the audio files:

Can you manipulate audio files in Python?

Dealing with audio files may not be that common to a Python enthusiast, but sometimes you may wonder if you are able to manipulate audio files in Python for your personal interest.

What is the best bit rate for audio quality?

Though audio quality depends on many elements such as frequency, compressing method, up-scaled, etc., but for almost audio files downloaded on the Internet that have not been up scaled, if the bit rate is high (~128 kbps or higher), then the sound will be clearer and "more comfortable" to hear.


1 Answers

mutagen works for me. Here is an excerpt from one of my scripts.

from mutagen.mp3 import MP3

f = MP3(musicfile)
bitrate = f.info.bitrate / 1000
like image 159
Martin Tournoij Avatar answered Sep 19 '22 00:09

Martin Tournoij