pedroSG94 / RootEncoder

RootEncoder for Android (rtmp-rtsp-stream-client-java) is a stream encoder to push video/audio to media servers using protocols RTMP, RTSP, SRT and UDP with all code written in Java/Kotlin
Apache License 2.0
2.57k stars 778 forks source link

Enable/disable Auto exposure #1641

Open legosaro opened 1 week ago

legosaro commented 1 week ago

Is your feature request related to a problem? Please describe. I need a method to ensure that the camera automatically adjusts its exposure settings for optimal image brightness in varying lighting conditions.

Describe the solution you'd like Add the method enableAutoExposure in the Camera2ApiManager class with the following code:

builderInputSurface.set( CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_ON );

pedroSG94 commented 1 week ago

Added here: https://github.com/pedroSG94/RootEncoder/commit/9222c21b5f8b71f2033136a2487ccb88bd62ea86

legosaro commented 1 week ago

Hi Pedro, thank you for the update!
"I have a question for you, is this check correct: val modes = characteristics.secureGet(CameraCharacteristics.CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES) ?: return false

I found this: val modes = characteristics.secureGet(CameraCharacteristics.CONTROL_AE_AVAILABLE_MODES)

Another question, I tried using the two methods (enable/disable) but I didn't see any difference, why is that?

Thanks in advance

pedroSG94 commented 5 days ago

I fixed the check error. About the question if I can see any different. No, I'm not sure the reason but the code should be correct now