제로 셔터 랙으로 지연 시간 줄이기
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
CameraX 1.2부터 제로 셔터 랙을 캡처 모드로 사용할 수 있습니다.
제로 셔터 랙을 사용 설정하면 기본 캡처 모드에 비해 지연 시간이 크게 줄어 장면을 놓치지 않을 수 있습니다.
제로 셔터 랙 사용 설정
제로 셔터 랙을 사용 설정하려면 ImageCapture.Builder.setCaptureMode()
에 CAPTURE_MODE_ZERO_SHOT_LAG
를 전달합니다. 실패하면 setCaptureMode()
가 CAPTURE_MODE_MINIMIZE_LATENCY
로 대체됩니다.
캡처 모드에 관한 자세한 내용은 이미지 캡처 가이드를 참고하세요.
작동 방식
제로 셔터 랙은 가장 최근의 캡처 프레임 3개를 저장하는 링 버퍼를 사용합니다. 사용자가 캡처 버튼을 누르면 CameraX는 takePicture()
를 호출하고 링 버퍼는 버튼 누르기의 타임스탬프에 가장 가까운 타임스탬프로 캡처된 프레임을 가져옵니다. 그러면 CameraX는 캡처 세션을 다시 처리하여 해당 프레임에서 이미지를 생성하고 이는 JPEG 형식으로 디스크에 저장됩니다.
기본 요건
제로 셔터 랙을 사용 설정하기 전에 isZslSupported()
를 사용하여 기기가 다음 요구사항을 충족하는지 확인하세요.
- Android 6.0 이상(API 수준 23 이상)을 타겟팅합니다.
PRIVATE
재처리를 지원합니다.
최소 요구사항을 충족하지 않는 기기의 경우 CameraX가 CAPTURE_MODE_MINIMIZE_LATENCY
로 대체됩니다.
제로 셔터 랙은 이미지 캡처에만 사용할 수 있습니다. 동영상 캡처 또는 카메라 확장 프로그램에서는 사용 설정할 수 없습니다.
마지막으로 플래시를 사용하면 지연 시간이 길어지므로 플래시가 켜져 있거나 자동 모드일 때는 제로 셔터 랙이 작동하지 않습니다. 플래시 모드 설정에 관한 자세한 내용은 setFlashMode()
를 참고하세요.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-07-27(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-27(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)."]]