camera_set_video_property()

Updated: April 19, 2023

Configure the output properties for video recording and encoding

Synopsis:

#include <camera/camera_api.h>
#define camera_set_video_property(handle,
                                  args...)

Arguments:

handle
The handle returned by a call to the camera_open() function.
args
A series of comma-delimited property-value pairs. For details on how to specify multiple property-value pairs, see the function description.

Library:

libcamapi

Description:

Ensure that you call this function before you start recording or encoding video.

For the args argument, you can provide one or more property-value pairs using a camera_imgprop_t value for the name of each property and a pointer to the correct type, such as an int or double, for the value. The following properties can be used with this function:
Note:

There is no type-checking performed by the compiler. Therefore, you must ensure that the value you provide for each property matches the expected data type. Data type mismatches can result in undefined behavior and cause your application to crash.

You can specify multiple property-value pairs by delimiting them with a comma as follows:
 camera_set_video_property( camera_handle,
                            CAMERA_IMGPROP_WIDTH, 720,
                            CAMERA_IMGPROP_HEIGHT, 1280,
                            CAMERA_IMGPROP_ROTATION, 270,
                            CAMERA_IMGPROP_FRAMERATE, (double)30.0 );
Note:

You should determine whether the CAMERA_FEATURE_PREVIEWISVIDEO property is available using the camera_has_feature() function before configuring the video output properties. If this feature is available, then the camera does not provide independent video and viewfinder image streams.

When using such a camera, the CAMERA_IMGPROP_WIDTH, CAMERA_IMGPROP_HEIGHT, CAMERA_IMGPROP_FORMAT, and CAMERA_IMGPROP_ROTATION properties must match the values supplied to the camera_set_vf_property() function. The viewfinder frame rate, which is the value used for the CAMERA_IMGPROP_FRAMERATE property in the camera_set_vf_property() call, must be an integer multiple of the video frame rate used in this function.

Returns:

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