CamcorderProfile.QUALITY_HIGH 分辨率产生绿色闪烁视频 [英] CamcorderProfile.QUALITY_HIGH resolution produces green flickering video
问题描述
到目前为止,我还没有找到任何解释.基本上我有一个视频录制类,当我的三星 Galaxy S2 上的 setVideoSize() 设置为 720 x 480 时,它的效果非常好.
I haven't found any explanation for this so far. Basically I have a video recording class which works splendidly when setVideoSize() is set to 720 x 480 on my Samsung Galaxy S2.
我希望它以尽可能高的分辨率录制,因此使用 CamcorderProfile.QUALITY_HIGH 我可以获得各种最高质量的录制属性并将它们设置在我的班级中.这适用于文件格式、视频帧速率、编码器和比特率,但是当我尝试将视频大小设置为 CamcorderProfile (1920 x 1080) 返回的宽度和高度时,录制的视频只是绿色闪烁.
I want it to record in the highest possible resolution so using CamcorderProfile.QUALITY_HIGH I can get the various highest quality recording properties and set them within my class. This works for file format, video frame rate, encoders and bit rate, however when I attempt to set the video size to the width and height returned by the CamcorderProfile (1920 x 1080), the video recorded is just a green flicker.
我注意到如果我将 720 x 480 更改为 720 x 481,它会做同样的事情.因此,我只能假设手机不支持该分辨率时会发生这种情况.但是,手机附带的摄像机可以录制 1920 x 1080 的分辨率,并且录制效果非常好.
I noticed if I changed 720 x 480 to 720 x 481 it did the same thing. Therefore I can only assume this happens when the resolution isn't supported by the phone. However, the camcorder the phone came with can record in 1920 x 1080 and it produces an excellent recording.
我只能假设我需要以不同的方式设置一些其他参数,但我无法弄清楚它们可能是什么.
I can only assume with such a high resolution I need to set some other parameters differently, but I just cant figure out what they might be.
有其他人遇到过这个问题吗?
Has anyone else had this problem?
提前感谢您的任何回复.
Thanks in advance for any replies.
推荐答案
我遇到了这个问题,试图解决同样的问题.
I came across this question trying to solve the same problem.
xda开发者给出了一个解决方案http://forum.xda-developers.com/showthread.php?t=1104970&page=8.看来您需要设置一个不起眼的参数cam_mode"才能进行高清录制:
A solution is given over on xda developer http://forum.xda-developers.com/showthread.php?t=1104970&page=8. It seems that you need to set an obscure parameter "cam_mode" for high definition recording to work:
camera = Camera.open();
Camera.Parameters param = camera.getParameters();
param.set( "cam_mode", 1 );
camera.setParameters( param );
在 mediarecorder 中,您可以使用
In mediarecorder, you can then use
mediarecorder.setVideoSize(1920, 1080);
虽然这现在也可以使用:
although this will now also work:
mediarecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH));
(后者的视频比特率似乎为 20Mb/s,因此您可能希望将其降低一点!)我发现我不必将预览大小设置为 1920x1080.
(The latter seems to have a video bitrate of 20Mb/s, so you might want to take that down a bit!) I found that I didn't have to set the preview size to 1920x1080.
(编辑)你还需要设置
parame.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);
或
param.setFocusMode(Camera.Parameters.FOCUS_MODE_INFINITY);
否则您会在相机启动前延迟几秒钟!
otherwise you get a delay of a few seconds before the camera starts!
至于三星为何以这种方式实现相机,我不知道.这肯定对开发者不友好!
As to why Samsung has implemented the Camera in this way, I have no idea. It's certainly not developer friendly!
这篇关于CamcorderProfile.QUALITY_HIGH 分辨率产生绿色闪烁视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!