Starting March 27, 2025, we recommend using android-latest-release
instead of aosp-main
to build and contribute to AOSP. For more information, see Changes to AOSP.
Camera preview stabilization
Stay organized with collections
Save and categorize content based on your preferences.
For devices running Android 13 or higher, the camera
framework provides support for video stabilization on the preview stream
and other non-RAW streams in camera capture sessions. This feature lets
third-party apps provide a what you see is what you get (WYSIWYG) experience
when comparing between the camera preview and the recording.
Implementation
To provide third-party apps with this feature, device
manufacturers must advertise support for the following keys and implement
preview stabilization algorithms in the camera HAL:
To modify the default settings for this feature, assign a default value in the
capture request template when creating a capture request using
createCaptureRequest
.
For a reference implementation of this feature, see the code for
EmulatedCamera
in Cuttlefish at
hardware/google/camera/devices/EmulatedCamera/hwl/EmulatedSensor.cpp
.
For more details on video stabilization modes, see
CONTROL_VIDEO_STABILIZATION_MODE
.
Validation
To test your implementation of this feature, use the following CTS and ITS
tests:
CTS:
ITS (tests field of view and stabilization quality):
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-06-26 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-06-26 UTC."],[],[],null,["# Camera preview stabilization\n\nFor devices running Android 13 or higher, the camera\nframework provides support for video stabilization on the preview stream\nand other non-RAW streams in camera capture sessions. This feature lets\nthird-party apps provide a *what you see is what you get* (WYSIWYG) experience\nwhen comparing between the camera preview and the recording.\n\nImplementation\n--------------\n\nTo provide third-party apps with this feature, device\nmanufacturers must advertise support for the following keys and implement\npreview stabilization algorithms in the camera HAL:\n\n- [`CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES`](https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES)\n- [`CONTROL_VIDEO_STABILIZATION_MODE_PREVIEW_STABILIZATION`](https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#CONTROL_VIDEO_STABILIZATION_MODE_PREVIEW_STABILIZATION)\n\nTo modify the default settings for this feature, assign a default value in the\ncapture request template when creating a capture request using\n[`createCaptureRequest`](https://developer.android.com/reference/android/hardware/camera2/CameraDevice#createCaptureRequest(int,%20java.util.Set%3Cjava.lang.String%3E)).\n\nFor a reference implementation of this feature, see the code for\n`EmulatedCamera` in [Cuttlefish](/docs/devices/cuttlefish) at\n[`hardware/google/camera/devices/EmulatedCamera/hwl/EmulatedSensor.cpp`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/google/camera/devices/EmulatedCamera/hwl/EmulatedSensor.cpp#823).\n\nFor more details on video stabilization modes, see\n[`CONTROL_VIDEO_STABILIZATION_MODE`](https://developer.android.com/reference/android/hardware/camera2/CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE).\n\nValidation\n----------\n\nTo test your implementation of this feature, use the following CTS and ITS\ntests:\n\nCTS:\n\n- [`RobustnessTest.java#testMandatoryPreviewStabilizationOutputCombinations`](https://cs.android.com/android/platform/superproject/+/android-latest-release:cts/tests/camera/src/android/hardware/camera2/cts/RobustnessTest.java)\n\nITS (tests field of view and stabilization quality):\n\n- [`scene4/test_preview_Stabilization_fov.py`](/docs/compatibility/cts/camera-its-tests#test_preview_stabilization_fov)\n- [`sensor_fusion/test_preview_stabilization.py`](/docs/compatibility/cts/camera-its-tests#test_preview_stabilization)"]]