Skip to content

Video stream settings#

In LUNA ID, you can configure the following parameters for video stream recording:

Setting Platform
Video stream quality
Timeout before starting recording
Video stream duration
Custom frame resolution
Autofocus

Video stream quality#

Applies to LUNA ID for Android only.

To configure the video stream quality, pass the LunaVideoQuality parameter to the LunaConfig method. The parameter has the following values:

  • SD - Default. Provides a lower resolution and smaller file size suitable for most use cases (~640x480 pixels).
  • HD - Increases the resolution, frame rate, and bitrate, resulting in better video quality but larger file sizes and potentially higher processing requirements.

Video stream quality is determined by the following parameters:

Parameter SD (Low quality) SD (High quality) HD 720p HD 1080p
Video resolution 640x480 px 720×480 px 1280×720 px 1920×1080 px
Video frame rate 20 fps 30 fps 30 fps 30 fps
Video bitrate 384 Kbps 2 Mbps 4 Mbps 20 Mbps

Timeout before starting recording#

Applies to LUNA ID for iOS only.

To configure a delay before starting video recording, use the LCLunaConfiguration.startDelay parameter. This parameter allows you to specify the duration (in seconds) to wait before initiating the recording process.

By default, the parameter value is set to 0.

Video stream duration#

In LUNA ID for Android#

To limit a video stream's duration, use the recordingTimeMillis parameter within the LunaID.ShowCameraParams configuration. This parameter defines the video stream duration in milliseconds. By default, this value is not set , meaning you must explicitly configure it when enabling video recording.

LunaID.showCamera(
    activity,
    LunaID.ShowCameraParams(
        recordVideo = true,
        recordingTimeMillis = 10000 // Sets the video recording duration to 10 seconds
    )
)

Important: The recordingTimeMillis parameter is mandatory if recordVideo is set to true. Failing to provide a valid positive value will result in the following exception:

IllegalStateException, when param recordVideo is true -> param recordingTimeMillis must be positive

In LUNA ID for iOS#

To limit the duration of a video stream:

  1. Enable face identity tracking
    Set the LCLunaConfiguration.trackFaceIdentity property to true to enable face identity tracking during the video stream.
  2. Set video stream length
    Use the LCLunaConfiguration::videoRecordLength parameter to specify the maximum duration of the video stream in seconds.
  3. Initialize the watchdog object
    Call LMCameraCaptureManager::createVideoRecordWatchDog(LunaCore::LCBestShotDetectorProtocol) in your ViewController.
    This initializes a watchdog object that monitors the primary face search and starts the video recording process. Once the time specified in videoRecordLength elapses, the recording automatically stops.
    The watchdog object lives inside the capture manager and is not available for public usage.

Custom frame resolution#

Applies to LUNA ID for Android only.

To specify precise resolution requirements for your application, use the following parameters of the ShowCameraParams class:

  • preferredAnalysisFrameWidth
  • preferredAnalysisFrameHeight

These parameters allow you to specify a preferred resolution for frame analysis. However, note that the preferred prefix implies the specified resolution may not always be supported by the device's camera. In such cases, the system automatically adjusts to the nearest available resolution.

By configuring these parameters, you can optimize the frame resolution to better suit your application's needs while ensuring compatibility with the device's hardware capabilities.

The default frame resolution for frame analysis is 480x320.

Autofocus#

Applies to LUNA ID for Android only.

To control whether the camera's autofocus feature will be enabled or disabled upon startup, use the disableAutoFocus parameter of the ShowCameraParams class. The parameter has the following values:

  • true - Disables the camera's autofocus functionality, allowing for a fixed focus setting regardless of device capabilities.
  • false - Default. Enabled the camera’s autofocus feature if the device supports it. This aligns with the default behavior of CameraX, which enables autofocus when supported by the hardware.