Determine MP3 bit depth in Python via Mutagen
سؤال
Is there a way to determine an MP3 file's encoded bit depth (ie 8, 16, 24, 32) in Python using the Mutagen library?
المحلول
The transformations done by the MP3 encoding process drop completely the concept of “bit depth”. You can only know the bit depth of the source audio if such information was stored in a tag of the MP3 file. Otherwise, you can take the MP3 data and produce 8-bit, 16-bit or 24-bit audio.
نصائح أخرى
I've not heard "bit depth" with regard to mp3s so I'm assuming you mean bit rate. From the Mutagen tutorial:
from mutagen.mp3 import MP3
audio = MP3("example.mp3")
print audio.info.length, audio.info.bitrate
That second portion (audio.info.bitrate
) should be what you need.
لا تنتمي إلى StackOverflow