读取 ID3v2.3 标签时出现问题?

发布于 2024-09-07 18:04:59 字数 396 浏览 5 评论 0原文

我在读取 ID3v2.3 标签时遇到问题。首先,我从 www.id3.org 上阅读了有关 id3 标签的信息。 id3 标签的文档说它有前 3 个字节,其中包含“ID3”,然后 2 个字节包含版本和修订号(例如 03 00)和然后下一个第一个字节包含标志(不同步、扩展头、实验指示符),然后接下来的 4 个字节被保留为大小。我能够读取尺寸。但我的问题是,当我从当前位置向前寻找指针时(我从 ID3 标签大小中获取的大小),这意味着我已经到达 ID3 标签的末尾,这意味着我们将读取的下一个字节是MP3 数据字节,但情况并非如此。所以请帮助我检测 MP3 标头和MP3 数据借助 ID3 标签大小。我的第二个问题是 MP3 帧是否与 ID3 帧混合,或者它是否与 ID3 标签完全分开。如果它与 ID3 标签分开,那么在 ID3 标签的末尾有第一个 MP3 帧。是对是错?告诉我

I have a problem in reading an ID3v2.3 tag. First of all I read about id3 tags from www.id3.org. The documentation of id3 tags says it has first 3 bytes which contain 'ID3' then 2 bytes contain version and revision number(for example 03 00) & then next first byte contain flags(Unsynchronisation, Extended header, Experimental indicator) then next 4 bytes is reserverd for size. I am able to read size. But My problem is that when I seek my pointer from current position to forward direction (size which I have taken from ID3 tag size), so it means I have reaached at the end of ID3 tag, It means so next byte we will read is the MP3 data byte, but it is not case. So Help me in detecting MP3 header & MP3 data with the help of ID3 tag size. And My second question is that Is MP3 frames are mixed with ID3 frames or Is it completely seprate from ID3 tag. If it is seprate from ID3 tag so in the end of ID3 tag there is a first MP3 frame. Is is right or not? Tell me

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

笔芯 2024-09-14 18:04:59

您是否可能错误地读取了尺寸?四个大小字节的最左边位被清零。这样就只剩下 28 位了。摘自 ID3.org 文档:

“ID3v2标签大小编码为
最多的四个字节
有效位(位 7)设置为零
每个字节,总共 28 个
位。归零位被忽略,所以
表示一个 257 字节长的标签
为 $00 00 02 01。”

即 00000000 00000000 00000010 00000001
变成
0000 00000000 00000001 00000001

这可能是我对标签最困惑的事情,所以也许它也让你措手不及。

Is it possible that you incorrectly read the size? The four size bytes have their leftmost bit zeroed. This leaves one with only 28 bits. Taken from the ID3.org documentation:

"The ID3v2 tag size is encoded with
four bytes where the most
significant bit (bit 7) is set to zero
in every byte, making a total of 28
bits. The zeroed bits are ignored, so
a 257 bytes long tag is represented
as $00 00 02 01."

ie. 00000000 00000000 00000010 00000001
becomes
0000 00000000 00000001 00000001

This was probably the most confusing thing for me in regards to the tags, so perhaps it caught you off guard as well.

听风念你 2024-09-14 18:04:59

MP3 帧不与 ID3 帧混合。请注意,在 ID3v2.x 中,标签头大小值是一个同步安全整数,本质上是一个整数转换为每个字节的 MSB 为 0 的格式。相当于每 7 位后面插入一个 0。阅读维基百科: http://en.wikipedia.org/wiki/Synchsafe

您也可以看一下这里:同步安全整数

在下面的链接中,您可以找到一个ID3 标签系统概述以及如何解码 ID3 标签的手动说明:ID3 标签是什么?

MP3 frames at not mixed with ID3 frames. Please note that in ID3v2.x tag header size value is an synchronization safe integer, which is essentially an integer converted into a format in which the MSB of each byte is 0. It is equivalent to insert one 0 after each 7 bits. Read in wikipedia: http://en.wikipedia.org/wiki/Synchsafe

Also you can have a look at here: Synchronization Safe Integer

In the below link you can find an overview of the ID3 Tag system and also a manual description on how to decode the ID3 Tags: What are ID3 Tags all about?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文