Reputation: 31
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).
Upvotes: 3
Views: 3684
Reputation: 5371
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)
Upvotes: 1
Reputation: 7114
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()
Upvotes: 0
Reputation: 15
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)
Upvotes: 0