Audio capture in new video capture library

264 views
Skip to first unread message

Mohit Shetty

unread,
Oct 14, 2021, 11:27:16 AM10/14/21
to Android CameraX Discussion Group
I just migrated to using the new official video capture library and found some serious issue with it. The audio doesn't get captured in the video. Not sure if it is a device specific issue (testing on Pixel 4A) or have misconfigured CameraX in any way. But in either cases could you'll please help me out with this?

The class that mainly deals with recording:
Message has been deleted

Trevor McGuire

unread,
Oct 14, 2021, 12:17:22 PM10/14/21
to Android CameraX Discussion Group, shetty...@gmail.com
Audio recording must be explicitly enabled on the PendingRecording object before it is started with PendingRecording.withAudioEnabled(). This will also enforce that your application has the RECORD_AUDIO permission, so it is good to check that permission is granted before enabling audio on the recording.

Mohit Shetty

unread,
Oct 14, 2021, 12:50:21 PM10/14/21
to Android CameraX Discussion Group, trevor...@google.com, Mohit Shetty
Oh, missed calling withAudioEnabled().

Thanks a lot for the quick response and help!

Gerry Fan

unread,
Oct 14, 2021, 12:55:58 PM10/14/21
to Mohit Shetty, Android CameraX Discussion Group, trevor...@google.com
Hey Mohit, 

could you do me a favor:  glance through this section https://developer.android.com/training/camerax/video-capture#videocapture-api-overview, (just that graph and the 6 steps), see whether that makes sense (like to see if that one is helpful)

thank you!

--
You received this message because you are subscribed to the Google Groups "Android CameraX Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to camerax-develop...@android.com.
To view this discussion on the web visit https://groups.google.com/a/android.com/d/msgid/camerax-developers/15d24f64-475a-4c79-8352-4b2bdf29f7dfn%40android.com.
Message has been deleted

Mohit Shetty

unread,
Oct 14, 2021, 2:07:19 PM10/14/21
to Android CameraX Discussion Group, Gerry Fan, Android CameraX Discussion Group, trevor...@google.com, Mohit Shetty
Hey,

Yes it does make sense for most of the part (just feels a bit incomplete [the flow/description])
  1. Build a Recorder object and use setQualitySelector(QualitySelector), for apps to select a video resolution. (and maybe mention about Recorder.DEFAULT_QUALITY_SELECTOR)
  2. (An extra point that could be added) Use the built Recorder object while building VideoCapture (which would be added as a use case while binding)
  3. Recorder::prepareRecording(OutputOptions), for apps to set file destinations (returns the PendingRecording)
  4. PendingRecording::withAudioEnabled()/withEventListener() for apps to enable audio and the event listener.
  5. PendingRecording::start() to begin recording and obtain instance of ActiveRecording.
  6. ActiveRecording::pause()/resume()/stop() to control the recording.
  7. (6th point there) (I don't think that would make sense at the end...maybe it could be merged with the withEventListener() point)
Also, just a minor error that you might have noticed is the spelling of <VideoOutput> in the diagram.

Hope I was able to be of some help to you'll (a really small contribution) 😅

Thanks a lot for the great library!
Loved working with the simplistic design the library has and the fact that the library takes care of supporting multiple devices under the hood which really helps in saving resources or perhaps making better use of them.

Please do let me know if I could help you'll in any other way.

Regards,
Mohit

Gerry Fan

unread,
Oct 14, 2021, 4:00:32 PM10/14/21
to Mohit Shetty, Android CameraX Discussion Group, trevor...@google.com
it is great: will get those looked and  merged into the doc.  Thank you again: it is very helpful!

On Thu, Oct 14, 2021 at 11:06 AM Mohit Shetty <shetty...@gmail.com> wrote:
Hey,

Yes it does make sense for most of the part (just feels a bit incomplete [the flow/description])
  1. Build a Recorder object and use setQualitySelector(QualitySelector), for apps to select a video resolution. (and maybe mention about Recorder.DEFAULT_QUALITY_SELECTOR)
  2. (An extra point that could be added) Use the built Recorder object while building VideoCapture (which would be added as a use case while binding)
  3. Recorder::prepareRecording(OutputOptions), for apps to set file destinations (returns the PendingRecording)
  4. PendingRecording::withAudioEnabled()/withEventListener() for apps to enable audio and the event listener.
  5. PendingRecording::start() to begin recording and obtain instance of ActiveRecording.
  6. ActiveRecording::pause()/resume()/stop() to control the recording.
  7. (6th point there) (I don't think that would make sense at the end...maybe it could be merged with the withEventListener() point)
Also, just a minor error that you might have noticed is the spelling of <VideoOutput> in the diagram.

Hope I was able to be of some help to you'll (a really small contribution) 😅

Thanks a lot for the great library!
Loved working with the simplistic design the library has and the fact that the library takes care of supporting multiple devices under the hood which really helps in saving resources or perhaps making better use of them.

Please do let me know if you'll need any other help.

Regards,
Mohit

On Thursday, 14 October 2021 at 22:25:58 UTC+5:30 Gerry Fan wrote:

Gerry Fan

unread,
Oct 18, 2021, 3:41:25 PM10/18/21
to Android CameraX Discussion Group, Gerry Fan, Android CameraX Discussion Group, Trevor McGuire, shetty...@gmail.com
update and put a close to the thread:  the description has been updated:  https://developer.android.com/training/camerax/video-capture#videocapture-api-overview ( the diagram and the current.txt linked there would be a good start, if it is not 100% sufficient, coding with video capture API). Thank you for the feedback and it is very helpful! 
Reply all
Reply to author
Forward
0 new messages