The ODG Camera App captures video at 30 FPS by default. We have been asked if it is possible for an App using the Android Camera APIs to capture video at a higher rate than 30 FPS. The answer for KitKat is yes. (Note that Marshmallow is being evaluated right now, and this article will be updated once that is complete; more on this below). First, note that the camera module sensor we use is spec'ed to achieve fairly high frame rates, as documented in this article: R-7-Camera-Characteristics But, these are sensor maximums, and at the system level there are a range of driver, OS and Application level performance factors that will impact the overall max capture frame rate that can be achieved.
The maximum capture FPS [Frames per second] rates that can be achieved are dependent on the video capture resolution set and other conditions. For example, it is affected by the Auto Focus mode of the sensor; under low light conditions, the sensor tries to gain more focus, and this negatively effects the resulting captured frame rate. Also, lighting conditions effect exposure times, and this also have an effect; in dark conditions, the exposure time is extended, and this will also adversely impact the capture frame rate.
HSR Mode
If lighting is fairly bright, then capturing above 30 FPS can be accomplished by Selecting the HSR [High-Speed Rate] feature. We've decided to use an open source camera App to demonstrate this, and provide a link to the source of the App as a reference. The APK is attached to this article. We called the App Camera2.apk. It can be loaded at the same time as the standard ODG Camera App (they have different package names; Camera2 is com.android.camera2). It's Launcher Icon looks like this:
The tested HSR modes are 60 and 90 FPS when using H.264; this table shows which work at which resolutions we tried:
Resolution | HSR 60 | HSR90 |
1080p | Yes | No |
720p | yes | Yes |
480p | yes | yes |
When capturing using HSR mode, the resulting video mp4 file's media info will show the resulting frame rate and duration. Duration should match the actual length of time of the video - for example, if you capture video for 10 seconds, the duration should be 10 seconds. (In HFR mode, the duration is extended. This is discussed below). The frame rate of the video should approach either 60 or 90 FPS if capturing in 720p resolution, depending on lighting conditions.
HFR Mode
The sample Camera2 App source contains the code needed to implement this feature, and is fairly complex. It is provided as a reference for those who want to incorporate this feature within their App when running on KitKat. It is using the Camera1 APIs on KitKat, and uses features that were included within the Android Framework in the KitKat (4.4.4) release, including support for HSR and HFR modes.
The source to the App can be found on the CodeAurora Site, referenced by this manifest: LNX.LA.3.6-11510-8084.0.xml, just for the record. We've put the App source, for your convenience: Camera2 Source Zip
Marshmallow Support
What complicates the ability to capture higher speed video for Marshmallow is the deprecation of these Camera(1) APIs in favor of Camera2 APIs, and the elimination of HSR/HFR support in the Android Framework. We are investigating the impact of these changes in the Framework level support in Marshmallow that may effect what's possible, and will update this article when we know. Most likely, we will use the App OpenCamera as the sample for Marshmallow, and tune the platform as needed. We know that in the current ReticleOS release 4.1.14 that the max frame rate that can be captured is ~ 45 FPS, which we hope to improve.
Steps to use Camera2
Install and run the App. It will default to camera photo/still mode (showing a blue dot for picture capture button):
Click on the camera Icon and select the video camera Icon immediately to the left of the camera Icon:
This will cause the video capture button to turn red and put the App into video capture mode:
Click on the circle button immediately above the red dot, and this will cause a menu of two option buttons to come up that look like this :
Click on the right one to access the menu below, and select Video High Frame Rate:
which will then give you the follow menu of options:
and pick a mode, HSR 90 for example. Then, go back to the 2 button option menu, pick the left one, to see this menu:
and select Video Quality to get a list of resolutions :
and pick either 720p or 1080p. Once you've selected the Video High Frame Rate mode and resolution, you should be able to capture video.
Comments