Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Strange bitrates reported, e.g. 320141 instead of 320000 #328
When extracting the bitrate from many mp3 files, I get strange values such as 128111, 192167, 256222, or 320141 instead of the standards 128000, 192000, 256000, and 320000.
As I can only see the standard values in mutagen/mp3/init.py, I infer these numbers have to come from the file itself. Though the bitrate is correctly reported by other tools. Take for example this audio file. With mutagen I get:
Any idea? (What does "Lame Bitrate" mean BTW?)
Thanks fro your prompt action! For the above mp3, I now get a bitrate of 320048 instead of 320141. I would still expect to get 320000 though.
May that be because when CBR is detected, an exact computation is run, whereas some metadata is used to infer the bitrate if no encoding mode is detected?
yeah, I just noticed that lame includes the first frame in the byte count but not the frame count, will fix.
The files reported as unknown don't have a lame header, so we can't know the bitrate without going through the whole file, and the bitrate reported there is from the first frame.
These are three faulty mp3 files (music is CC-licensed):
for tid in [640, 6669, 14298]: f = mutagen.File(utils.get_audio_path(AUDIO_DIR, tid)) print(f.info.bitrate, f.info.bitrate_mode) print('https://files.freemusicarchive.org/' + raw_tracks.at[tid, 'track_file'])