Reduce latency with Zero-Shutter Lag
Stay organized with collections
Save and categorize content based on your preferences.
Starting in CameraX 1.2, Zero-Shutter Lag is available as a capture mode.
Enable Zero-Shutter Lag to significantly reduce latency compared to the
default capture mode, so you never miss the shot.
Enable Zero-Shutter Lag
To enable Zero-Shutter Lag, pass CAPTURE_MODE_ZERO_SHOT_LAG
to
ImageCapture.Builder.setCaptureMode()
. If unsuccessful,
setCaptureMode()
falls back to CAPTURE_MODE_MINIMIZE_LATENCY
.
For more on capture modes, see the Image capture guide.
How it works
Zero-Shutter Lag uses a ring buffer that stores the three most recent capture
frames. When a user presses the capture button, CameraX invokes
takePicture()
, and the ring buffer retrieves the captured frame with the
timestamp that is closest to that of the button press. CameraX then
reprocesses the capture session to generate an image from that frame, which
saves to disk in JPEG format.
Prerequisites
Before you enable Zero-Shutter Lag, use isZslSupported()
to determine if
your device meets the following requirements:
For devices that don't meet the minimum requirements, CameraX falls back to
CAPTURE_MODE_MINIMIZE_LATENCY
.
Zero-Shutter Lag is only available for Image capture. You cannot enable it
for Video capture or with Camera extensions.
Finally, because using flash results in greater latency, Zero-Shutter Lag does
not work when flash is ON or in AUTO mode. For more information about setting
the flash mode, see setFlashMode()
.
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-03-04 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-03-04 UTC."],[],[],null,["# Reduce latency with Zero-Shutter Lag\n\n| **Note:** Zero-Shutter Lag is an experimental feature. To leave feedback on Zero-Shutter Lag, join the [Android CameraX Discussion Group](https://groups.google.com/a/android.com/g/camerax-developers).\n\nStarting in [CameraX 1.2](/jetpack/androidx/releases/camera), Zero-Shutter Lag is available as a capture mode.\nEnable Zero-Shutter Lag to significantly reduce latency compared to the\n[default capture mode](/reference/androidx/camera/core/ImageCapture#CAPTURE_MODE_MINIMIZE_LATENCY()), so you never miss the shot.\n\nEnable Zero-Shutter Lag\n-----------------------\n\nTo enable Zero-Shutter Lag, pass [`CAPTURE_MODE_ZERO_SHOT_LAG`](/reference/androidx/camera/core/ImageCapture#CAPTURE_MODE_ZERO_SHUTTER_LAG()) to\n[`ImageCapture.Builder.setCaptureMode()`](/reference/androidx/camera/core/ImageCapture.Builder#setCaptureMode(int)). If unsuccessful,\n`setCaptureMode()` falls back to `CAPTURE_MODE_MINIMIZE_LATENCY`.\n\nFor more on capture modes, see the [Image capture guide](/media/camera/camerax/take-photo#set-capture-mode).\n\nHow it works\n------------\n\nZero-Shutter Lag uses a ring buffer that stores the three most recent capture\nframes. When a user presses the capture button, CameraX invokes\n[`takePicture()`](/reference/android/hardware/Camera#takePicture(android.hardware.Camera.ShutterCallback,%20android.hardware.Camera.PictureCallback,%20android.hardware.Camera.PictureCallback,%20android.hardware.Camera.PictureCallback)), and the ring buffer retrieves the captured frame with the\ntimestamp that is closest to that of the button press. CameraX then\n[reprocesses](/reference/android/hardware/camera2/CameraDevice#reprocessing) the capture session to generate an image from that frame, which\nsaves to disk in JPEG format.\n\nPrerequisites\n-------------\n\nBefore you enable Zero-Shutter Lag, use [`isZslSupported()`](/reference/androidx/camera/core/CameraInfo#isZslSupported()) to determine if\nyour device meets the following requirements:\n\n- Targets Android 6.0+ (API level 23 and higher).\n- Supports [`PRIVATE` reprocessing](/reference/android/hardware/camera2/CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_PRIVATE_REPROCESSING).\n\nFor devices that don't meet the minimum requirements, CameraX falls back to\n`CAPTURE_MODE_MINIMIZE_LATENCY`.\n\nZero-Shutter Lag is only available for [Image capture](/training/camerax/take-photo). You cannot enable it\nfor [Video capture](/training/camerax/video-capture) or with [Camera extensions](/training/camera/camera-extensions).\n\nFinally, because using flash results in greater latency, Zero-Shutter Lag does\nnot work when flash is ON or in AUTO mode. For more information about setting\nthe flash mode, see [`setFlashMode()`](/media/camera/camerax/take-photo#set-flash-mode)."]]