在 Android 上的 AAC 流中查找

发布于 2024-09-27 19:02:08 字数 429 浏览 0 评论 0原文

我从 HTTP 服务器获取 AAC 流,并将其用作 Android 中 MediaPlayer 的数据源。
它播放得很好,但是当我尝试执行 mediaPlayer.seekTo(intposition) 时,我收到以下错误大约一百万次:
WARN/AACDecoder(13889):AAC 解码器返回错误 -1,替代静音
WARN/AACDecoder(13889):AAC 解码器返回错误 10,替换静音
WARN/AACDecoder(13889):AAC 解码器返回错误 1,替换静音

这个错误发生在 Android 2.2 上,但它似乎也不适用于早期版本。 我的应用程序必须支持查找,我希望它适用于 Android 1.5 - 2.2。

关于如何在AAC流中寻找有什么好的解决方案吗?

I'm getting an AAC stream from a HTTP server and using that as the datasource for the MediaPlayer in Android.
It plays perfectly fine, but when I try to execute mediaPlayer.seekTo(int position) I get the following errors about a million times:
WARN/AACDecoder(13889): AAC decoder returned error -1, substituting silence
WARN/AACDecoder(13889): AAC decoder returned error 10, substituting silence
WARN/AACDecoder(13889): AAC decoder returned error 1, substituting silence

This error happens on Android 2.2 but it does not seem to work on earlier versions either.
Support for seeking is a must in my application, and I would like it to work for Android 1.5 - 2.2.

Is there any good solution on how to seek in AAC streams?

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

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

发布评论

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

评论(1

桃酥萝莉 2024-10-04 19:02:08

您无法寻找已提供服务的流。服务器如何处理这个问题?

即使您保存了字节,原始 AAC 流也是不可查找的(它们不包含查找信息)。一些媒体播放器通过解析整个文件并在每次加载文件时对其进行索引来解决此问题。更好的解决方案是将流重新打包到容器中,例如 MP4。以下是使用 MP4Box 的示例:

MP4Box -add raw_stream.aac -new output_file.mp4

You cannot seek a served stream. How could the server handle this?

Even if you save the bytes, raw AAC streams are non-seekable (they contain no seek information). Some media players get around this by parsing the whole file and indexing it on the fly every time they load it. A better solution is to repackage the stream into a container, like MP4. Here's an example using MP4Box:

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