Updated: May 06, 2022

Configure the threshold of recording time left on the device before a warning is issued


#include <camera/camera_api.h>
camera_error_t camera_set_video_filesize_warning(camera_handle_t handle,
                                                 uint16_t seconds_remaining)


The handle returned by a call to the camera_open() function.
The threshold (in seconds) for remaining recording time to issue a warning status event.




The device has a recording capacity that's measured in bytes but can also be expressed as a number of seconds depending on the encoding bitrate. The recording capacity is indicated as seconds of remaining recording time, which is the time left before a video recording will be stopped. During recording, there is continual estimation of remaining time (in seconds) before the device is full.

The camera will deliver a CAMERA_STATUS_FILESIZE_WARNING status event to the application when the estimation of recording time left is less than the value in the seconds_remaining argument. The status event is delivered to any callback functions registered when you called camera_start_viewfinder() or camera_start_video(). It is also delivered via any sigevent enabled by camera_enable_status_event(). For more details, see Using event mode and Using callback mode.


The time remaining calculation is an estimate based on the encoder's past performance and is subject to jitter. For this reason, the calculated remaining time may not be perfectly accurate.

Typically, an application would set this to five minutes (3000 seconds). When that threshold is crossed, the application would receive a low-space warning. You can adjust the threshold lower to receive additional warnings as the recording time approaches 0. For example, you could move the threshold to one minute (60 seconds) for the next warning.


CAMERA_EOK when the function successfully completes, otherwise another camera_error_t value that provides the reason that the call failed.