问题计算/解析OGGS/OPUS音频文件标题
我正在阅读OGG音频文件标头,并且很难理解如何计算下一个OGG文件段的位置。我能够将此网页用作示例: https://www.file-recovery.com/ogg-signature-format.htm 使用此示例。我能够计算OGGS标头的正确位置。
但是...在示例链接中,在Offset(DEC)128 + 1有FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF B6
和计算这很简单,12*255 = 3060 ,3060 + 182(HEX B6)= 3242,3242 + 1 + 1 + 13 + 128 = 3384。因此,从最后一个读取标题0x3a(12月58日)开始,如果我总共寻求3384字节,我完全在下一个OGG文件标头的点。
现在,我的问题出现的地方就是这个。在真实的OGG/Opus文件中,计算下一个OGG标头的值使我有些困惑。这是一张图像,希望它可以使我的问题更容易。
我不确定如何在此处进行。 0x48 = 12月72日。所以我认为这里有72个记录每个3个字节长?那没有道理。还是是72个记录,偏移0xAC的0x03只是计算的一部分?这让我感到困惑,我不确定我是否正确地问问题。但是我要做的就是从上到下分析整个OGG文件。我不想在每个标题上进行任何类型的处理(尚未),我只需要以正确的方法来计算这些OGG标头/段位置。如果我需要详细说明任何事情,请询问,我会尽力而为。提前致谢
I am reading an ogg audio file header and am having some difficulty understanding how to compute the location of the next ogg file segment. i was able to use this webpage as an example: https://www.file-recovery.com/ogg-signature-format.htm using this example.ogg file i was able to compute the right locations of the oggs headers.
BUT... in the example link, at offset (dec) 128 + 1 there is FF FF FF FF FF FF FF FF FF FF FF FF B6
and calculating this is simple, 12*255 = 3060, 3060 + 182 (hex B6) = 3242, 3242 + 1 + 13 + 128 = 3384. so from the start of the last read header 0x3A (dec 58), if i seek a total of 3384 bytes, i am exactly at the spot of the next ogg file header.
now, where my problem comes in is this. in a real ogg/opus file, the values to calculate where the next ogg header are slightly confusing me. here is an image hopefully it will make it a little easier to get my problem across.
i am not sure how to proceed here. 0x48 = dec 72. so i would assume that there are 72 records here that are 3 bytes long each? that doesnt make sense. Or would it be 72 records, and the 0x03 at offset 0xAC is just part of the calculation? this is confusing to me, and i am not sure if i am asking the question right. but what i am trying to do is just parse the whole ogg file from top to bottom. im not looking to do any sort of processing at each header (yet) and i just need to fogire out the correct way to calculate these ogg header/segment location. if i need to elaborate on anything please ask and i will do my best. thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我能够解决这个问题。我只是一个简单的误解。当您读取(如上面的示例)时,0x48 = 12月72日。下一步添加文件中的当前位置,然后向其添加72个,然后添加/总和接下来的72个字符,无论它们可能是什么。这将为您提供偏移(((从文件的开头)下一个OGG条目的
i was able to figure this out. was just a simple misunderstanding on my part. when you read (as in the example above) 0x48 = dec 72. next add current position in file, then add 72 to that, then add/sum the next 72 characters, whatever they may be. this will give you the offset ((from the beginning of the file) of the next ogg entry