> For the complete documentation index, see [llms.txt](https://docs.rekor.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rekor.ai/scout/agent/configuration/camera-streams.md).

# Camera Streams

The agent must be configured to connect to one or more camera streams to process license plates. Scout expects to receive a URL specifying the HTTP or RTSP stream location on the IP camera. You should be able to find this URL by consulting your camera’s user manual, or with the help of an ONVIF-capable discovery tool. Once you have found the URL, you can test the stream with a video player such as [VLC](http://www.videolan.org/).

To add a camera stream:

1. Create a new unique file in the folder `/etc/openalpr/stream.d/` with the extension `.conf`. For example, create a file named `my_new_camera.conf`.
2. Add the following content:

   ```
   camera_id = [some unique number]
   stream = [Camera HTTP/RTSP stream URL]
   ```
3. Restart the Scout Agent.

Once restarted, you should see the agent successfully connecting to the camera in the log file `/var/log/alpr.log`

Each camera configuration file may optionally be configured with the following settings:

* `prewarp` - A series of numbers that adjusts the rotation/angle of the camera image before processing. The exact value can be obtained through the Scout configuration utility.
* `detection_mask_image` - The path to a black and white image file creates a mask over the video stream before processing. Black areas are ignored, white areas are scanned for plates.

## Custom GStreamer Pipeline

In some cases, you may require more control over the process that grabs video from your device and makes it available to Scout. The Scout Agent and Scout SDK both allow you to configure a custom GStreamer Pipeline which can handle pulling video from your camera. [GStreamer](https://gstreamer.freedesktop.org/) is open source and supports user plug-ins that allow you to write your own C code in case you need to utilize 3rd party device drivers to pull the data.

To get started, you should first familiarize yourself with GStreamer pipelines. The following are a few examples of pulling video from various sources. gst-launch-1.0 is a command-line program that will execute the pipeline and display the output.

### Webcam

```
gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,framerate=30/1,width=1280,height=720 ! decodebin ! videoconvert ! video/x-raw,format=BGR ! videoconvert ! autovideosink
```

### Video File

```
gst-launch-1.0 filesrc location=/tmp/video.mp4 ! decodebin ! videoconvert ! video/x-raw,format=BGR ! videoconvert ! autovideosink
```

### RTSP/H264 Camera

```
gst-launch-1.0 rtspsrc location=rtsp://192.168.0.100/video user-id=testuser user-pw=test drop-on-latency=1 latency=1000 ! queue max-size-buffers=0 max-size-time=0 max-size-bytes=0 min-threshold-time=10 ! rtph264depay ! h264parse ! decodebin ! videoconvert ! video/x-raw,format=BGR ! videoconvert ! autovideosink
```

Once you have experimented with [GStreamer](https://gstreamer.freedesktop.org/) to display video, you can now integrate it with Scout. Our software will see the video exactly as the gst-launch-1.0 command displays it. If using the agent, you can add your custom GStreamer format as follows:

1. Edit `/etc/openalpr/stream.d/[cameraname].conf`
2. Add `gstreamer_format = [your custom gstreamer pipeline]`
3. Remove the `autovideosink` and replace it with `appsink name=sink max-buffers=5`
4. Make sure you do not include the `gst-launch-1.0` command at the beginning. Also, avoid quote marks as these will cause a syntax error from GStreamer’s parser
5. Lastly, add `stream = [any_string]` and `camera_id = [any_number]`. These are required for the agent to recognize your configuration file as a proper camera

A complete configuration example using the webcam pipeline above would be:

```
stream = dummy
camera_id = 1234
gstreamer_format = v4l2src device=/dev/video0 ! video/x-raw,framerate=30/1,width=1280,height=720 ! decodebin ! videoconvert ! video/x-raw,format=BGR ! videoconvert ! appsink name=sink max-buffers=5
```

If you are using the Scout SDK, you will apply the pipeline to the API function `connect_video_stream_url` by passing it a string for `gstreamer_pipeline_format`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.rekor.ai/scout/agent/configuration/camera-streams.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
