如何获得支持的视频摄像头的分辨率在android系统? [英] How to get supported video camera resolutions in android?

查看:364
本文介绍了如何获得支持的视频摄像头的分辨率在android系统?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写一个应用程序我在哪里允许用户使用手机摄像头拍摄的视频。我用我自己的code录制视频,而不是内置相机应用机器人。

I am writing an app where I am allowing the user to capture video using the phones camera. I am using my own code to record the video as opposed to Androids built in camera app.

但我需要能够访问支持的相机分辨率的列表,以便我可以在运行时使用哪一种选择一切工作正常。我在寻找类似 getSupportedPictureSizes()但对于视频。 Android 3.0的有这个功能,但我期待的东西2.2。

Everything is working OK except I need to be able to access the list of supported camera resolutions so I can choose at runtime which one to use. I am looking for something like getSupportedPictureSizes() but for video. Android 3.0 has this functionality but I am looking for something for 2.2.

截至目前我使用 CamcorderProfile.QUALITY_HIGH / QUALITY_LOW ,但这只是给了我两个选择,并在手机上我一直在测试上,文件大小在每一个极致。(QUALITY_LOW为216 KB / s和QUALITY_HIGH是> 3 MB /秒)

As of right now I am using CamcorderProfile.QUALITY_HIGH / QUALITY_LOW, but this only gives me two options and on the phones I have been testing on, the file sizes are at each extreme.(QUALITY_LOW is 216 kb/s and QUALITY_HIGH is > 3 MB/s)

任何帮助将大大AP preciated,
谢谢!

Any help would be greatly appreciated, Thank You!

推荐答案

你有没有尝试使用 getSupportedVideoSizes() Camera.Parameters 类方法

Did you try to use the getSupportedVideoSizes() method from Camera.Parameters class?

public List<Camera.Size> getSupportedVideoSizes()

该方法返回尺寸对象的列表。它会返回如果相机没有独立的preVIEW和视频输出。 这里答案表明,当它返回你可以使用<一href=\"http://developer.android.com/reference/android/hardware/Camera.Parameters.html#getSupported$p$pviewSizes()\"相对=nofollow> getSupported previewSizes() 列表。

This method returns a list of Size objects. It will return null if the camera does not have separate preview and video output. The answer here indicates that when this returns null you may use the getSupportedPreviewSizes() list.

这篇关于如何获得支持的视频摄像头的分辨率在android系统?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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