Mirroring causes a change in resolution. sdk version 1.3.4

42 views
Skip to first unread message

疾風劍豪

unread,
Aug 20, 2024, 4:32:57 AMAug 20
to Android CameraX Discussion Group
Original output video resolution:1280 * 720
When I set setMirrorMode (MIRROR.MODEON_FRONT-ONLY),
output video resolution changed to: 720 * 1280

I need two videos, one from the front camera(DEFAULT_FRONT_CAMERA) and one from the back camera (DEFAULT_BACK_CAMERA).

I hope the resolution of the two videos is consistent.

when i use setTargetResolution, log:

 java.lang.UnsupportedOperationException: setTargetResolution is not supported.
at androidx.camera.video.VideoCapture$Builder.setTargetResolution(VideoCapture.java:1603)

Please!

Leo Huang

unread,
Aug 20, 2024, 5:24:54 AMAug 20
to Android CameraX Discussion Group, jinli...@gmail.com
Hi

This is an intended behavior when mirror mode is enabled. The result video is still up-right.

Here are two possible workaround
  1. Enable surface processing with VideoCapture.Builder.setSurfaceProcessingForceEnabled(). This will rotate the video from the back camera as well, but it's an internal CameraX API that is not guaranteed to maintain.

  2. Use the Media3 Transformer API to rotate the saved video. Check out the demo application for guidance: https://developer.android.com/media/media3/transformer/demo-application


jinli...@gmail.com 在 2024年8月20日 星期二下午4:32:57 [UTC+8] 的信中寫道:

疾風劍豪

unread,
Aug 20, 2024, 10:07:16 PMAug 20
to Android CameraX Discussion Group, leoh...@google.com, 疾風劍豪
Thank you very much!
setSurfaceProcessingForceEnabled()  meets my requirements.
❀❀
Reply all
Reply to author
Forward
0 new messages