开发者

Determine MP3 bit depth in Python via Mutagen

开发者 https://www.devze.com 2023-01-01 05:32 出处:网络
Is there a way to determine an MP3 file\'s encoded bit depth (ie 8, 16, 24, 32) in Python using the Mutag开发者_高级运维en library? The transformations done by the MP3 encoding process drop completely

Is there a way to determine an MP3 file's encoded bit depth (ie 8, 16, 24, 32) in Python using the Mutag开发者_高级运维en 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消