Skip to content

Commit ed9feca

Browse files
committed
Add CLI to media connector
1 parent beb775c commit ed9feca

File tree

2 files changed

+58
-7
lines changed

2 files changed

+58
-7
lines changed

articles/iot-operations/discover-manage-assets/howto-use-media-connector.md

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ This article explains how to use the media connector to perform tasks such as:
2323
- Define the devices that connect media sources to your Azure IoT Operations instance.
2424
- Add assets, and define their streams for capturing media from the media source.
2525
- Send an image snapshot to the MQTT broker.
26-
- Save a video stream to a local file system.
26+
- Save a video clip to Azure storage.
2727

2828
## Prerequisites
2929

30-
To configure devices and assets, you need a running instance of Azure IoT Operations.
30+
To configure devices and assets, you need a running preview instance of Azure IoT Operations.
3131

3232
[!INCLUDE [iot-operations-entra-id-setup](../includes/iot-operations-entra-id-setup.md)]
3333

@@ -37,13 +37,12 @@ A camera connected to your network and accessible from your Azure IoT Operations
3737

3838
[!INCLUDE [deploy-preview-media-connectors](../includes/deploy-preview-media-connectors.md)]
3939

40-
> [!IMPORTANT]
41-
> If you don't enable preview features, you see the following error message in the `aio-supervisor-...` pod logs when you try to use the media or ONVIF connectors: `No connector configuration present for AssetEndpointProfile: <AssetEndpointProfileName>`.
42-
4340
## Create a device
4441

4542
To configure the media connector, first create a device that defines the connection to the media source. The device includes the URL of the media source and any credentials you need to access the media source:
4643

44+
# [Operations experience](#tab/portal)
45+
4746
1. In the operations experience web UI, select **Devices** in the left navigation pane. Then select **Create new**.
4847

4948
1. Enter a name for your device, such as `media-connector`. To add the endpoint for the media connector, select **New** on the **Microsoft.Media** tile.
@@ -64,9 +63,25 @@ To configure the media connector, first create a device that defines the connect
6463

6564
:::image type="content" source="media/howto-use-media-connector/media-connector-device-created.png" alt-text="Screenshot that shows the list of devices." lightbox="media/howto-use-media-connector/media-connector-device-created.png":::
6665

66+
# [Azure CLI](#tab/cli)
67+
68+
Run the following commands:
69+
70+
```azurecli
71+
az iot ops ns device create -n media-connector-cli -g {your resource group name} --instance {your instance name}
72+
73+
az iot ops ns device endpoint inbound add media --device media-connector-cli -g {your resource group name} -i {your instance name} --name media-connector-cli-0 --endpoint-address "rtsp://samplecamera:554/stream1"
74+
```
75+
76+
To learn more, see [az iot ops ns device](/cli/azure/iot/ops/ns/device).
77+
78+
---
79+
6780
## Create an asset to publish an image snapshot
6881

69-
To define a namespace asset that publishes an image snapshot from the media source, follow these steps:
82+
To define a namespace asset that publishes an image snapshot from the media source to the MQTT broker:
83+
84+
# [Operations experience](#tab/portal)
7085

7186
1. In the operations experience web UI, select **Assets** in the left navigation pane. Then select **Create namespace asset**.
7287

@@ -78,7 +93,7 @@ To define a namespace asset that publishes an image snapshot from the media sour
7893

7994
1. On the **Streams** page, select **Add stream** to add a stream for the asset.
8095

81-
1. Add a name for the stream, such as `mysnapshots`. Set MQTT as the destination and add a name for the MQTT topic to publish to such as `mysnapshots`. Select `mqtt-to-snapshot` as the task type.
96+
1. Add a name for the stream, such as `mysnapshots`. Set MQTT as the destination and add a name for the MQTT topic to publish to such as `mysnapshots`. Select `snapshot-to-mqtt` as the task type.
8297

8398
:::image type="content" source="media/howto-use-media-connector/add-snapshot-stream.png" alt-text="Screenshot that shows how to add a snapshot stream." lightbox="media/howto-use-media-connector/add-snapshot-stream.png":::
8499

@@ -88,10 +103,24 @@ To define a namespace asset that publishes an image snapshot from the media sour
88103

89104
1. On the **Review** page, review the details of the asset and select **Create** to create the asset.
90105

106+
# [Azure CLI](#tab/cli)
107+
108+
Run the following command:
109+
110+
```azurecli
111+
az iot ops ns asset media create --name mymediaasset --instance {your instance name} -g {your resource group name} --device media-connector-cli --endpoint media-connector-cli-0 --task-type snapshot-to-mqtt --task-format jpeg --snapshots-per-sec 0.25 --stream-dest topic="azure-iot-operations/data/snapshots" qos=Qos1 retain=Never ttl=60
112+
```
113+
114+
To learn more, see [az iot ops ns asset rest](/cli/azure/iot/ops/ns/asset/rest).
115+
116+
---
117+
91118
## Add a stream to save a video clip
92119

93120
In this section, you add a stream to the asset that saves video clips from the media source to the file system.
94121

122+
# [Operations experience](#tab/portal)
123+
95124
1. In the operations experience web UI, select **Assets** in the left navigation pane. Then select the `my-media-source` asset you created in the previous section.
96125

97126
1. Select **Streams** and then select **Add stream** to add a stream to the asset.
@@ -105,3 +134,13 @@ In this section, you add a stream to the asset that saves video clips from the m
105134
1. The new stream is listed in the asset's **Streams** page:
106135

107136
:::image type="content" source="media/howto-use-media-connector/media-connector-streams.png" alt-text="Screenshot that shows the list of streams for the media connector asset." lightbox="media/howto-use-media-connector/media-connector-streams.png":::
137+
138+
# [Azure CLI](#tab/cli)
139+
140+
Run the following command:
141+
142+
```azurecli
143+
az iot ops ns asset media stream add --asset mymediaasset --instance {your instance name} -g {your resource group name} --name clipStream --task-type clip-to-fs --format mp4 --duration 30 --path /data/clips
144+
```
145+
146+
---

articles/iot-operations/discover-manage-assets/overview-media-connector.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,18 @@ The media connector can connect to various sources, including:
2626
| Media file | `http://camera1/snapshot/profile1`<br/>`nfs://server/path/file.extension`<br/>` file://localhost/media/path/file.mkv` | Any media file with a URL accessible from the cluster. |
2727
| Media folder | `file://host/path/to/folder/`<br/>`ftp://server/path/to/folder/` | A folder, accessible from the cluster, that contains media files such as snapshots or clips. |
2828

29+
## Task types
30+
31+
The media connector supports the following task types:
32+
33+
| Task type | Description |
34+
|-----------|-------------|
35+
| snapshot-to-mqtt | Captures a snapshot from a media source and publishes it to an MQTT topic. |
36+
| clip-to-fs | Saves a video clip from a media source to the file system. |
37+
| snapshot-to-fs | Saves a snapshot from a media source to the file system. |
38+
| stream-to-rtsp | Proxies a live video stream from a media source to an RTSP endpoint. |
39+
| stream-to-rtsps | Proxies a live video stream from a media source to an RTSPs endpoint. |
40+
2941
## Example uses
3042

3143
Example uses of the media connector include:

0 commit comments

Comments
 (0)