Camera configuration

This Page covers the advanced usage for camera streaming & configurations over the V4l-API

More detailed information about this can be found on the NVIDIA Camera adaption guide & manual pages for the used commands bellow

Introduction

The Video4Linux-API (V4L in short) is the Linux interface that is used to manage the CSI video input from the CSI-Camera. Most of those cameras are using I2C for futher configurations for the camera, which can be changed over the V4L-API in the following ways.

v4l-utils is required in order to execute the following examples properly by using

Install
 test@test-desktop:~$ sudo apt update & sudo apt install v4l-utils

Video4Linux Controls

V4L allows the user to make further configurations on the Camera sensor to alter/improve the video stream settings.

The video device can be found in the /dev/ directory. If the camera correctly plugged in then there should be a device called /dev/videoX, where X is the camera id.

List available controls

Returns a list of available camera controls to change

Syntax: sudo v4l2-ctl --device /dev/videoX -l

test@test-desktop:~$ sudo v4l2-ctl --device /dev/video0 -l

Camera Controls

                     group_hold 0x009a2003 (bool)   : default=0 value=0 flags=execute-on-write
                    sensor_mode 0x009a2008 (int64)  : min=0 max=3 step=1 default=0 value=1 flags=slider
                           gain 0x009a2009 (int64)  : min=16 max=356 step=1 default=16 value=16 flags=slider
                       exposure 0x009a200a (int64)  : min=13 max=683709 step=1 default=2495 value=26011 flags=slider
                     frame_rate 0x009a200b (int64)  : min=2000000 max=60000000 step=1 default=60000000 value=21000000 flags=slider
                    bypass_mode 0x009a2064 (intmenu): min=0 max=1 default=0 value=1
                override_enable 0x009a2065 (intmenu): min=0 max=1 default=0 value=1
                   height_align 0x009a2066 (int)    : min=1 max=16 step=1 default=1 value=1
                     size_align 0x009a2067 (intmenu): min=0 max=2 default=0 value=0
               write_isp_format 0x009a2068 (int)    : min=1 max=1 step=1 default=1 value=1
       sensor_signal_properties 0x009a2069 (u32)    : min=0 max=4294967295 step=1 default=0 [30][18] flags=read-only, has-payload
        sensor_image_properties 0x009a206a (u32)    : min=0 max=4294967295 step=1 default=0 [30][16] flags=read-only, has-payload
      sensor_control_properties 0x009a206b (u32)    : min=0 max=4294967295 step=1 default=0 [30][36] flags=read-only, has-payload
              sensor_dv_timings 0x009a206c (u32)    : min=0 max=4294967295 step=1 default=0 [30][16] flags=read-only, has-payload
               low_latency_mode 0x009a206d (bool)   : default=0 value=0
               preferred_stride 0x009a206e (int)    : min=0 max=65535 step=1 default=0 value=0
                   sensor_modes 0x009a2082 (int)    : min=0 max=30 step=1 default=30 value=3 flags=read-only
test@test-desktop:~$ 

Set control value

For this example we use the exposure controls from the list above

available control output
exposure 0x009a200a (int64)  : min=13 max=683709 step=1 default=2495 value=26011 flags=slider

This control can be changed by using the following command Syntax: sudo v4l2-ctl --device /dev/videoX --set-ctrl=<control>=<value>

set exposure control
test@test-desktop:~$ sudo v4l2-ctl --device /dev/video0 --set-ctrl=exposure=600000

Get control value

For this example we use the exposure controls from the list above.

This control can be read by using the following command Syntax: sudo v4l2-ctl --device /dev/videoX --get-ctrl=<control>

get exposure control
test@test-desktop:~$ sudo v4l2-ctl --device /dev/video0 --get-ctrl=exposure
exposure: 19999

Pleas note that other streaming tools can also intervene and change those settings and might be overwritten or not applied correctly.

Example Stream

The following screenshots are showing the difference between different exposure settings on a Raspberry PI IMX477 camera sensor that is connected via CSI on our JNX30M Carrierboard

Last updated