-
Notifications
You must be signed in to change notification settings - Fork 245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bit rate for MP4 audio tracks #414
Comments
Thank you for the detailed breakdown, and links to the Chromium example, that was helpful. |
Fix wrong variable name in ce4a159
Thanks for the implementation, I am so glad the references were helpful! It is difficult with PRs without knowing the code well enough. As for the improvements, I think you already had a function to read the sizes - |
Sometimes I don't know the code that well myself -- most of getID3 was written 20 years ago... You're right, |
I have noticed that getID3 does not output bit rate for MP4 audio, while other tools, like
MediaInfo
andffprobe
, do that. This can be seen with the sample provided for #413. It would be nice to have this feature in getID3 too.Technically, it is possible to extract the bit rate from
esds
extension atom.Sound Sample Descriptions may contain extensions which are made using atoms. MPEG-4 Elementary Stream Descriptor Atom ('esds') contains Elementary Stream Descriptor as defined in the MPEG-4 specification ISO/IEC 14496, which in turn contains
DecoderConfigDescriptor
withmaxBitrate
andavgBitrate
fields.To read this information, the following logic can be used:
esds
atom is found, parse it. For example, the sample in question contains the following atom:00000033 65736473 00000000 03 80808022 0002 00 04 80808014 40 15 000000 0004e211 0004e211 05 80808002 1190 06 80808001 02
with header:
00000033
- size 51 bytes65736473
-esds
00000000
- version (0)and Elementary Stream Descriptor (see ISO/IEC 14496-1:2010 7.2.6.5 and 7.2.6.6):
03
-ES_DescrTag
80808022
- size 34 bytes0002
-ES_ID
00
- flags-----
04
-DecoderConfigDescrTag
80808014
- size 20 bytes40
-objectTypeIndication
("Audio ISO/IEC 14496-3")15
-streamType
plus flags ("AudioStream")000000
-bufferSizeDB
0004e211
-maxBitrate
(320017)0004e211
-avgBitrate
(320017)05
-DecSpecificInfoTag
80808002
- size 2 bytes1190
-DecoderSpecificInfo
-----
06
-SLConfigDescrTag
80808001
- size 1 byte02
-SLConfigDescriptor
("Reserved for use in MP4 files")An example of parsing can also be found here.
The text was updated successfully, but these errors were encountered: