在java中解析ogg文件而不解码
我有一个 .spx 文件(带有 Speex 编码音频的 Ogg
文件)。我想使用 Java 将 Speex 编码的字节从 Ogg 容器中提取出来。
问题是,似乎我能找到的所有 Java 库(JSpeex、JOrbis
)都是假设我还想将音频解码为原始 pcm
,我不知道。
是否有适用于 Java
的通用 Ogg
格式阅读器库?另一方面,是否可以使用 JSpeex
或 JOrbis
的部分来完成我想要的操作?
I have a .spx file (an Ogg
file with Speex-encoded audio). I would like to use Java
to pull the Speex-encoded bytes out of the Ogg
container.
The problem is, it seems all of the Java libraries I can find (JSpeex, JOrbis
) are written with the assumption that I would also like to decode the audio into raw pcm
, which I do not.
Is there a generic Ogg
format reader library out there for Java
? On the other hand, is it possible to use parts of JSpeex
or JOrbis
to do what I want?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
经过一些浅层搜索后,我找不到 Java 中的 Ogg 库。
但如果你愿意从头开始实现 Ogg 解析,直接从马口中出来的话就很容易获得:
(首页:https://www.xiph.org/vorbis/doc /)
I could not find an Ogg library in Java after some shallow searching.
But if you are willing to implement Ogg parsing from scratch, the words straight from the horse's mouth are readily available:
(Top page: https://www.xiph.org/vorbis/doc/)
我没有使用过带有 Speex 编码音频的 Ogg 文件,但是一旦我处理了一个用例,我想从 ogg opus 文件中提取 opus 数据包,而不被解码为 pcm 音频。您可以在此答案中找到该解决方案
https://stackoverflow.com/a/65320789/10110652
这段代码也适用于带有 vorbis 编码的 ogg 文件,因此这可能也有助于 speex 编码。请告诉我这是否适合您。
快乐编码!!!❤
I have not worked with Ogg file with Speex-encoded audio but once I have worked on a use case where I wanted to extract opus packets from ogg opus file, without being decoded to pcm audio. You can find that solution in this answer
https://stackoverflow.com/a/65320789/10110652
This piece of code also works for ogg file with vorbis encoding, so may be this might help with speex encoding as well. Do let me know if this works for you.
Happy Coding!!!❤