GrapheneOS / Camera

Modern camera app focused on privacy and security with QR & barcode scanning.
https://grapheneos.org/
MIT License
875 stars 89 forks source link

Add setting option for video frame rate #51

Open emersion opened 3 years ago

emersion commented 3 years ago

Some cameras (e.g. Pixel 3a) support video capture up to 240Hz (with a lower resolution). This is useful in some niche use-cases, e.g. measuring the duration of a quick event (physics, electronics, etc).

thestinger commented 3 years ago

I think this depends on CameraX adding support for it in order to support 60Hz, etc. Ultra high frame rate modes may require a CameraX extension instead of simply changing the rate. Not sure about whether it works the same way.

MHShetty commented 3 years ago

A feature request was made for this.

It's status can be tracked from here: https://issuetracker.google.com/issues/205334816

Also, here's a similar request that was previously made: https://issuetracker.google.com/issues/203737756

Donkey-Doug commented 2 years ago

What about resolution? My phone (Xiaomi Mi 9T Pro) only films in 1080p @ 30fps.

MHShetty commented 2 years ago

What about resolution? My phone (Xiaomi Mi 9T Pro) only films in 1080p @ 30fps.

We might need to wait until the CameraX team includes this in their public schedule or any of their future release to be able to actually alter these configurations from our end. However, we must bare in mind that CameraX is library that's an abstraction to Camera2 and other related APIs that prima, so it can't really alter the hardware limitations of any device as such (or at least has it's own limits of doing so).

Specifically speaking of Xiaomi Mi 9T Pro, it seems to only support 1080p (Full HD) at 30 FPS at best, so I don't really think our camera app would be able to reliably capture videos at a higher FPS than that (for example, at 60 FPS) unless the CameraX team somehow comes up with a workaround (which is however highly unlikely considering the ton of workload and feature requests they already have).

We'll add an update to this thread as soon as CameraX includes an option to alter the frame rate/resolution and we include it in our camera app.

Thanks a lot for trying out our camera app @Donkey-Doug!

girlbossceo commented 1 year ago

CameraX now supports this as of 1.3.0-alpha06

Add setTargetFrameRate() API in the VideoCapture.Builder and getTargetFramerate() API in VideoCapture

octocorvus commented 1 year ago

A public API to query supported frame rate ranges for device was also added in this update. From https://developer.android.com/reference/androidx/camera/core/CameraInfo#getSupportedFrameRateRanges()

There is no guarantee that these ranges can be used for every size surface or combination of use cases. If attempting to run the device using an unsupported range, there may be stability issues or the device may quietly choose another frame rate operating range.

For now, maybe we can add an option to prefer either 60fps or 30fps, and make it clear that this setting might not work for all resolution settings.