在某些Android手机中找不到相机分辨率CamcorderProfile(Camera resolution CamcorderProfile not found in some Android phones)
我有一个代码示例:
mediaRecorder = new MediaRecorder();
mediaRecorder.setPreviewDisplay(surfaceHolder.getSurface());
mediaRecorder.setCamera(camera);
mediaRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);
mediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
mediaRecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_480P));
这似乎工作得很好,以及CamcorderProfile.QUALITY_LOW
但当我试图获得360p视频,并使用CamcorderProfile.QUALITY_CIF(int = 3)时,我在索尼Xperia Z3(android 6.0.1)中出现错误
MediaProfiles: The given camcorder profile camera 0 quality 3 is not found
System.err: java.lang.RuntimeException: Error retrieving camcorder profile params
System.err: at android.media.CamcorderProfile.native_get_camcorder_profile(Native Method)
System.err: at android.media.CamcorderProfile.get(CamcorderProfile.java:471)
System.err: at android.media.CamcorderProfile.get(CamcorderProfile.java:402)
AOSP测试套件是否仍然没有测试SDK相机质量常数? 我可以在生产中使用哪些常量,并期望所有手机(至少从5.0)支持它?
I have a code example:
mediaRecorder = new MediaRecorder();
mediaRecorder.setPreviewDisplay(surfaceHolder.getSurface());
mediaRecorder.setCamera(camera);
mediaRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);
mediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
mediaRecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_480P));
This seems to work fine, as well as CamcorderProfile.QUALITY_LOW
But when I trying to get 360p video, and using CamcorderProfile.QUALITY_CIF (int = 3), I get en error in Sony Xperia Z3 (android 6.0.1)
MediaProfiles: The given camcorder profile camera 0 quality 3 is not found
System.err: java.lang.RuntimeException: Error retrieving camcorder profile params
System.err: at android.media.CamcorderProfile.native_get_camcorder_profile(Native Method)
System.err: at android.media.CamcorderProfile.get(CamcorderProfile.java:471)
System.err: at android.media.CamcorderProfile.get(CamcorderProfile.java:402)
Does AOSP test suite still have not tests for SDK camera quality constants? What constants can I use in production and expect all phones (at least from 5.0) support it?
原文:https://stackoverflow.com/questions/42417955
更新时间:2020-01-29 06:01
最满意答案
但当我试图获得360p视频,并使用CamcorderProfile.QUALITY_CIF(int = 3)时,我在索尼Xperia Z3(android 6.0.1)中出现错误
如果您调用hasProfile() ,以查看配置文件是否受支持,并且它返回true ,但您仍然遇到此崩溃,那么设备固件中存在错误。
如果你没有调用hasProfile() ,或者你忽略了它的结果,那么你的应用程序中就存在一个错误。
我可以在生产中使用哪些常量,并期望所有手机(至少从5.0)支持它?
我不相信这是正式记录的。 我认为 QUALITY_LOW和QUALITY_HIGH应该始终存在,尽管它们的输出可能有效,也可能无效。
But when I trying to get 360p video, and using CamcorderProfile.QUALITY_CIF (int = 3), I get en error in Sony Xperia Z3 (android 6.0.1)
If you called hasProfile(), to see if the profile was supported, and it returned true, but you still got this crash, then there is bug in the device firmware.
If you did not call hasProfile(), or you ignored its result, then there is a bug in your app.
What constants can I use in production and expect all phones (at least from 5.0) support it?
I do not believe that this is officially documented. I think that QUALITY_LOW and QUALITY_HIGH should always exist, though the output from them may or may not work.
2017-02-23
相关问答
我遇到了这个问题,试图解决同样的问题。 xda开发者http://forum.xda-developers.com/showthread.php?t=1104970&page=8提供了一个解决方案。 看起来您需要设置一个模糊的参数“cam_mode”以便高清晰度录制工作: camera = Camera.open();
Camera.Parameters param = camera.getParameters();
param.set( "cam_mode", 1 );
camera.
...
320 x 480是新移动设备的常见屏幕分辨率。 iPhone网站兼容性 Android显示指标 这就是说,如果你想支持大多数移动设备,你可能想要支持多种分辨率。 320 by 480 is the common screen resolution for new mobile devices. iPhone Website Compatibility Android Display Metrics That being said if you want to support the majori
...
是设备特定的错误(Galaxy选项卡4)。 我看到设备相机原始数据并且包含可用的视频分辨率密钥(“视频大小值”) 可以在+ info中查看相机原始数据 Is device specific bug (Galaxy tab 4). I see device camera raw data and con´t contains avaliable video resolution key ("video-size-values") Can check camera raw data here in +
...
你可以使用tvdpi : mdpi和hdpi之间的屏幕资源; 大约213dpi。 这不被视为“主要”密度组。 它主要用于电视,大多数应用程序都不需要它 - 为大多数应用程序提供mdpi和hdpi资源已足够,系统会根据需要对其进行扩展。 如果您发现有必要提供tvdpi资源,则应该将其大小设置为1.33 * mdpi。 例如,mdpi屏幕的100px x 100px图像对于tvdpi应为133px x 133px。 I tried the tvdpi, but unfortunately the Ga
...
我不确切知道,但我认为这可以帮到你。 在启动相机之前必须执行以下步骤。 如果要设置视频分辨率,则需要设置预览尺寸,否则需要使用相机参数在相机中设置图像尺寸。 如果不支持给定分辨率,将设置最近的分辨率。 首先得到你的相机。 Camera mCamera = Camera.open();
获取相机参数并在相机参数中设置预览大小。 Camera.Parameters parameters = mCamera.getParameters();
parameters.setPreviewSize(
...
在开发人员预览中,无法通过ARCore API访问摄像头的分辨率。 我在一个单独的问题的评论中询问了解决方案,看起来开发人员预览中的相机分辨率将始终为1920x1080 。 There isn't a way to access the camera's resolution through the ARCore API in the developer preview. I asked about the resolution in comments of a separate question
...
这可能是不可能的。 但是,您可以查看这些链接并了解如何提供不同的图像(像素和密度),布局等。 可能无法在低密度屏幕上以与高密度屏幕相同的方式制作用户界面,然后您可以将不同的布局定位到不同的手机,例如 提供资源 应用资源 That may not be possible. However you can look at these links and learn how to provide different images(pixels and density), layouts and furt
...
您可以使用此元标记
在HTML文档的
部分中,根据您使用的设备的屏幕宽度缩放文档。 检查MDN以获取有关视口元标记及其用法的更多信息。 You can use this meta tagin the
...
Apple Retina屏幕会报告自己好像它实际拥有的像素数量的一半,因为浏览器本身就是魔术。 如果要检测高分辨率屏幕,请乘以pixeloffnsity。 不要进行使用检查,因为您将每两周添加更多设备。 它打破了网络。 进行功能检查或特定检查。 哦,如果您只是想为移动设备显示更大的按钮,您将需要阅读CSS3媒体查询。 An Apple Retina Screen will report itself as if it has half the amount of pixels it actuall
...
但当我试图获得360p视频,并使用CamcorderProfile.QUALITY_CIF(int = 3)时,我在索尼Xperia Z3(android 6.0.1)中出现错误 如果您调用hasProfile() ,以查看配置文件是否受支持,并且它返回true ,但您仍然遇到此崩溃,那么设备固件中存在错误。 如果你没有调用hasProfile() ,或者你忽略了它的结果,那么你的应用程序中就存在一个错误。 我可以在生产中使用哪些常量,并期望所有手机(至少从5.0)支持它? 我不相信这是正式记录的
...