# Basic camera usage

## How to connect

Most of carrierboards are using a 22-Pin FPC/FFC connector. The images below are showing the camera connection for the [Raspberry PI IMX219](https://www.raspberrypi.com/products/camera-module-v2/) camera on a JNX30 Carrierboard using a 15- to 22-Pin adapter .&#x20;

{% hint style="info" %}
&#x20;In case your camera uses a different connector you may want to take a look at our [shop](https://auvidea.eu/product-category/cameras-2/csi-2/) for available camera adapters. &#x20;
{% endhint %}

| ![](https://2069969274-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsSYN9BaRCffOHPdgJhYS%2Fuploads%2FFlZiUEQTmqZC5oMqAIKC%2Fimage.png?alt=media\&token=4c47b12a-4959-45ff-be53-4ef11810f67c) | ![](https://2069969274-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsSYN9BaRCffOHPdgJhYS%2Fuploads%2F8B2znrYS9ftlEjCAP8Zd%2Fcutted_jnx30_CSI_cam.png?alt=media\&token=07d29494-fc1c-49dc-9284-7cb6c11c79f4) |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

## Camera Capture

{% hint style="warning" %}
The following gstreamer pipelines are optimized for the Raspberry PI IMX219 and might not work with a different camera. If you don't know what you are doing, you may speak to your camera supplier for more information
{% endhint %}

The parameter `sensor-id=` describes the camera target. This id can be found by using `ls /dev/`. If the camera correctly plugged in then there should be a device called `/dev/videoX`, where `X` is the camera id.

All pipelines listed below are using the NVIDIA accelerated Argus GStreamer-plugins to make use of the NVIDIA Jetson specific hardware components

### Common properties

| Property      | Description                                                                                                                                             |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `sensor-id`   | Video device number                                                                                                                                     |
| `width`       | Requested video width                                                                                                                                   |
| `height`      | Requested video height                                                                                                                                  |
| `format`      | Video stream format, this value depends on the camera sensor that is used. You should contact your camera vendor for the value that should be used here |
| `framerate`   | Defines captured frames for a given time frame (Example: 30/1 would be 30 frames each second -> frames/time)                                            |
| `num-buffers` | Amount of frames that should be captured                                                                                                                |

### Capture examples

{% tabs %}
{% tab title="Streaming" %}
{% code title="stream.sh" overflow="wrap" lineNumbers="true" %}

```bash
gst-launch-1.0 nvarguscamerasrc sensor-id=0 ! 'video/x-raw(memory:NVMM), width=(int)1280, height=(int)720, format=(string)NV12, framerate=(fraction)30/1' ! nvvidconv ! queue ! xvimagesink
```

{% endcode %}
{% endtab %}

{% tab title="capture png " %}
{% code title="image\_capture.sh" overflow="wrap" lineNumbers="true" %}

```bash
gst-launch-1.0 nvarguscamerasrc sensor-id=0 num-buffers=1 ! 'video/x-raw(memory:NVMM), width=(int)4032, height=(int)3040, format=(string)NV12, framerate=(fraction)30/1' ! nvvidconv ! pngenc ! filesink location=capture.png 
```

{% endcode %}
{% endtab %}

{% tab title="capture mp4" %}
{% code title="stream\_capture.sh" overflow="wrap" lineNumbers="true" %}

```bash
gst-launch-1.0 nvarguscamerasrc sensor-id=0 num-buffers=100 ! 'video/x-raw(memory:NVMM), width=(int)4032, height=(int)3040, format=(string)NV12, framerate=(fraction)30/1' ! nvv4l2h264enc ! h264parse ! qtmux ! filesink location=capture_h264.mp4
```

{% endcode %}
{% endtab %}
{% endtabs %}
