Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Switching camera selector while recording video camerax

85 views
Skip to first unread message
Assigned to tonyt...@google.com by scot...@google.com

Mohammad Nawas

unread,
Nov 16, 2024, 4:50:39 AM11/16/24
to Android CameraX Discussion Group
Hello everyone, i am building a tiktok like camera app to record videos, And one of the functionalists i need to implement is switching the Camera lense (Front or back) during recording. 
I tried to unbind and bind the new camera selector and uses cases but this caused audio and video being unaligned issue. So i went with another approach which's end the recording and start new one when the user flips the camera but it will require me to merge the videos segments at the end which takes time i tried to use FFmpeg to merge the videos without re-encoding them but i found out that videos taken by front camera are rotated.

Any suggestions on how to optmize this solution or another approach to achieve this with camerax?

tonyt...@google.com

unread,
Nov 20, 2024, 2:55:25 AM11/20/24
to Android CameraX Discussion Group, landof...@gmail.com
Hi, I guess you were using asPersistentRecording and got the A/V synchronization issue, right? Could you describe more on the issue?
Persistent recording is the recommended approach for your use case. We can see what causes it out of sync and resolve the issue if there's any.

Mohammad Nawas

unread,
Nov 20, 2024, 5:20:21 AM11/20/24
to Android CameraX Discussion Group, tonyt...@google.com, ‪Mohammad Nawas‬‏‎
Yes i am using asPresistentRecording i get A/V synchronization issue.
steps to produce this issue:
Start video capturing --> pause the video --> change the camera selector and re-bind the usecases --> resume recording.

tonyt...@google.com

unread,
Nov 21, 2024, 1:23:39 AM11/21/24
to Android CameraX Discussion Group, landof...@gmail.com, tonyt...@google.com
Could you try not to pause the recording before switching and see if it resolves the issue?

Mohammad Nawas

unread,
Nov 22, 2024, 7:07:53 PM11/22/24
to Android CameraX Discussion Group, tonyt...@google.com, ‪Mohammad Nawas‬‏‎
I already tried that and it worked on some devices but faced slow motion issue on other devices after flipping the camera. The functionality i want includes pausing so i am wondering if that's possible
Reply all
Reply to author
Forward
0 new messages