简体   繁体   中英

How to know the byte offset of a specific CBR MP3 frame?

I created my own MP3 frame parser. I can read each frame individually if I do it sequentially.

My problem is that I have yet to figure out how to find the byte offset of the nth frame (without having to read all the prior frames).

CBR makes this process easier, but I still don't know how the padding bit factors in.

For example, take a file that has the following info:

Total file length:  4916595

===== ID3 METADATA =====
ID3v2 header length:  143

===== MP3 FRAMES =====
Version: MPEG Version 1
Layer: Layer III
Error protection: No
Bitrate: 192
Frequency: 44.1

Some frames have a byte length of 626 and other frames have a length of 627 .

Let's say I want to find the 100th frame, I can't simply do 100 * 626 , nor can I do 100 * 627 .

How should I factor in the padding bit in my formula to find nth frame's byte offfset?

Probably MP3val solves your problem. Once installed, run:

mp3val -f file.mp3

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM