Run Spatial Analysis on a local video file
You can use Spatial Analysis with either recorded or live video. Use this guide to learn how to run Spatial Analysis on a recorded local video.
Prerequisites
- Set up a Spatial Analysis container by following the steps in Set up the host machine and run the container.
Analyze a video file
To use Spatial Analysis for recorded video, record a video file and save it as a .mp4 file. Then take the following steps:
Create a blob storage account in Azure, or use an existing one. Then update the following blob storage settings in the Azure portal:
- Change Secure transfer required to Disabled
- Change Allow Blob public access to Enabled
Navigate to the Container section, and either create a new container or use an existing one. Then upload the video file to the container. Expand the file settings for the uploaded file, and select Generate SAS. Be sure to set the Expiry Date long enough to cover the testing period. Set Allowed Protocols to HTTP (HTTPS is not supported).
Select on Generate SAS Token and URL and copy the Blob SAS URL. Replace the starting
https
withhttp
and test the URL in a browser that supports video playback.Replace
VIDEO_URL
in the deployment manifest for your Azure Stack Edge device, desktop machine, or Azure VM with GPU with the URL you created, for all of the graphs. SetVIDEO_IS_LIVE
tofalse
, and redeploy the Spatial Analysis container with the updated manifest. See the example below.
The Spatial Analysis module will start consuming video file and will continuously auto replay as well.
"zonecrossing": {
"operationId" : "cognitiveservices.vision.spatialanalysis-personcrossingpolygon",
"version": 1,
"enabled": true,
"parameters": {
"VIDEO_URL": "Replace http url here",
"VIDEO_SOURCE_ID": "personcountgraph",
"VIDEO_IS_LIVE": false,
"VIDEO_DECODE_GPU_INDEX": 0,
"DETECTOR_NODE_CONFIG": "{ \"gpu_index\": 0, \"do_calibration\": true }",
"SPACEANALYTICS_CONFIG": "{\"zones\":[{\"name\":\"queue\",\"polygon\":[[0.3,0.3],[0.3,0.9],[0.6,0.9],[0.6,0.3],[0.3,0.3]], \"events\": [{\"type\": \"zonecrossing\", \"config\": {\"threshold\": 16.0, \"focus\": \"footprint\"}}]}]}"
}
},
Next steps
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for