在Android上同时MediaRecorder最大实例数? [英] Maximum number of simultaneous MediaRecorder instances on android?

查看:956
本文介绍了在Android上同时MediaRecorder最大实例数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建Android应用程序,记录设备屏幕(使用 MediaProjection )API和视频从摄像机。我用MediaRecorder在这两种情况下。我需要一种方法来找出设备是否真的能够录制两个视频流同时进行的。我假设有溪流上可同时连接codeD上给出的设备数量限制一些,但我无法找到Android平台的任何API来查询这些信息。

I created android app that records device screen (using MediaProjection) API and video from camera at the same time. I use MediaRecorder in both cases. I need a way to find out whether device is actually capable of recording two video streams simultaneously. I assume there is some limit on number of streams that can be encoded simultaneously on given devices but I cannot find any API on android platform to query for that information.

我的事情迄今发现:

有关 MediaRecorder.release文档()建议以尽快作为释放MediaRecorder:
即使同一codeC的多个实例的支持,部分性能的降低可能会不必要时,多个实例都在同一时间使用的预期。
这表明,有一个在codeD的实例数量的限制直接限制MediaRecorders的数量。

Documentation for MediaRecorder.release() advises to release MediaRecorder as soon as possible as: " Even if multiple instances of the same codec are supported, some performance degradation may be expected when unnecessary multiple instances are used at the same time." This suggests that there's a limit on number of instances of the coded which directly limits number of MediaRecorders.

我已经写了创建MediaRecorders(配置为使用MPEG4 / H264),并在循环中开始他们的测试code - 在Nexus 5,它总是失败, java.io.IOException异常:prepare失败调用6例如prepare()的时候。这意味着你只能有5个MediaRecorder实例上Nexus5。

I've wrote testing code that creates MediaRecorders (configured to use MPEG4/H264) and starts them in a loop - On Nexus 5 it always fails with java.io.IOException: prepare failed when calling prepare() on 6th instance. This suggests you can have only 5 instances of MediaRecorder on Nexus5.

推荐答案

我不知道任何东西可以查询这些信息,但有可能的东西走进了棒棒糖,我没有看到。

I'm not aware of anything you can query for this information, though it's possible something went into Lollipop that I didn't see.

有是在硬件上codeC的实例的数目的限制是在很大程度上依赖于硬件的带宽。这不是多少流装置可以处理一个简单的问题 - 一些设备可能能够连接code两个720p的流,但不支持两条1080p流

There is a limit on the number of hardware codec instances that is largely dependent on hardware bandwidth. It's not a simple question of how many streams the device can handle -- some devices might be able to encode two 720p streams but not two 1080p streams.

在某些设备上的codeC可能会回落到一个软件实现,如果它运行的硬件资源。事情会工作,但会相当慢。 (我已经看到了这个对H.264解码,但我不知道这是否也发生了编码。)

On some devices the codec may fall back to a software implementation if it runs out of hardware resources. Things will work but will be considerably slower. (I've seen this for H.264 decoding, but I don't know if it also happens for encoding.)

我不相信这是在CTS的最低系统要求。这将是有益的知道,所有的设备可以,比方说,德code两个1080流和连接$ C $一个系统一台1080p的同时,使视频编辑器可以对所有设备进行的,但我不知道是否这样的事已被添加。 (一些非常廉价的设备将难以满足。)

I don't believe there is a minimum system requirement in CTS. It would be useful to know that all devices could, say, decode two 1080p streams and encode one 1080p simultaneously, so that a video editor could be made for all devices, but I don't know if such a thing has been added. (Some very inexpensive devices would struggle to meet that.)

这篇关于在Android上同时MediaRecorder最大实例数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆