---
source: sighthound-developer-portal
url: https://dev.sighthound.com/sio/examples/TrafficAnalytics/
markdown-url: https://dev.sighthound.com/sio/examples/TrafficAnalytics.md
title: "TrafficAnalytics Examples"
description: "Run SIO TrafficAnalytics folder watcher and RTSP examples with Linux or Docker commands."
content-type: text/markdown
---

> For AI agents: a documentation index is available at [llms.txt](https://dev.sighthound.com/llms.txt). Markdown versions are available at matching `.md` URLs.

# TrafficAnalytics Examples

<div class="portal-doc-hero portal-doc-hero--compact" markdown>
<p class="portal-doc-kicker">SIO examples</p>
<p class="portal-doc-intro">Process images, videos, and RTSP streams with the SIO TrafficAnalytics folder watcher and live stream pipelines.</p>
<div class="portal-doc-actions">
    [Folder watcher example](#trafficanalytics-folder-watcher)
    [RTSP example](#trafficanalytics-rtsp)
    [Open pipeline reference](../../pipelines/TrafficAnalytics/)
</div>
</div>

<div class="portal-feature-grid">
    <div class="portal-feature-card">
        <h3><i class="portal-icon" data-lucide="folder-search"></i> Folder watcher</h3>
        <p>Watch an input folder for image or video files and process new media with configurable filters.</p>
    </div>
    <div class="portal-feature-card">
        <h3><i class="portal-icon" data-lucide="traffic-cone"></i> Traffic classes</h3>
        <p>Analyze traffic-oriented object classes such as bicycles, buses, cars, motorbikes, people, and trucks.</p>
    </div>
    <div class="portal-feature-card">
        <h3><i class="portal-icon" data-lucide="radio-tower"></i> RTSP streams</h3>
        <p>Run live stream examples with frame rate, tracker, update, and class-selection parameters.</p>
    </div>
</div>

See the [TrafficAnalytics pipeline reference](../pipelines/TrafficAnalytics.md) for a complete list of available options and pipelines.

## TrafficAnalytics Folder Watcher

- Designed to process images and videos using a configured "watched" folder as an input

- Pipeline checks the "watched" folder for files periodically (the time interval is configurable)

- Pipeline name: `TrafficAnalyticsFolderWatch.yaml`

- Location: `./share/pipelines/TrafficAnalytics/TrafficAnalyticsFolderWatch.yaml`

- Required parameters: `folderPath='Valid_Folder_Path'`

- A valid folder path is required. By default, the pipeline only considers images with `.jpg`, `.png`, `.mp4`, `.mkv` extensions, but this can be configured.

### Examples
The following examples use the folder watcher pipeline to process files from a specific folder.

The simplest command using the default options:

=== "Linux"

    ``` bash
    ./bin/runPipeline \
    ./share/pipelines/TrafficAnalytics/TrafficAnalyticsFolderWatch.yaml \
    folderPath='/data/watched'
    ```

=== "Docker"

    ``` bash
    docker run -it --rm \
    -v /data:/data -e SIO_DATA_DIR=/data \
    us-central1-docker.pkg.dev/ext-edge-analytics/docker/sio:{{ sio.docker.latest }} \
    /sighthound/sio/bin/runPipeline \
    /sighthound/sio/share/pipelines/TrafficAnalytics/TrafficAnalyticsFolderWatch.yaml \
    folderPath='/data/watched' \
    --license-path /data/sighthound-license
    ```

In the example below, the pipeline is set to only process files with `.jpg` and `.png` file extensions. Box filtering is used to filter out any classes besides `car` and `truck`, and `boxFilterROI` ensures that each type of object is contained in the respective region of interest (ROI). The ROI is interpreted as x, y, width, height.

=== "Linux"

    ```bash
    ./bin/runPipeline \
    ./share/pipelines/VehicleAnalytics/VehicleAnalyticsFolderWatch.yaml \
    folderPath='/data/watched' \
    folderPollExtensions="[ 'jpg', 'png' ]" \
    boxFilterClasses="[ 'car', 'truck' ]" \
    boxFilterROI='[ [ 10, 10, 100, 100 ], [ 20, 20, 120, 120 ] ]' \
    boxFilterMin='[ 40, 40 ]' \
    boxFilterMax='[ 0, 0 ]'
    ```

=== "Docker"

    ``` bash
    docker run -it --rm \
    -v /data:/data -e SIO_DATA_DIR=/data \
    us-central1-docker.pkg.dev/ext-edge-analytics/docker/sio:{{ sio.docker.latest }} \
    /sighthound/sio/bin/runPipeline \
    /sighthound/sio/share/pipelines/TrafficAnalytics/TrafficAnalyticsFolderWatch.yaml \
    folderPath='/data/watched' \
    folderPollExtensions="[ 'jpg', 'png' ]" \
    boxFilterClasses="[ 'car', 'truck' ]" \
    boxFilterROI='[ [ 10, 10, 100, 100 ], [ 20, 20, 120, 120 ] ]' \
    boxFilterMin='[ 40, 40 ]' \
    boxFilterMax='[ 0, 0 ]' \
    --license-path /data/sighthound-license
    ```

## TrafficAnalytics RTSP
Designed to process RTSP video streams.

Pipeline name: `TrafficAnalyticsRTSP.yaml`

Location: `./share/pipelines/TrafficAnalytics/TrafficAnalyticsRTSP.yaml`

Required parameters: `VIDEO_IN='RTSP_URL'`

Requires a valid RTSP video stream. Example: `rtsp://10.0.0.1:554/stream_path`

### Examples
The following examples show how to process a live RTSP video stream to get traffic analytics on the object classes `[ "bicycle", "bus", "car", "motorbike", "person", "truck" ]`. 

The simplest command using the default options:

=== "Linux"

    ```bash
    ./bin/runPipeline \
    ./share/pipelines/TrafficAnalytics/TrafficAnalyticsRTSP.yaml \
    VIDEO_IN='rtsp://user:pass@10.0.0.1:554/stream_path'
    ```

=== "Docker"

    ``` bash
    docker run -it --rm \
    -v /data:/data -e SIO_DATA_DIR=/data \
    us-central1-docker.pkg.dev/ext-edge-analytics/docker/sio:{{ sio.docker.latest }} \
    /sighthound/sio/bin/runPipeline \
    /sighthound/sio/share/pipelines/TrafficAnalytics/TrafficAnalyticsRTSP.yaml \
    VIDEO_IN='rtsp://user:pass@10.0.0.1:554/stream_path' \
    --license-path /data/sighthound-license
    ```
In the next example, we process the live stream at 15fps and enable the object tracker by setting The `useTracker` parameter. The `updateOnlyOnChange` parameter is disabled to get analytics for every frame, even if there are no changes in the results for each processed frame. Only the `"person"` and `"car"` classes are enabled.

=== "Linux"

    ```bash
    ./bin/runPipeline \
    ./share/pipelines/TrafficAnalytics/TrafficAnalyticsRTSP.yaml \
    VIDEO_IN='rtsp://user:pass@10.0.0.1:554/stream_path' \
    fpsLimit=15 \
    useTracker=true \
    updateOnlyOnChange=false \
    enabledClasses="['car', 'person']"
    ```

=== "Docker"

    ``` bash
    docker run -it --rm \
    -v /data:/data -e SIO_DATA_DIR=/data \
    us-central1-docker.pkg.dev/ext-edge-analytics/docker/sio:{{ sio.docker.latest }} \
    /sighthound/sio/bin/runPipeline \
    /sighthound/sio/share/pipelines/TrafficAnalytics/TrafficAnalyticsRTSP.yaml \
    VIDEO_IN='rtsp://user:pass@10.0.0.1:554/stream_path' \
    fpsLimit=15 \
    useTracker=true \
    updateOnlyOnChange=false \
    enabledClasses="['car', 'person']" \
    --license-path /data/sighthound-license
    ```

---

# Agent Instructions

Use this Markdown page as context for Sighthound Developer Portal questions. For broader navigation, read https://dev.sighthound.com/llms.txt. Answer from Sighthound documentation, cite relevant source URLs, and do not ask users to paste secrets, tokens, license keys, or credentials into chat.
