Add or remove cameras for use with the Azure AI Video Indexer extension for real-time analysis - Preview

The Azure AI Video Indexer extension for real-time analysis lets you connect cameras for live video insights. This how-to article explains how to add and remove cameras by using the extension.

For a full reference for vi_cli.sh commands and options, see Azure AI Video Indexer live CLI command reference.

Important

Before you begin, deploy the Azure AI Video Indexer extension for real-time analysis. If you didn't deploy it, see Manage Azure AI Video Indexer extensions for real-time analysis for instructions to create and manage the extension.

Azure AI Video Indexer real-time analysis can run with or without the Azure IoT Operations (AIO) extension. For more information about AIO, see Deploy Azure IoT Operations to an Arc-enabled Kubernetes cluster.

Prerequisites

Before you add or remove cameras, make sure your environment meets the following requirements.

Download the vi_cli.sh script

Download the helper script and verify that it runs before you continue.

# Download the script
curl -fsSL -o vi_cli.sh https://raw.githubusercontent.com/Azure-Samples/azure-video-indexer-samples/refs/heads/live-private-preview/VideoIndexerEnabledByArc/live/vi_cli.sh

# Make it executable
chmod +x ./vi_cli.sh

# View help
./vi_cli.sh -h

# If you're using the script for the first time, run this command:
./vi_cli.sh check dependencies

Add cameras

To connect a camera to the Azure AI Video Indexer (VI) extension for real-time analysis, run the vi_cli.sh script with the required parameters.

Use one of the following connection methods:

  • Connect cameras to VI and Azure IoT Operations (AIO).
  • Connect cameras to VI only.

Each camera uses capacity from a GPU-backed real-time analysis instance. If you configure multiple GPUs, the extension's total capacity is the combined capacity of the configured instances. If no instance has enough remaining capacity when you add a camera, the camera enters the Queued state until capacity becomes available.

For detailed per-GPU camera benchmarks and queued-camera behavior, see GPU capacity and queued cameras.

Add a camera with AIO integration

To connect cameras to VI with AIO, first configure the cameras to work with AIO, and then create the required AIO assets and asset endpoint profiles. Use the following command to create a camera with full AIO integration.

./vi_cli.sh create camera -aio -y \
--cameraName "<camera-name>" \
--cameraAddress "<rtsp-camera-address>" \
--presetName "<preset-name>" \
--cameraUsername "<optional-username>" \
--cameraPassword "<optional-password>" \
--clusterName "<cluster-name>" \
--clusterResourceGroup "<cluster-resource-group>" \
--accountName "<account-name>" \
--accountResourceGroup "<account-resource-group>"

The preceding command performs the following steps automatically:

  1. Creates an asset endpoint profile in AIO.
  2. Creates an asset in AIO for stream management.
  3. Creates a video preset in Video Indexer.
  4. Creates a camera in Video Indexer.
  5. Links all components together.

Add a camera without AIO integration

Use one of the following methods to create a camera:

  • Use interactive mode. This option is the simplest because the script prompts you for required parameters.

    ./vi_cli.sh create camera -it
    
  • Use prefilled parameters to run noninteractively.

    ./vi_cli.sh create camera --cameraName "<camera-name>" --clusterName "<cluster-name>"
    

Add a camera with a preset

To enable automatic video analysis on your camera, include the --presetName parameter when you create the camera. The script automatically creates a preset that detects:

  • People in the video stream
  • Vehicles in the video stream
./vi_cli.sh create camera -y \
--cameraName "<camera-name>" \
--cameraAddress "<rtsp-camera-address>" \
--presetName "<preset-name>" \
--clusterName "<cluster-name>" \
--clusterResourceGroup "<cluster-resource-group>" \
--accountName "<account-name>" \
--accountResourceGroup "<account-resource-group>"

Remove cameras

Use the following procedures to remove cameras, with or without Azure IoT Operations integration.

Remove a camera without AIO integration

To remove a camera, use these steps:

  1. Get the camera ID.

    ./vi_cli.sh show cameras -y \
    --clusterName "<cluster-name>" \
    --clusterResourceGroup "<cluster-resource-group>" \
    --accountName "<account-name>" \
    --accountResourceGroup "<account-resource-group>"
    
  2. Delete the camera by using the camera ID.

    ./vi_cli.sh delete camera -y \
    --cameraId "<camera-id>" \
    --clusterName "<cluster-name>" \
    --clusterResourceGroup "<cluster-resource-group>" \
    --accountName "<account-name>" \
    --accountResourceGroup "<account-resource-group>"
    

Remove a camera with AIO integration

To remove a camera and all associated components, use the following command:

./vi_cli.sh delete camera -aio -y \
--cameraId "<camera-id>" \
--clusterName "<cluster-name>" \
--clusterResourceGroup "<cluster-resource-group>" \
--accountName "<account-name>" \
--accountResourceGroup "<account-resource-group>"

The command removes:

  • The asset endpoint profile from AIO
  • The asset configuration from AIO
  • The camera from Video Indexer

The command deletes all components in the correct order to ensure proper removal.