我使用CameraX库中的CameraView录制视频。但是我找不到视频录制过程的任何设置。先前我使用的是旧库版本1.0.0-alpha08
,默认分辨率(1920х1080)适合我,但是该版本存在一些问题。现在,我正在使用1.0.0-beta02
,但分辨率却很奇怪(1600 x 1200-Pixel 3a 1400x1200-Huawei p20 lite)。
答案 0 :(得分:0)
val imageCaptureConfig = ImageCaptureConfig.Builder()
.setLensFacing(CameraX.LensFacing.BACK)
.setCaptureMode(ImageCapture.CaptureMode.MAX_QUALITY)
.setTargetResolution(Size(width, height))
.setTargetAspectRatio(Rational(3,4))
.build()
用调暗器代替宽度和高度。 'Rational(3,4)'中的3,4与您的比率(也可以将其删除)
答案 1 :(得分:0)
在版本1.0.0-beta06中,您可以在视频用例所用的setTargetResolution(resolution: Size)
中使用 setMaxResolution(resolution: Size)
或VideoCaptureConfig.Builder()
。
videoCapture = VideoCaptureConfig.Builder()
.setTargetResolution(VIDEO_SIZE)
.setMaxResolution(VIDEO_SIZE)
.build()