Quickstart: Detect motion and record video on edge devices
Alternatively, check out topics under Create video applications in the service.
Note
Azure Video Analyzer has been retired and is no longer available.
Azure Video Analyzer for Media is not affected by this retirement. It is now rebranded to Azure Video Indexer. Click here to read more.
This quickstart shows you how to use Azure Video Analyzer to analyze the live video feed from a (simulated) IP camera. It shows how to detect if any motion is present, and if so, record an MP4 video clip to the local file system on the edge device. The quickstart uses an Azure VM as an IoT Edge device and also uses a simulated live video stream.
Prerequisites
An Azure account that includes an active subscription. Create an account for free if you don't already have one.
Note
You will need an Azure subscription where you have access to both Contributor role, and User Access Administrator role. If you do not have the right permissions, please reach out to your account administrator to grant you those permissions.
Visual Studio Code, with the following extensions:
Tip
When you're installing the Azure IoT Tools extension, you might be prompted to install Docker. Feel free to ignore the prompt.
Set up Azure resources
The deployment process will take about 20 minutes. Upon completion, you will have certain Azure resources deployed in the Azure subscription, including:
- Video Analyzer account - This cloud service is used to register the Video Analyzer edge module, and for playing back recorded video and video analytics.
- Storage account - For storing recorded video and video analytics.
- Managed Identity - This is the user assigned managed identity used to manage access to the above storage account.
- Virtual machine - This is a virtual machine that will serve as your simulated edge device.
- IoT Hub - This acts as a central message hub for bi-directional communication between your IoT application, IoT Edge modules and the devices it manages.
In addition to the resources mentioned above, following items are also created in the 'deployment-output' file share in your storage account, for use in quickstarts and tutorials:
- appsettings.json - This file contains the device connection string and other properties needed to run the sample application in Visual Studio Code.
- env.txt - This file contains the environment variables that you will need to generate deployment manifests using Visual Studio Code.
- deployment.json - This is the deployment manifest used by the template to deploy edge modules to the simulated edge device.
Tip
If you run into issues creating all of the required Azure resources, please use the manual steps in this quickstart.
Overview
The preceding diagram shows how the signals flow in this quickstart. An edge module simulates an IP camera that hosts a Real-Time Streaming Protocol (RTSP) server. An RTSP source node pulls the video feed from this server and sends video frames to the motion detection processor node. The RTSP source sends the same video frames to a signal gate processor node, which remains closed until it's triggered by an event.
When the motion detection processor detects motion in the video, it sends an event to the signal gate processor node, triggering it. The gate opens for the configured duration of time, sending video frames to the file sink node. This sink node records the video as an MP4 file on the local file system of your edge device. The file is saved in the configured location.
In this quickstart, you will:
- Create and deploy the pipeline.
- Interpret the results.
- Clean up resources.
Set up your development environment
Get the sample code
Clone the AVA C# samples repository.
Start Visual Studio Code, and open the folder where the repo has been downloaded.
In Visual Studio Code, browse to the src/cloud-to-device-console-app folder and create a file named appsettings.json. This file contains the settings needed to run the program.
Browse to the file share in the storage account created in the setup step above, and locate the appsettings.json file under the "deployment-output" file share. Click on the file, and then hit the "Download" button. The contents should open in a new browser tab, which should look like:
{ "IoThubConnectionString" : "HostName=xxx.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=XXX", "deviceId" : "avasample-iot-edge-device", "moduleId" : "avaedge" }
The IoT Hub connection string lets you use Visual Studio Code to send commands to the edge modules via Azure IoT Hub. Copy the above JSON into the src/cloud-to-device-console-app/appsettings.json file.
Next, browse to the src/edge folder and create a file named .env. This file contains properties that Visual Studio Code uses to deploy modules to an edge device.
Browse to the file share in the storage account created in the setup step above, and locate the env.txt file under the "deployment-output" file share. Click on the file, and then hit the "Download" button. The contents should open in a new browser tab, which should look like:
SUBSCRIPTION_ID="<Subscription ID>" RESOURCE_GROUP="<Resource Group>" AVA_PROVISIONING_TOKEN="<Provisioning token>" VIDEO_INPUT_FOLDER_ON_DEVICE="/home/localedgeuser/samples/input" VIDEO_OUTPUT_FOLDER_ON_DEVICE="/var/media" APPDATA_FOLDER_ON_DEVICE="/var/lib/videoanalyzer" CONTAINER_REGISTRY_USERNAME_myacr="<your container registry username>" CONTAINER_REGISTRY_PASSWORD_myacr="<your container registry password>"
Copy the JSON from your env.txt into the src/edge/.env file.
Connect to the IoT Hub
In Visual Studio Code, set the IoT Hub connection string by selecting the More actions icon next to the AZURE IOT HUB pane in the lower-left corner. Copy the string from the src/cloud-to-device-console-app/appsettings.json file.
Note
You might be asked to provide Built-in endpoint information for the IoT Hub. To get that information, in Azure portal, navigate to your IoT Hub and look for Built-in endpoints option in the left navigation pane. Click there and look for the Event Hub-compatible endpoint under Event Hub compatible endpoint section. Copy and use the text in the box. The endpoint will look something like this:
Endpoint=sb://iothub-ns-xxx.servicebus.windows.net/;SharedAccessKeyName=iothubowner;SharedAccessKey=XXX;EntityPath=<IoT Hub name>
In about 30 seconds, refresh Azure IoT Hub in the lower-left section. You should see the edge device
avasample-iot-edge-device
, which should have the following modules deployed:- Edge Hub (module name edgeHub)
- Edge Agent (module name edgeAgent)
- Video Analyzer (module name avaedge)
- RTSP simulator (module name rtspsim)
Prepare to monitor the modules
When you use run this quickstart or tutorial, events will be sent to the IoT Hub. To see these events, follow these steps:
Open the Explorer pane in Visual Studio Code, and look for Azure IoT Hub in the lower-left corner.
Expand the Devices node.
Right-click on
avasample-iot-edge-device
, and select Start Monitoring Built-in Event Endpoint.Note
You might be asked to provide Built-in endpoint information for the IoT Hub. To get that information, in Azure portal, navigate to your IoT Hub and look for Built-in endpoints option in the left navigation pane. Click there and look for the Event Hub-compatible endpoint under Event Hub compatible endpoint section. Copy and use the text in the box. The endpoint will look something like this:
Endpoint=sb://iothub-ns-xxx.servicebus.windows.net/;SharedAccessKeyName=iothubowner;SharedAccessKey=XXX;EntityPath=<IoT Hub name>
An Azure account that includes an active subscription. Create an account for free if you don't already have one.
Note
You will need an Azure subscription where you have access to both Contributor role, and User Access Administrator role. If you do not have the right permissions, please reach out to your account administrator to grant you those permissions.
Visual Studio Code, with the following extensions:
-
Tip
When you're installing the Azure IoT Tools extension, you might be prompted to install Docker. Feel free to ignore the prompt.
Set up Azure resources
The deployment process will take about 20 minutes. Upon completion, you will have certain Azure resources deployed in the Azure subscription, including:
- Video Analyzer account - This cloud service is used to register the Video Analyzer edge module, and for playing back recorded video and video analytics.
- Storage account - For storing recorded video and video analytics.
- Managed Identity - This is the user assigned managed identity used to manage access to the above storage account.
- Virtual machine - This is a virtual machine that will serve as your simulated edge device.
- IoT Hub - This acts as a central message hub for bi-directional communication between your IoT application, IoT Edge modules and the devices it manages.
In addition to the resources mentioned above, following items are also created in the 'deployment-output' file share in your storage account, for use in quickstarts and tutorials:
- appsettings.json - This file contains the device connection string and other properties needed to run the sample application in Visual Studio Code.
- env.txt - This file contains the environment variables that you will need to generate deployment manifests using Visual Studio Code.
- deployment.json - This is the deployment manifest used by the template to deploy edge modules to the simulated edge device.
Tip
If you run into issues creating all of the required Azure resources, please use the manual steps in this quickstart.
Overview
The preceding diagram shows how the signals flow in this quickstart. An edge module simulates an IP camera that hosts a Real-Time Streaming Protocol (RTSP) server. An RTSP source node pulls the video feed from this server and sends video frames to the motion detection processor node. The RTSP source sends the same video frames to a signal gate processor node, which remains closed until it's triggered by an event.
When the motion detection processor detects motion in the video, it sends an event to the signal gate processor node, triggering it. The gate opens for the configured duration of time, sending video frames to the file sink node. This sink node records the video as an MP4 file on the local file system of your edge device. The file is saved in the configured location.
In this quickstart, you will:
- Create and deploy the pipeline.
- Interpret the results.
- Clean up resources.
Set up your development environment
Get the sample code
Clone the AVA Python samples repository.
Start Visual Studio Code, and open the folder where the repo has been downloaded.
In Visual Studio Code, browse to the src/cloud-to-device-console-app folder and create a file named appsettings.json. This file contains the settings needed to run the program.
Browse to the file share in the storage account created in the setup step above, and locate the appsettings.json file under the "deployment-output" file share. Click on the file, and then hit the "Download" button. The contents should open in a new browser tab, which should look like:
{ "IoThubConnectionString": "HostName=xxx.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=XXX", "deviceId": "avasample-iot-edge-device", "moduleId": "avaedge" }
The IoT Hub connection string lets you use Visual Studio Code to send commands to the edge modules via Azure IoT Hub. Copy the above JSON into the src/cloud-to-device-console-app/appsettings.json file.
Next, browse to the src/edge folder and create a file named .env. This file contains properties that Visual Studio Code uses to deploy modules to an edge device.
Browse to the file share in the storage account created in the setup step above, and locate the env.txt file under the "deployment-output" file share. Click on the file, and then hit the "Download" button. The contents should open in a new browser tab, which should look like:
SUBSCRIPTION_ID="<Subscription ID>" RESOURCE_GROUP="<Resource Group>" AVA_PROVISIONING_TOKEN="<Provisioning token>" VIDEO_INPUT_FOLDER_ON_DEVICE="/home/localedgeuser/samples/input" VIDEO_OUTPUT_FOLDER_ON_DEVICE="/var/media" APPDATA_FOLDER_ON_DEVICE="/var/lib/videoanalyzer" CONTAINER_REGISTRY_USERNAME_myacr="<your container registry username>" CONTAINER_REGISTRY_PASSWORD_myacr="<your container registry password>"
Copy the JSON from your env.txt into the src/edge/.env file.
Connect to the IoT Hub
In Visual Studio Code, set the IoT Hub connection string by selecting the More actions icon next to the AZURE IOT HUB pane in the lower-left corner. Copy the string from the src/cloud-to-device-console-app/appsettings.json file.
Note
You might be asked to provide Built-in endpoint information for the IoT Hub. To get that information, in Azure portal, navigate to your IoT Hub and look for Built-in endpoints option in the left navigation pane. Click there and look for the Event Hub-compatible endpoint under Event Hub compatible endpoint section. Copy and use the text in the box. The endpoint will look something like this:
Endpoint=sb://iothub-ns-xxx.servicebus.windows.net/;SharedAccessKeyName=iothubowner;SharedAccessKey=XXX;EntityPath=<IoT Hub name>
In about 30 seconds, refresh Azure IoT Hub in the lower-left section. You should see the edge device
avasample-iot-edge-device
, which should have the following modules deployed:- Edge Hub (module name edgeHub)
- Edge Agent (module name edgeAgent)
- Video Analyzer (module name avaedge)
- RTSP simulator (module name rtspsim)
Prepare to monitor the modules
When you use run this quickstart or tutorial, events will be sent to the IoT Hub. To see these events, follow these steps:
Open the Explorer pane in Visual Studio Code, and look for Azure IoT Hub in the lower-left corner.
Expand the Devices node.
Right-click on
avasample-iot-edge-device
, and select Start Monitoring Built-in Event Endpoint.Note
You might be asked to provide Built-in endpoint information for the IoT Hub. To get that information, in Azure portal, navigate to your IoT Hub and look for Built-in endpoints option in the left navigation pane. Click there and look for the Event Hub-compatible endpoint under Event Hub compatible endpoint section. Copy and use the text in the box. The endpoint will look something like this:
Endpoint=sb://iothub-ns-xxx.servicebus.windows.net/;SharedAccessKeyName=iothubowner;SharedAccessKey=XXX;EntityPath=<IoT Hub name>
Review the sample video
As you set up the Azure resources for this quickstart, a short video of a parking lot is copied to the Linux VM in Azure that's used as the IoT Edge device. This video file will be used to simulate a live stream for this tutorial.
Open an application like VLC media player, select Ctrl+N, and paste this link to the parking lot video to start playback. At about the 5-second mark, a white car moves through the parking lot.
Complete the following steps to use Video Analyzer to detect the motion of the car and record a video clip starting around the 5-second mark.
Examine and edit the sample files
As part of the prerequisites, you downloaded the sample code to a folder. Follow these steps to examine and edit the sample files.
In Visual Studio Code, go to src/edge. You see your .env file and a few deployment template files.
The deployment template refers to the deployment manifest for the edge device. It includes some placeholder values. The .env file includes the values for those variables.
Go to the src/cloud-to-device-console-app folder. Here you see your appsettings.json file and a few other files:
c2d-console-app.csproj - The project file for Visual Studio Code.
operations.json - A list of the operations that you want the program to run.
Program.cs - The sample program code. This code:
- Loads the app settings.
- Invokes direct methods that the Video Analyzer edge module exposes.
- Pauses so that you can examine the program's output in the TERMINAL window and examine the events that were generated by the module in the OUTPUT window.
- Invokes direct methods to clean up resources.
Edit the operations.json file:
- Change the link to the pipeline:
"pipelineTopologyUrl" : "https://raw.githubusercontent.com/Azure/video-analyzer/main/pipelines/live/topologies/evr-motion-file-sink/topology.json"
- Under livePipelineSet, edit the name of the pipeline topology to match the value in the preceding link:
"topologyName" : "EVRToFilesOnMotionDetection"
- Under PipelineTopologyDelete, edit the name:
"name": "EVRToFilesOnMotionDetection"
- Change the link to the pipeline:
As part of the prerequisites, you downloaded the sample code to a folder. Follow these steps to examine and edit the sample files.
In Visual Studio Code, go to src/edge. You see your .env file and a few deployment template files.
The deployment template refers to the deployment manifest for the edge device. It includes some placeholder values. The .env file includes the values for those variables.
Go to the src/cloud-to-device-console-app folder. Here you see your appsettings.json file and a few other files:
c2d-console-app.csproj - The project file for Visual Studio Code.
operations.json - A list of the operations that you want the program to run.
main.py - The sample program code. This code:
- Loads the app settings.
- Invokes direct methods that the Azure Video Analyzer module exposes.
- Pauses so that you can examine the program's output in the TERMINAL window and examine the events that were generated by the module in the OUTPUT window.
- Invokes direct methods to clean up resources.
Edit the operations.json file:
- Change the link to the pipeline:
"pipelineTopologyUrl" : "https://raw.githubusercontent.com/Azure/video-analyzer/main/pipelines/live/topologies/evr-motion-file-sink/topology.json"
- Under livePipelineSet, edit the name of the pipeline topology to match the value in the preceding link:
"topologyName" : "EVRToFilesOnMotionDetection"
- Under PipelineTopologyDelete, edit the name:
"name": "EVRToFilesOnMotionDetection"
- Change the link to the pipeline:
Generate and deploy the deployment manifest
The deployment manifest defines what modules are deployed to an edge device. It also defines configuration settings for those modules.
Follow these steps to generate the manifest from the template file and then deploy it to the edge device.
Open Visual Studio Code.
Next to the AZURE IOT HUB pane, select the More actions icon to set the IoT Hub connection string. You can copy the string from the src/cloud-to-device-console-app/appsettings.json file.
Note
You might be asked to provide Built-in endpoint information for the IoT Hub. To get that information, in Azure portal, navigate to your IoT Hub and look for Built-in endpoints option in the left navigation pane. Click there and look for the Event Hub-compatible endpoint under Event Hub compatible endpoint section. Copy and use the text in the box. The endpoint will look something like this:
Endpoint=sb://iothub-ns-xxx.servicebus.windows.net/;SharedAccessKeyName=iothubowner;SharedAccessKey=XXX;EntityPath=<IoT Hub name>
Right-click src/edge/deployment.template.json and select Generate IoT Edge Deployment Manifest.
This action should create a manifest file named deployment.amd64.json in the src/edge/config folder.
Right-click src/edge/config/deployment.amd64.json, select Create Deployment for Single Device, and then select the name of your edge device.
When you're prompted to select an IoT Hub device, choose avasample-iot-edge-device from the drop-down menu.
After about 30 seconds, in the lower-left corner of the window, refresh Azure IoT Hub. The edge device now shows the following deployed modules:
- Video Analyzer edge module (module name
avaedge
) - Real-Time Streaming Protocol (RTSP) simulator (module name
rtspsim
)
- Video Analyzer edge module (module name
The deployment manifest defines what modules are deployed to an edge device. It also defines configuration settings for those modules.
Follow these steps to generate the manifest from the template file and then deploy it to the edge device.
Open Visual Studio Code.
Next to the AZURE IOT HUB pane, select the More actions icon to set the IoT Hub connection string. You can copy the string from the src/cloud-to-device-console-app/appsettings.json file.
Note
You might be asked to provide Built-in endpoint information for the IoT Hub. To get that information, in Azure portal, navigate to your IoT Hub and look for Built-in endpoints option in the left navigation pane. Click there and look for the Event Hub-compatible endpoint under Event Hub compatible endpoint section. Copy and use the text in the box. The endpoint will look something like this:
Endpoint=sb://iothub-ns-xxx.servicebus.windows.net/;SharedAccessKeyName=iothubowner;SharedAccessKey=XXX;EntityPath=<IoT Hub name>
Right-click src/edge/deployment.template.json and select Generate IoT Edge Deployment Manifest.
This action should create a manifest file named deployment.amd64.json in the src/edge/config folder.
Right-click src/edge/config/deployment.amd64.json, select Create Deployment for Single Device, and then select the name of your edge device.
When you're prompted to select an IoT Hub device, choose avasample-iot-edge-device from the drop-down menu.
After about 30 seconds, in the lower-left corner of the window, refresh Azure IoT Hub. The edge device now shows the following deployed modules:
- Azure Video Analyzer (module name
avaedge
) - Real-Time Streaming Protocol (RTSP) simulator (module name
rtspsim
)
- Azure Video Analyzer (module name
Run the sample program
In Visual Studio Code, open the Extensions tab (or press Ctrl+Shift+X) and search for Azure IoT Hub.
Right-click and select Extension Settings.
Search and enable “Show Verbose Message”.
To start a debugging session, select the F5 key. You see messages printed in the TERMINAL window.
- Navigate to the
TERMINAL
window in VS Code - Use the cd command to navigate to /video-analyzer-iot-edge-python-main/src/cloud-to-device-console-app directory
- Run "python main.py" then you will see messages printed in the
TERMINAL
window
- Navigate to the
The operations.json code calls the direct methods
pipelineTopologyList
andlivePipelineList
. If you cleaned up resources after previous quickstarts, then this process will return empty lists and then pause. Press the Enter key.-------------------------------------------------------------------------- Executing operation pipelineTopologyList ----------------------- Request: pipelineTopologyList -------------------------------------------------- { "@apiVersion": "1.1" } --------------- Response: pipelineTopologyList - Status: 200 --------------- { "value": [] } -------------------------------------------------------------------------- Executing operation WaitForInput Press Enter to continue
The TERMINAL window shows the next set of direct method calls:
A call to
pipelineTopologySet
that uses the pipelineTopologyUrlA call to
livePipelineSet
that uses the following body:{ "@apiVersion": "1.1", "name": "Sample-Pipeline-1", "properties": { "topologyName": "EVRToFilesOnMotionDetection", "description": "Sample pipeline description", "parameters": [ { "name": "rtspUrl", "value": "rtsp://rtspsim:554/media/camera-300s.mkv" }, { "name": "rtspUserName", "value": "testuser" }, { "name": "rtspPassword", "value": "testpassword" } ] } }
A call to
livePipelineActivate
that starts the live pipeline and the flow of video.A second call to
livePipelineList
that shows that the live pipeline is in the running state.
The output in the TERMINAL window pauses at Press Enter to continue. Don't select Enter yet. Scroll up to see the JSON response payloads for the direct methods that you invoked.
Switch to the OUTPUT window in Visual Studio Code. You see the messages that the Video Analyzer edge module is sending to the IoT hub. The following section of this quickstart discusses these messages.
The pipeline topology continues to run and print results. The RTSP simulator keeps looping the source video. To stop the pipeline topology, return to the TERMINAL window and select Enter.
The next series of calls cleans up the resources:
- A call to
livePipelineDeactivate
deactivates the live pipeline. - A call to
livePipelineDelete
deletes the live pipeline. - A call to
pipelineTopologyDelete
deletes the topology. - A final call to
pipelineTopologyList
shows that the list is now empty.
Interpret results
When you run the pipeline topology, the results from the motion detector processor node pass through the IoT Hub sink node to the IoT hub. The messages you see in the OUTPUT window of Visual Studio Code contain a body section and an applicationProperties section. For more information, see Create and read IoT Hub messages.
In the following messages, the Video Analyzer edge module defines the application properties and the content of the body.
MediaSessionEstablished event
When a pipeline topology is instantiated, the RTSP source node attempts to connect to the RTSP server that runs on the rtspsim-live555 container. If the connection succeeds, the following event is printed.
[IoTHubMonitor] [9:42:18 AM] Message received from [ava-sample-device/avaadge]:
{
"body": {
"sdp": "SDP:\nv=0\r\no=- 1586450538111534 1 IN IP4 XXX.XX.XX.XX\r\ns=Matroska video+audio+(optional)subtitles, streamed by the LIVE555 Media Server\r\ni=media/camera-300s.mkv\r\nt=0 0\r\na=tool:LIVE555 Streaming Media v2020.03.06\r\na=type:broadcast\r\na=control:*\r\na=range:npt=0-300.000\r\na=x-qt-text-nam:Matroska video+audio+(optional)subtitles, streamed by the LIVE555 Media Server\r\na=x-qt-text-inf:media/camera-300s.mkv\r\nm=video 0 RTP/AVP 96\r\nc=IN IP4 0.0.0.0\r\nb=AS:500\r\na=rtpmap:96 H264/90000\r\na=fmtp:96 packetization-mode=1;profile-level-id=4D0029;sprop-parameter-sets=XXXXXXXXXXXXXXXXXXXXXX\r\na=control:track1\r\n"
},
"applicationProperties": {
"dataVersion": "1.0",
"topic": "/subscriptions/{subscriptionID}/resourceGroups/{name}/providers/microsoft.media/videoanalyzers/{ava-account-name}",
"subject": "/edgeModules/avaedge/livePipelines/Sample-Pipeline-1/sources/rtspSource",
"eventType": "Microsoft.VideoAnalyzers.Diagnostics.MediaSessionEstablished",
"eventTime": "2021-04-09T09:42:18.1280000Z"
}
}
In the preceding output:
- The message is a diagnostics event, MediaSessionEstablished. It indicates that the RTSP source node (the subject) established a connection with the RTSP simulator and has begun to receive a (simulated) live feed.
- In applicationProperties, subject references the node in the pipeline topology from which the message was generated. In this case, the message originates from the RTSP source node.
- In applicationProperties, eventType indicates that this event is a diagnostics event.
- The eventTime value is the time when the event occurred.
- The body section contains data about the diagnostics event. In this case, the data comprises the Session Description Protocol (SDP) details.
RecordingStarted event
When motion is detected, the signal gate processor node is activated, and the file sink node in the pipeline topology starts to the write an MP4 file. The file sink node sends an operational event. The type is set to motion to indicate that it's a result from the motion detection processor. The eventTime value is the UTC time at which the motion occurred. For more information about this process, see the overview section in this quickstart.
Here's an example of this message:
[IoTHubMonitor] [05:37:27 AM] Message received from [avasample-iot-edge-device/avaedge]:
{
"body": {
"outputType": "filePath",
"outputLocation": "/var/media/sampleFilesFromEVR-filesinkOutput-20210511T053726Z.mp4"
},
"applicationProperties": {
"topic": "/subscriptions/{subscriptionID}/resourceGroups/{resource-group-name}/providers/microsoft.media/videoAnalyzers/{ava-account-name}",
"subject": "/edgeModules/avaedge/livePipelines/Sample-Pipeline-1/sinks/fileSink",
"eventType": "Microsoft.VideoAnalyzer.Operational.RecordingStarted",
"eventTime": "2021-05-11T05:37:27.713Z",
"dataVersion": "1.0"
}
}
In the preceding message:
- In applicationProperties, subject references the node in the pipeline from which the message was generated. In this case, the message originates from the file sink node.
- In applicationProperties, eventType indicates that this event is operational.
- The eventTime value is the time when the event occurred. This time is 5 to 6 seconds after MediaSessionEstablished and after video starts to flow. This time corresponds to the 5-to-6-second mark when the car started to move into the parking lot.
- The body section contains data about the operational event. In this case, the data comprises outputType and outputLocation.
- The outputType variable indicates that this information is about the file path.
- The outputLocation value is the location of the MP4 file in the edge module.
RecordingStopped and RecordingAvailable events
If you examine the properties of the signal gate processor node in the pipeline topology, you see that the activation times are set to 5 seconds. So about 5 seconds after the RecordingStarted event is received, you get:
- A RecordingStopped event, indicating that the recording has stopped.
- A RecordingAvailable event, indicating that the MP4 file can now be used for viewing.
The two events are typically emitted within seconds of each other.
Play the MP4 clip
The MP4 files are written to a directory on the edge device that you configured in the .env file by using the VIDEO_OUTPUT_FOLDER_ON_DEVICE key. If you used the default value, then the results should be in the /var/media/ folder.
To play the MP4 clip:
Go to your resource group, find the VM, and then connect to the VM.
Sign in by using the credentials that were generated when you set up your Azure resources.
At the command prompt, go to the relevant directory. The default location is /var/media. You should see the MP4 files in the directory.
Use Secure Copy (SCP) to copy the files to your local machine.
Play the files by using VLC media player or any other MP4 player.
Clean up resources
If you intend to try the other quickstarts, then keep the resources you created. Otherwise, in the Azure portal, go to your resource groups, select the resource group where you ran this quickstart, and then delete all of the resources.
Next steps
Follow Quickstart: Analyze a live video feed from a (simulated) IP camera using your own HTTP model to apply AI to live video feeds.
Review additional challenges for advanced users:
- Use an IP camera that supports RTSP instead of using the RTSP simulator. You can find IP cameras that support RTSP on the ONVIF conformant products page. Look for devices that conform with profiles G, S, or T.
- Use an AMD64 or x64 Linux device rather than using a Linux VM in Azure. This device must be in the same network as the IP camera. Follow the instructions in Install Azure IoT Edge runtime on Linux. Then follow the instructions in Deploy your first IoT Edge module to a virtual Linux device register the device with Azure IoT Hub.