camera_start_video()

Start recording video to a file

Synopsis:

#include <camera/camera_api.h>
camera_error_t camera_start_video(camera_handle_t handle,
                                  const char *filename,
                                  void(*video_callback)
                                               (camera_handle_t, camera_buffer_t *, void *),
                                  void(*status_callback)
                                    (camera_handle_t, camera_devstatus_t, uint16_t, void *),
                                  void *arg)

Arguments:

handle
The handle returned by a call to the camera_open() function.
filename
The name of the file to save the video to.
video_callback
A pointer to a function with the following signature:
 void function_name( camera_handle_t,
                     camera_buffer_t*,
                     void* );
The function is a callback function that is invoked when an uncompressed video frame is available. You can use NULL if no function needs to be called. For information about the callback arguments, see Using callback mode.
status_callback
A pointer to a function with the following signature:
 void function_name( camera_handle_t,
                     camera_devstatus_t,
                     uint16_t,
                     void* );
The function is a callback that is invoked when status events occur. You can use NULL if no function needs to be called. For information about the callback arguments, see Using callback mode.
arg
The argument passed to all callback functions, which is the last argument.

Library:

libcamapi

Description:

This function can only be called if the CAMERA_FEATURE_VIDEO feature is available. You can determine whether this feature is available by calling the camera_has_feature() function.

The viewfinder must be started in a viewfinder mode that supports video recording. For more information about viewfinder modes, see Viewfinder Mode.

Video is recorded based on the configured properties.

Note:

Before calling this function, ensure that all required video encoding properties are set using camera_set_video_property(). For more information about encoding configurations, see the functions in camera_encoder.h.

If you require direct access to the encoded audio and video bitstreams for applications such as video chat or streaming, then you should use camera_start_encode() instead.

Returns:

CAMERA_EOK when the function successfully completes, otherwise another camera_error_t value that provides the reason that the call failed. CAMERA_EINVAL is returned if there's a mismatch in the video properties that were set using camera_set_video_property().