Status Update
Comments
sh...@gmail.com <sh...@gmail.com> #2
UHD not being supported could be because of the title of the issue here (
le...@google.com <le...@google.com> #3
Hi,
Thanks for the question. Achieving the desired 4:3 UHD video resolution depends on several factors:
- CamcorderProfile Availability: The
needs to supportCamcorderProfile QUALITY_2160P
for 4K recording. - Camera Support: The
must include UHD resolutions (like 4000x3000, 3264x2448, 3200x2400, 3120x2340) for them to be usable.camera's private format - MediaCodec Compatibility: The device's
must be able to encode the selected UHD resolution.MediaCodec - Surface Combination: The
(like Preview, VideoCapture, ImageCapture) needs to be compatible with the device's hardware. This is the most intricate factor and can greatly differ between devices.specific mix of UseCases
The first three are easy to verify and are guaranteed for the quality from Recorder.getVideoCapabilities(cameraInfo).getSupportedQualities(DynamicRange.SDR)
, but the fourth is more challenging, it might not work due to the specific combination you're using. Currently the only way to definitively know is to attempt binding the UseCases and catch the IllegalArgumentException
.
While CameraX tries its best to optimize for various combinations, it seems yours might still be unsupported.
To better understand the issue, could you share the following details:
- Use Case Combination: List all the UseCases you're binding together.
- Settings: Provide the specific settings you're using for each UseCase, especially any resolution or quality-related settings.
- Log: Share the relevant logcat output that appears when you try binding the UseCases
sh...@gmail.com <sh...@gmail.com> #4
Hey Leo Huang,
Thanks a lot for the valuable information!
Our camera app currently supports all kinds of use-cases and combination. By default, we attempt to bind preview, imagecapture and videocapture together for video mode, however if that fails we fallback to using only Preview + VideoCapture.
The quality could be selected by the user, so technically it could be any quality requiring us to filter out the qualities that are not supported for that given aspect ratio/settings.
The logs as a sample of such a crash have been shared in the opening message of this thread.
The first three are easy to verify and are guaranteed for the quality from Recorder.getVideoCapabilities(cameraInfo).getSupportedQualities(DynamicRange.SDR), but the fourth is more challenging, it might not work due to the specific combination you're using. Currently the only way to definitively know is to attempt binding the UseCases and catch the IllegalArgumentException
Also, would using something like isUseCasesCombinationSupported
along with Recorder.getVideoCapabilities
help reliably know whether a given video quality is supported in 4:3 or not?
Thanks a lot for your valuable time and support!
Regards,
Mohit
le...@google.com <le...@google.com> #5
would using something like isUseCasesCombinationSupported along with Recorder.getVideoCapabilities help reliably know whether a given video quality is supported in 4:3 or not?
I think so. Technically, isUseCasesCombinationSupported
is designed to mirror the behavior of bindToLifecycle
, returning true for a successful binding and false if it fails. In fact, we utilize this method in our internal unit tests to ensure proper test execution.
However, it's important to note that isUseCasesCombinationSupported
is not part of the public API. Therefore, while we strive for consistency, we can't provide a 100% guarantee that its behavior will always be bug-free or perfectly aligned with bindToLifecycle
. Please use it with caution and be aware of this limitation.
sh...@gmail.com <sh...@gmail.com> #6
Hi Leo Huang,
Would it be possible to support a public API to reliably know whether 4:3 is supported for the given device at a given resolution? We currently do wish to support 4:3 in the video recording mode of our camera app but are unable to do so due to the unexpected crashes that are taking place due to the unavailability of such an API.
We have tried using the non-public isUseCasesCombinationSupported
API in the past but that doesn't seem to always help unfortunately as it returns true even for unsupported resolution/use cases on certain devices.
Please do let us know if any additional information or help is needed in any way.
Thanks a lot for your valuable time, help and support!
Regards,
Mohit
le...@google.com <le...@google.com> #7
Hi,
Thank you for reaching out. To better understand the issue, could you please provide some more information.
We currently do wish to support 4:3 in the video recording mode of our camera app but are unable to do so due to the unexpected crashes that are taking place due to the unavailability of such an API.
Could you provide the crash stack?
We have tried using the non-public isUseCasesCombinationSupported API in the past but that doesn't seem to always help unfortunately as it returns true even for unsupported resolution/use cases on certain devices.
isUseCasesCombinationSupported
is supposed to check the combination. Could you provide more detail about the failure? Does it result in a crash (what crash), a malfunction (e.g., distorted video, black screen), or something else? What is the UseCase settings and combinations and the device model and/or camera hardware level?
Thank you
sh...@gmail.com <sh...@gmail.com> #8
Hi,
Could you provide the crash stack?
Here's the stack trace (present/taken from the main message):
2024-06-21 14:21:57.146 23613-23613 System.err app.grapheneos.camera.dev W java.lang.IllegalArgumentException: androidx.camera.core.internal.CameraUseCaseAdapter$CameraException: java.lang.IllegalArgumentException: No available output size is found for androidx.camera.core.streamsharing.StreamSharingConfig@366f4e9.
2024-06-21 14:21:57.146 23613-23613 System.err app.grapheneos.camera.dev W at androidx.camera.lifecycle.LifecycleCameraRepository.bindToLifecycleCamera(LifecycleCameraRepository.java:306)
2024-06-21 14:21:57.146 23613-23613 System.err app.grapheneos.camera.dev W at androidx.camera.lifecycle.ProcessCameraProvider.bindToLifecycle$camera_lifecycle_release(ProcessCameraProvider.kt:522)
2024-06-21 14:21:57.147 23613-23613 System.err app.grapheneos.camera.dev W at androidx.camera.lifecycle.ProcessCameraProvider.bindToLifecycle(ProcessCameraProvider.kt:242)
2024-06-21 14:21:57.147 23613-23613 System.err app.grapheneos.camera.dev W at app.grapheneos.camera.CamConfig.startCamera(CamConfig.kt:1185)
2024-06-21 14:21:57.147 23613-23613 System.err app.grapheneos.camera.dev W at app.grapheneos.camera.ui.SettingsDialog.updateVideoQuality(SettingsDialog.kt:432)
2024-06-21 14:21:57.147 23613-23613 System.err app.grapheneos.camera.dev W at app.grapheneos.camera.ui.SettingsDialog.updateVideoQuality$default(SettingsDialog.kt:423)
2024-06-21 14:21:57.147 23613-23613 System.err app.grapheneos.camera.dev W at app.grapheneos.camera.ui.SettingsDialog$videoQualityItemSelectedListener$1.onItemSelected(SettingsDialog.kt:102)
2024-06-21 14:21:57.147 23613-23613 System.err app.grapheneos.camera.dev W at android.widget.AdapterView.fireOnSelected(AdapterView.java:957)
2024-06-21 14:21:57.147 23613-23613 System.err app.grapheneos.camera.dev W at android.widget.AdapterView.dispatchOnItemSelected(AdapterView.java:946)
2024-06-21 14:21:57.147 23613-23613 System.err app.grapheneos.camera.dev W at android.widget.AdapterView.-$$Nest$mdispatchOnItemSelected(Unknown Source:0)
2024-06-21 14:21:57.147 23613-23613 System.err app.grapheneos.camera.dev W at android.widget.AdapterView$SelectionNotifier.run(AdapterView.java:910)
2024-06-21 14:21:57.147 23613-23613 System.err app.grapheneos.camera.dev W at android.os.Handler.handleCallback(Handler.java:959)
2024-06-21 14:21:57.147 23613-23613 System.err app.grapheneos.camera.dev W at android.os.Handler.dispatchMessage(Handler.java:100)
2024-06-21 14:21:57.147 23613-23613 System.err app.grapheneos.camera.dev W at android.os.Looper.loopOnce(Looper.java:232)
2024-06-21 14:21:57.147 23613-23613 System.err app.grapheneos.camera.dev W at android.os.Looper.loop(Looper.java:317)
2024-06-21 14:21:57.147 23613-23613 System.err app.grapheneos.camera.dev W at android.app.ActivityThread.main(ActivityThread.java:8592)
2024-06-21 14:21:57.147 23613-23613 System.err app.grapheneos.camera.dev W at java.lang.reflect.Method.invoke(Native Method)
2024-06-21 14:21:57.147 23613-23613 System.err app.grapheneos.camera.dev W at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
2024-06-21 14:21:57.147 23613-23613 System.err app.grapheneos.camera.dev W at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)
2024-06-21 14:21:57.147 23613-23613 System.err app.grapheneos.camera.dev W Caused by: androidx.camera.core.internal.CameraUseCaseAdapter$CameraException: java.lang.IllegalArgumentException: No available output size is found for androidx.camera.core.streamsharing.StreamSharingConfig@366f4e9.
2024-06-21 14:21:57.147 23613-23613 System.err app.grapheneos.camera.dev W at androidx.camera.core.internal.CameraUseCaseAdapter.addUseCases(CameraUseCaseAdapter.java:281)
2024-06-21 14:21:57.147 23613-23613 System.err app.grapheneos.camera.dev W at androidx.camera.lifecycle.LifecycleCamera.bind(LifecycleCamera.java:203)
2024-06-21 14:21:57.147 23613-23613 System.err app.grapheneos.camera.dev W at androidx.camera.lifecycle.LifecycleCameraRepository.bindToLifecycleCamera(LifecycleCameraRepository.java:304)
2024-06-21 14:21:57.147 23613-23613 System.err app.grapheneos.camera.dev W ... 18 more
2024-06-21 14:21:57.148 23613-23613 System.err app.grapheneos.camera.dev W Caused by: java.lang.IllegalArgumentException: No available output size is found for androidx.camera.core.streamsharing.StreamSharingConfig@366f4e9.
2024-06-21 14:21:57.148 23613-23613 System.err app.grapheneos.camera.dev W at androidx.core.util.Preconditions.checkArgument(Preconditions.java:51)
2024-06-21 14:21:57.148 23613-23613 System.err app.grapheneos.camera.dev W at androidx.camera.camera2.internal.SupportedSurfaceCombination.isUseCasesCombinationSupported(SupportedSurfaceCombination.java:917)
2024-06-21 14:21:57.148 23613-23613 System.err app.grapheneos.camera.dev W at androidx.camera.camera2.internal.SupportedSurfaceCombination.getSuggestedStreamSpecifications(SupportedSurfaceCombination.java:595)
2024-06-21 14:21:57.148 23613-23613 System.err app.grapheneos.camera.dev W at androidx.camera.camera2.internal.Camera2DeviceSurfaceManager.getSuggestedStreamSpecs(Camera2DeviceSurfaceManager.java:187)
2024-06-21 14:21:57.148 23613-23613 System.err app.grapheneos.camera.dev W at androidx.camera.core.internal.CameraUseCaseAdapter.calculateSuggestedStreamSpecs(CameraUseCaseAdapter.java:752)
2024-06-21 14:21:57.148 23613-23613 System.err app.grapheneos.camera.dev W at androidx.camera.core.internal.CameraUseCaseAdapter.updateUseCases(CameraUseCaseAdapter.java:350)
2024-06-21 14:21:57.148 23613-23613 System.err app.grapheneos.camera.dev W at androidx.camera.core.internal.CameraUseCaseAdapter.updateUseCases(CameraUseCaseAdapter.java:367)
2024-06-21 14:21:57.148 23613-23613 System.err app.grapheneos.camera.dev W at androidx.camera.core.internal.CameraUseCaseAdapter.updateUseCases(CameraUseCaseAdapter.java:301)
2024-06-21 14:21:57.148 23613-23613 System.err app.grapheneos.camera.dev W at androidx.camera.core.internal.CameraUseCaseAdapter.addUseCases(CameraUseCaseAdapter.java:279)
2024-06-21 14:21:57.148 23613-23613 System.err app.grapheneos.camera.dev W ... 20 more
Could you provide more detail about the failure? Does it result in a crash (what crash), a malfunction (e.g., distorted video, black screen), or something else?
It fails by crashing the app with the above exception, for example while trying to bind 4:3 aspect ratio and UHD quality together in video capture use case on my Pixel 7A
What is the UseCase settings and combinations and the device model and/or camera hardware level?
The use cases that were binded were preview view, image capture and video capture.
Please do let me know if any additional information is needed.
Thanks a lot for your help and support!
Regards,
Mohit
le...@google.com <le...@google.com> #9
I can't find any usage in the latest GrapheneOS source code.
Could you show some code on how to use isUseCasesCombinationSupported
?
I wonder if there are any unexpected uses for this.
Description
```
2024-06-21 14:21:57.146 23613-23613 System.err
2024-06-21 14:21:57.146 23613-23613 System.err
2024-06-21 14:21:57.146 23613-23613 System.err
2024-06-21 14:21:57.147 23613-23613 System.err
2024-06-21 14:21:57.147 23613-23613 System.err
2024-06-21 14:21:57.147 23613-23613 System.err
2024-06-21 14:21:57.147 23613-23613 System.err
2024-06-21 14:21:57.147 23613-23613 System.err
2024-06-21 14:21:57.147 23613-23613 System.err
2024-06-21 14:21:57.147 23613-23613 System.err
2024-06-21 14:21:57.147 23613-23613 System.err
2024-06-21 14:21:57.147 23613-23613 System.err
2024-06-21 14:21:57.147 23613-23613 System.err
2024-06-21 14:21:57.147 23613-23613 System.err
2024-06-21 14:21:57.147 23613-23613 System.err
2024-06-21 14:21:57.147 23613-23613 System.err
2024-06-21 14:21:57.147 23613-23613 System.err
2024-06-21 14:21:57.147 23613-23613 System.err
2024-06-21 14:21:57.147 23613-23613 System.err
2024-06-21 14:21:57.147 23613-23613 System.err
2024-06-21 14:21:57.147 23613-23613 System.err
2024-06-21 14:21:57.147 23613-23613 System.err
2024-06-21 14:21:57.147 23613-23613 System.err
2024-06-21 14:21:57.147 23613-23613 System.err
2024-06-21 14:21:57.147 23613-23613 System.err
2024-06-21 14:21:57.148 23613-23613 System.err
2024-06-21 14:21:57.148 23613-23613 System.err
2024-06-21 14:21:57.148 23613-23613 System.err
2024-06-21 14:21:57.148 23613-23613 System.err
2024-06-21 14:21:57.148 23613-23613 System.err
2024-06-21 14:21:57.148 23613-23613 System.err
2024-06-21 14:21:57.148 23613-23613 System.err
2024-06-21 14:21:57.148 23613-23613 System.err
2024-06-21 14:21:57.148 23613-23613 System.err
2024-06-21 14:21:57.148 23613-23613 System.err
2024-06-21 14:21:57.148 23613-23613 System.err
```
Here's the code we're currently using to get the available qualities:
```
fun getAvailableQualities(): List<Quality> {
val cameraInfo = camera?.cameraInfo ?: return Collections.emptyList()
return Recorder.getVideoCapabilities(cameraInfo).getSupportedQualities(DynamicRange.SDR)
}
```
We're currently using Quality.HIGHEST by default and switching to the highest quality once we get the list of supported qualities, we shift to the highest one (for the default option).
Now, since the highest quality returned by the above method (i.e. UHD) fails to bind for 4:3 video mode it causes the app to crash.
Could you'll please help us out with this issue? Also, if there's any reliable method to know the supported video qualities before binding or know which quality the library has actually resolved to while using something like Quality.HIGHEST it could be of great help in resolving this issue.
Thanks a lot for your valuable time and support!