> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dwe.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# stellarHD GStreamer Guide

> A guide to using GStreamer with the stellarHD camera for high-performance video streaming and capture.

## Overview

GStreamer is a powerful multimedia framework that allows for efficient video streaming and processing. The stellarHD supports **MJPEG** and raw **YUYV** compression formats, with high framerate support up to 60 FPS.

## Requirements

You must have GStreamer installed on a Linux computer for this. You can use the following install command to get the required packages.

```bash theme={null}
sudo apt install v4l-utils libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-libav gstreamer1.0-plugins-ugly
```

## Identifying Device Nodes

When you plug in a stellarHD camera, the Linux kernel (via V4L2) typically creates four device nodes (e.g., `/dev/video0` through `/dev/video3`).

* **MJPEG / YUYV:** Found on the first node of the group (e.g., `/dev/video0`).

You can verify your device nodes using `v4l2-ctl`:

```bash theme={null}
v4l2-ctl --list-devices
```

Look for the entry corresponding to the stellarHD. It will list the paths associated with that specific camera.

## MJPEG Mode

MJPEG mode is the primary way to achieve high framerates (up to 60 FPS) on the stellarHD.

### Local Preview

Assuming `/dev/video0` is the MJPEG node:

```bash theme={null}
gst-launch-1.0 v4l2src device=/dev/video0 ! \
    image/jpeg,width=1600,height=1200,framerate=60/1 ! \
    jpegdec ! autovideosink
```

### UDP Network Stream

To stream MJPEG over a network to another device (e.g., IP `192.168.1.50` on port `5600`):

```bash theme={null}
gst-launch-1.0 v4l2src device=/dev/video0 ! \
    image/jpeg,width=1600,height=1200,framerate=60/1 ! \
    rtpjpegpay ! udpsink host=192.168.1.50 port=5600
```

To receive the stream on a different computer you can use the following:

```bash theme={null}
gst-launch-1.0 -v udpsrc port=5600 ! \
    "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)JPEG, payload=(int)26" ! \
    rtpjpegdepay ! jpegdec ! videoconvert ! autovideosink
```

## YUYV Mode

Note that YUYV is limited to lower framerates at higher resolutions due to USB bandwidth.

### Local Preview

Assuming `/dev/video0` is the node:

```bash theme={null}
gst-launch-1.0 v4l2src device=/dev/video0 ! \
    video/x-raw,format=YUY2,width=640,height=480,framerate=5/1 ! \
    videoconvert ! autovideosink
```

<Note>
  Refer to the [stellarHD Technical Specifications](/stellarHD/specs/stellarHD#supported-resolutions-and-framerates) to see which resolution and framerate combinations are supported in YUYV mode.
</Note>

## Software Encoding (H.264)

Since the stellarHD does not have a built-in hardware H.264 encoder, you can use GStreamer to perform software encoding if you need to stream H.264 over a network.

```bash theme={null}
gst-launch-1.0 v4l2src device=/dev/video0 ! \
    image/jpeg,width=1280,height=720,framerate=60/1 ! \
    jpegdec ! queue ! x264enc tune=zerolatency bitrate=4000 speed-preset=ultrafast ! \
    h264parse ! rtph264pay config-interval=10 pt=96 ! \
    udpsink host=192.168.1.50 port=5600
```
