I use CameraView from CameraX library, for recording video. But I can't find any settings of video recording process. Earlier I use old library version 1.0.0-alpha08
and default resolution(1920 х 1080) suited me, but that version had some issues. For now I'm using 1.0.0-beta02
, I get very strange resolution (1600 x 1200 - Pixel 3a 1400x1200 - Huawei p20 lite).
val imageCaptureConfig = ImageCaptureConfig.Builder()
.setLensFacing(CameraX.LensFacing.BACK)
.setCaptureMode(ImageCapture.CaptureMode.MAX_QUALITY)
.setTargetResolution(Size(width, height))
.setTargetAspectRatio(Rational(3,4))
.build()
replace width and height with your dimens. 3,4 in 'Rational(3,4)' with your ratio (you can also remove it)
In version 1.0.0-beta06 you can use setTargetResolution(resolution: Size)
or setMaxResolution(resolution: Size)
in VideoCaptureConfig.Builder()
used for video UseCase.
videoCapture = VideoCaptureConfig.Builder()
.setTargetResolution(VIDEO_SIZE)
.setMaxResolution(VIDEO_SIZE)
.build()
You can configure recorder's quality using QualitySelector
val preferredQuality = Quality.HD
val recorder = Recorder.Builder()
.setQualitySelector(
QualitySelector.from(
preferredQuality,
FallbackStrategy.higherQualityOrLowerThan(preferredQuality)
)
)
.build()
val videoCapture = VideoCapture.withOutput(recorder)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.