# Control v4l2 camera parameters

**URL:** <https://forums.developer.nvidia.com/t/control-v4l2-camera-parameters/308585>\
**Category:** Jetson Nano\
**Tags:** camera\
**Created:** [October 2, 2024, 7:52pm UTC](https://forums.developer.nvidia.com/t/control-v4l2-camera-parameters/308585 "2024-10-02T19:52:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![isyed1](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@isyed1](https://forums.developer.nvidia.com/u/isyed1)\
**Post date:** [October 2, 2024, 7:52pm UTC](https://forums.developer.nvidia.com/t/control-v4l2-camera-parameters/308585/1 "2024-10-02T19:52:05Z")

</div>

Hello,

I’m using Arducam’s OV9281 cameras with the camarray hat to record video. I’m trying to set the exposure control before running the following gstreamer command:

```auto
gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,format=(string)GRAY8,width=(int)2560,height=(int)800' ! nvvidconv ! 'video/x-raw(memory:NVMM), format=(string)I420' ! omxh264enc ! 'video/x-h264, stream-format=(string)byte-stream' ! h264parse ! qtmux ! filesink location=gstream.mp4 –e

```

I tried changing the controls with v4l2-ctl before running this command, but nothing seemed to change. When viewing a preview in VLC media player, the v4l2-ctl command does change the exposure in the preview.

I’d appreciate any help and guidance with setting these controls and maintaining them while the gstreamer command runs.

---

<div class="post-metadata">

**Author:** ![isyed1](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@isyed1](https://forums.developer.nvidia.com/u/isyed1)\
**Post date:** [October 4, 2024, 12:05am UTC](https://forums.developer.nvidia.com/t/control-v4l2-camera-parameters/308585/3 "2024-10-04T00:05:44Z")

</div>

It seems that running the controls command in a different terminal window seems to partially solve this problem. After the command is entered, it seems that the new control applied. Is there any way to start up the gstreamer command with a set v4l2 ctrl?

---

<div class="post-metadata">

**Author:** ![proventusnova](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/proventusnova/32/423584_2.png) [@proventusnova](https://forums.developer.nvidia.com/u/proventusnova)\
**Post date:** [October 4, 2024, 2:22am UTC](https://forums.developer.nvidia.com/t/control-v4l2-camera-parameters/308585/4 "2024-10-04T02:22:04Z")

</div>

Hello @isyed1,

The reason why the controls do not persist is because the drivers on NVIDIA Jetson devices usually work in such a way that they power on the camera, perform whatever operation the user space application requires, then the camera is powered off, at that moment, the values you set to the controls and registers are lost.

The reason why it works when changing the exposure on a separate terminal window is because I assume you already have the pipeline running, therefore, the camera is never powered off while you interact with the exposure control.

If you want to set the control through GStreamer fixed from the start. You can try setting the following property for the v4l2src element:

```auto
extra-controls="c,exposure=200000"

```

Hope that helps.  
Please let us know if you require further assistance.

regards,  
Andrew  
Embedded Software Engineer at ProventusNova  
[https://proventusnova.com/embedded-software-engineering-support/](https://proventusnova.com/embedded-software-engineering-support/)

---

<div class="post-metadata">

**Author:** ![isyed1](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@isyed1](https://forums.developer.nvidia.com/u/isyed1)\
**Post date:** [October 4, 2024, 4:38am UTC](https://forums.developer.nvidia.com/t/control-v4l2-camera-parameters/308585/5 "2024-10-04T04:38:56Z")

</div>

Thanks for tip! How exactly would I implement the extra controls in the pipeline command?

I’ve tried  
`gst-launch-1.0 v4l2src device=/dev/video0 extra-controls="c,exposure=1" ! 'video/x-raw,format=(string)GRAY8,width=(int)2560,height=(int)800' ! nvvidconv ! 'video/x-raw(memory:NVMM), format=(string)I420' ! omxh264enc ! 'video/x-h264, stream-format=(string)byte-stream' ! h264parse ! qtmux ! filesink location=gstream.mp4 –e`

and tried moving the extra-controls text around but none seem to work. I’m guessing that it might be inside the ‘video/x-raw,format…’ line, but that isn’t working either.

---

<div class="post-metadata">

**Author:** ![ShaneCCC](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/shaneccc/32/14043_2.png) [@ShaneCCC](https://forums.developer.nvidia.com/u/ShaneCCC)\
**Post date:** [October 4, 2024, 5:58am UTC](https://forums.developer.nvidia.com/t/control-v4l2-camera-parameters/308585/6 "2024-10-04T05:58:51Z")

</div>

Check if there’s override\_enable.

v4l2-ctl --all

v4l2-ctl -C override\_enable  
v4l2-ctl-c override\_enable=0

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/system/32/68080_2.png) [@system](https://forums.developer.nvidia.com/u/system)\
**Post date:** [October 23, 2024, 6:30am UTC](https://forums.developer.nvidia.com/t/control-v4l2-camera-parameters/308585/8 "2024-10-23T06:30:15Z")

</div>

Closed on October 23, 2024, 6:30am UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
