正在浏览谷歌发布的camera2视频样本应用程序,其中一种方法如下:
/**
* In this sample, we choose a video size with 3x4 aspect ratio. Also, we don't use sizes
* larger than 1080p, since MediaRecorder cannot handle such a high-resolution video.
*
* @param choices The list of available sizes
* @return The video size
*/
private static Size chooseVideoSize(Size[] choices) {
for (Size size : choices) {
if (size.getWidth() == size.getHeight() * 4 / 3 && size.getWidth() <= 1080) {
return size;
}
}
Log.e(TAG, "Couldn't find any suitable video size");
return choices[choices.length - 1];
}我已经摆弄了我自己的camera2实现,并试图用媒体记录器录制4K视频,它工作得很好--记录的文件显示了3840 × 2160的尺寸。
那么,示例中的注释是不正确的,还是MediaRecorder不能处理棒棒糖上的更大分辨率,而能够处理Marshmallow或其他东西呢?
发布于 2015-11-13 21:56:58
CamcorderProfile确实支持4K,即“Quality2160p”,所以最好的做法是检查是否支持该配置文件。如果是这样的话,那么使用这个大小作为camera2输出到MediaRecorder是可以的。
然而,由于并非所有设备都支持4K,所以1080 p是示例应用程序中使用的保守限制--应用程序的某些部分也早于向CamcorderProfile添加4K支持,因此该评论有点过时。
发布于 2015-11-11 16:22:59
这种方法中的选择数组来自CameraCharacteristics / StreamConfigurationMap getOutputSize --我认为它是从相机硬件配置文件中收集的?
是的,但是这个相机配置文件不一定符合MediaRecorder的功能,例如这。
你可以更好地信任摄像机的配置文件,
mediarecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH));但是没有小故障,也不能保证在特定的设备上MediaRecorder不能处理更多的问题。
无论如何,CamcorderProfile有高达1080 p的“官方”配置文件,因此它是示例代码的合理选择,它并不声称为最广泛的设备提供最好的结果。
https://stackoverflow.com/questions/33654287
复制相似问题