MediaRecorder 类在轻微延迟后开始录制音频
我在使用 MediaRecorder 类时遇到问题。当我调用 start() 方法时,录音机开始录音(音频),但经过一些延迟(延迟非常明显 - 大约 1 秒)。我在 Android 2.3 设备上看到过这种情况,特别是 Samsung Nexus S。此问题不会出现在 Android 1.6 (G1) 或任何版本的 Android 模拟器上。您能否确认您是否遇到此问题以及是否存在解决方案?这是一个已记录的错误吗?
I am having an issue with the MediaRecorder class. When I call the start() method, the recorder starts recording(audio) but after some delay (The delay is quite noticeable - approximately 1 second). I have seen this happening on Android 2.3 devices, specifically Samsung Nexus S. This issue does not appear on Android 1.6 (G1) or any version of Android emulators. Could you please confirm if you are seeing this issue and if there exists a solution for the same? Is this a documented bug?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这似乎是 MediaRecorder 或设备固件中的错误。您可以在默认相机应用程序中看到相同的延迟,该应用程序也使用 MediaRecorder。我还注意到,每次录制结束时(视频停止录制时)都会有额外的音频。然而,视频和音频似乎在整个视频中是同步的。事情是这样的:
所以音频并没有真正“转移”,它只是在视频捕获之后开始和结束。
我在运行 Honeycomb (Android 3.0) 的 Motorola Xoom 平板电脑上看到了延迟。
请在此处查看错误报告:http://code.google.com/p /android/issues/detail?id=15953
This seems to be either a bug in either MediaRecorder or the device's firmware. You can see the same delay in the default Camera app, which also uses MediaRecorder. I also noticed that there's extra audio at the end of each recording, past when the video stops recording. However, the video and audio seem to be synched throughout the video. It's something like this:
So the audio isn't really "shifted", it just begins and ends past the video capture.
I'm witnessing the delay on a Motorola Xoom tablet running Honeycomb (Android 3.0).
See a bug report here: http://code.google.com/p/android/issues/detail?id=15953
我找到了问题(与 CyanogenMod 无关):
https://github.com/CyanogenMod/android_frameworks_base/commit/d7f1c3d69274fef8772a663ce1c792f d0466fcc5
该提交已进入Android 2.2 和 2.3 之间。它的目的似乎是在开始录制时将默认相机应用程序的声音静音(尽管 1 秒似乎有点长)。它应该逐渐淡出声音,但实施似乎不起作用。 1秒后就很难剪辑了,你也可以在相机应用程序中尝试一下。
我真的不明白他们为什么在这个级别实现它,其他应用程序也受到影响。而且该行为不可配置,因此我认为没有可能的解决方法。我们只能希望它能在未来的版本中得到修复。
I tracked down the problem (not CyanogenMod related):
https://github.com/CyanogenMod/android_frameworks_base/commit/d7f1c3d69274fef8772a663ce1c792fd0466fcc5
This commit got in between Android 2.2 and 2.3. Its purpose seems to be to mute the sound of the default camera app when starting to record (although 1 second seems a bit long for that). And it should fade in the sound gradually, but the implementation does not seem to work. It's a hard cut after 1 second, you can also try this in the camera app.
I really don't understand why they implemented it at this level, where also other applications are affected. And the behaviour is not configurable, so I see no possible workaround. We can only hope that it will be fixed in future versions.
我已添加到由 alalonde 链接的 Android 错误报告。我认为这是 Android 2.3 的错误,因为相同的代码在 2.2 及更早版本上运行得很好。我有一台 myTouch 4G,在普通 2.2 固件上运行良好。当我升级到基于 2.3.3 的 Cyanogen Rom 后,我注意到有 1 秒的延迟。相同的硬件,相同的应用程序,不同的操作系统版本。必须是操作系统。
I've added to the android bug report linked to by alalonde. I see this as an Android 2.3 bug since the same code runs just fine on 2.2 and earlier. I have a myTouch 4G which worked fine on stock 2.2 firmware. As soon as I upgraded to Cyanogen Rom based on 2.3.3 I noticed the 1 second delay. Same hardware, same application, different OS version. Has to be the OS.