我正在尝试捕获 Android 设备屏幕的视频,但在某些三星设备上,我的视频被粉红色的失真覆盖覆盖。
检查以下三星 DOUS 和 Pixel XL 上的输出视频截图:
三星 DUOS G532F(API 23) - Pixel XL 2 (API 27)
这是我设置媒体记录器的方法
MediaRecorder recorder = new MediaRecorder();
recorder.setVideoSource(SURFACE);
recorder.setOutputFormat(MPEG_4);
recorder.setVideoFrameRate(recordingInfo.frameRate);
recorder.setVideoEncoder(H264);
recorder.setVideoSize(recordingInfo.width, recordingInfo.height);
recorder.setVideoEncodingBitRate(3 * 1000 * 1000);
中使用的默认值recordingInfo
private static final int DEFAULT_VIDEO_WIDTH = 540;
private static final int DEFAULT_VIDEO_HEIGHT = 960;
private static final int DEFAULT_VIDEO_FRAMERATE = 30;
camcorderProfile.videoFrameWidth = DEFAULT_VIDEO_WIDTH;
camcorderProfile.videoFrameHeight = DEFAULT_VIDEO_HEIGHT;
camcorderProfile.videoFrameRate = DEFAULT_VIDEO_FRAMERATE;
和CamcorderProfile
CamcorderProfile camcorderProfile;
if (CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_TIME_LAPSE_QVGA)) {
camcorderProfile = CamcorderProfile.get(CamcorderProfile.QUALITY_TIME_LAPSE_QVGA);
} else {
camcorderProfile = CamcorderProfile.get(CamcorderProfile.QUALITY_LOW);
}
我也尝试CamcorderProfile.QUALITY_HIGH
了其他一些配置文件,结果相同