Microsoft Azure Video Indexer
Last updated: Sep-02-2024
Cloudinary is a cloud-based service that provides an end-to-end image and video management solution including uploads, storage, transformations, optimizations and delivery. Cloudinary's video solution includes a rich set of video transformation capabilities, including cropping, overlays, optimizations, and a large variety of special effects.
The Microsoft Azure Video Indexer add-on integrates Microsoft Azure's automatic video indexing capabilities with Cloudinary's complete video management and transformation pipeline.
Cloudinary has currently integrated the following Microsoft Azure Video Indexing services:
- Video categorization: Identifies visual objects, brands and actions displayed. Extends Cloudinary's powerful semantic data extraction and tagging features, so that your videos can be automatically tagged according to the automatically detected categories and tags in each video.
- Video transcription: Automatically generate speech-to-text transcripts of videos that you or your users upload to your Cloudinary product environment. The add-on supports transcribing videos in almost any language. You can also use the contents of returned transcript files to display the transcript of your video on your page, making your content more skimmable, accessible, and SEO-friendly.
Getting started
Before you can use the Microsoft Azure Video Indexer add-on:
You must have a Cloudinary account. If you don't already have one, you can sign up for a free account.
Register for the add-on: make sure you're logged in to your account and then go to the Add-ons page. For more information about add-on registrations, see Registering for add-ons.
Keep in mind that many of the examples on this page use our SDKs. For SDK installation and configuration details, see the relevant SDK guide.
If you are new to Cloudinary, you may want to take a look at How to integrate Cloudinary in your app for a walk through on the basics of creating and setting up your account, working with SDKs, and then uploading, transforming and delivering assets.
Video categorization
Take a look at the following video of a dog called jack
:
By setting the categorization
parameter to azure_video_indexer
when calling Cloudinary's upload or update method, Microsoft is used to automatically classify the scenes of the uploaded or specified existing video. For example:
- You can use upload presets to centrally define a set of upload options including add-on operations to apply, instead of specifying them in each upload call. You can define multiple upload presets, and apply different presets in different upload scenarios. You can create new upload presets in the Upload page of the Console Settings or using the upload_presets Admin API method. From the Upload page of the Console Settings, you can also select default upload presets to use for image, video, and raw API uploads (respectively) as well as default presets for image, video, and raw uploads performed via the Media Library UI.
Learn more: Upload presets
- You can run multiple categorization add-ons on the resource. The
categorization
parameter accepts a comma-separated list of all the Cloudinary categorization add-ons to run on the resource.
The video analysis and categorization is performed asynchronously after the method call is completed.
notification_url
parameter in your request to get a notification to the requested URL when the categorization is ready.The response of the upload method indicates that the process is in pending
status.
Once the categorization process completes, the information is returned to Cloudinary and stored with your video. The details of the analysis and categorization are also sent to the notification_url
if this option was included with your method call. For example:
The information includes the automatic tagging and categorization information identified by the Microsoft Azure Video Indexer add-on. As can be seen in the example snippet above, various labels (tags) were automatically detected in the uploaded video. Each label is listed together with other information including the start and end times of the relevant video segment. The confidence
score is a numerical value that represents the confidence level of the detected label, where 1.0 means 100% confidence.
Automatically adding tags to videos
Automatically categorizing your videos is a useful way to organize your Cloudinary media assets. By providing the auto_tagging
parameter in an upload
or update
call for any video where azure_video_indexer
was run, the video is automatically assigned tags based on the detected scene labels and brands. The auto_tagging
parameter represents the minimum confidence score required for automatic assignment as a resource tag. Assigning these resource tags allows you to list and search videos using Cloudinary's API or Web interface.
The following code example automatically tags an uploaded video with all detected scene labels and brands that have a confidence score higher than 0.6.
The response of the upload call above returns the detected categorization as well as automatically assigning tags. In this case:
Tagging uploaded videos
You can also use the update
method to apply auto tagging to already uploaded videos, based on their public IDs, and then automatically tag them according to the detected categories.
For example, the following video was uploaded to Cloudinary with the 'horses' public ID:
The following code sample uses Cloudinary's update
method to apply automatic video tagging and categorization to the sample
uploaded video, and then automatically assign resource tags based on the categories detected with over a 60% confidence level.
notification_url
to get a response om the analysis, you can always use the Admin API's resource method to return the details of a resource, including the categorization that you already extracted using the upload
or update
methods.Video transcription
You can request an auto-generated transcript for your video or audio file in one or more languages.
To request a transcript (in the default US English language), include the raw_convert
parameter with the value azure_video_indexer
in your upload
or update
call.
(To request other languages, see transcription languages below.)
For example, to request transcription on the introduction to a video tutorial on folder permissions (see the full tutorial here):
Learn more: Upload presets
The azure_video_indexer
parameter value activates a call to the Microsoft Azure Video Indexer API, which is performed asynchronously after your original method call is completed. Thus your original method call response displays a pending
status:
When the azure_video_indexer
asynchronous request is complete (depending on the length of the video), a new raw
file is created in your product environment with the same public ID as your video or audio file and with the en-us.azure.transcript
file extension. You can additionally request a standard subtitle format such as 'vtt' or 'srt'. For details on the contents of the generated file, see Cloudinary transcript files below.
If you also provided a notification_url
in your method call or have defined a global notification URL in the Console, the specified URL receives a notification when the indexing process completes:
Cloudinary transcript files
The created .transcript
file includes details of the audio transcription, for example:
Each excerpt of text has a confidence
value, and a breakdown of specific start and end times.
Generating standard srt or vtt transcripts
If you want to include the transcript as a separate track for a video player, you can also request that cloudinary create an SRT and/or WebVTT raw file by including the srt
and/or vtt
qualifiers (separated by a colon) with the azure_video_indexer
value. For example, to upload a video and also request both srt
and vtt
files with the transcript:
When the request completes, there will be 4 files associated with the uploaded video in your product environment:
- If you also specify one or more languages in the
azure_video_indexer
transcript request:
- the request for subtitle formats must be specified before the languages (e.g.,azure_video_indexer:srt:vtt:fr-FR
)
- the generated files will include the language and region code in the generated filename (e.g.,folder-permissions-tutorial.fr-FR.azure.transcript.vtt
). - No speech recognition tool is 100% accurate. If exact accuracy is important for your video, you can download the generated
.transcript
,.srt
or.vtt
file, edit them manually, and re-upload them (overwriting the original files).
Transcription languages
By default, the Azure Video Indexer add-on assumes the audio in your audio/video source file is in US English. If the audio is in any other language, you must specify a source language in your request.
You can also optionally request to get additional translated transcripts in other languages.
Specifying the source language
To indicate the source language, add both the language and region code to the raw_convert
value (e.g., azure_video_indexer:fr-FR
). The resulting transcript file will always be generated in the same language, and the generated index file will include the language code in the name ({public_id}.{lang-code}.azure.transcript
).
For a full list of supported source languages and region codes, scroll to the language section of the Azure Video Indexer upload options.
For example, to request a video transcript in French when uploading the video Paris.mp4
:
Auto-detecting the source language
If you're not sure which language video or audio files might have been recorded in, you can pass auto
as the source language, This instructs the Azure Video Indexer add-on to auto-detect the language based on the first few spoken words in the file. As with specified languages, the resulting transcript filename will include the language and region code.
Requesting additional transcript languages
The Azure Video Indexer add-on will always generate the transcript into the language requested as the source language. But you can optionally request additional transcripts in other languages, specifying the target languages immediately after the source language, separated by colons.
For example, if you specify: raw_convert: "azure_video_indexer:fr-FR:pl-PL:he-IL:et-EE
The add-on first indexes the audio in your audio or video file based on French as the source language and generates the French transcript file. It then generates translated transcripts in Polish, Hebrew, and Estonian.
- The first file you specify must be the language and region of the audio in the source file. The supported languages are those listed in the language section of the Azure Video Indexer upload options
- For the additional translated transcript files, you can specify any language-region code listed in the language section of of the Azure Video Indexer Index options. This list contains all languages supported for the source file, as well as some additional options.
- When specifying multiple languages, auto is not supported for the source language.
- You can specify a maximum of 5 languages (including the source language).
- Even if US English is the source language, make sure to specify it as the source language.
- If also requesting srt or vtt transcript formats, those must be specified before the the languages (e.g.,
azure_video_indexer:srt:vtt:en-US:fr-FR
)
- the generated files will include the language and region code in the generated filename (e.g.,folder-permissions-tutorial.fr-FR.azure.transcript.vtt
). - When requesting multiple languages, you'll be charged units from your add-on quota for each indexing language specified according to the length of the audio in the source file.
Displaying transcripts as subtitle overlays
Cloudinary can automatically generate subtitles from the returned transcripts. To automatically embed subtitles with your video, add the subtitles
property of the overlay
parameter (l_subtitles
in URLs), followed by the public ID to the raw transcript file (including the extension).
For example, the following URL delivers the video with automatically generated subtitles:
As with any subtitle overlay, you can use transformation parameters to make a variety of formatting adjustments when you overlay an automatically generated transcript file, including choice of font, font size, fill, outline color, and gravity.
For example, these subtitles are displayed using the Times font, size 20, in a blue color, and located on the top of the screen (north):
Subtitle length and confidence levels
Microsoft returns transcript excerpts of varying lengths. When displaying subtitles, long excerpts are automatically divided into 20 word entities and displayed on two lines.
You can also optionally set a minimum confidence level for your subtitles, for example: l_subtitles:my-video-id.en-us.azure.transcript:90
. In this case, any excerpt that Microsoft returns with a lower confidence value will be omitted from the subtitles. Keep in mind that in some cases, this may exclude several sentences at once.
Displaying transcripts as a separate track
Instead of embedding a transcript in your video as an overlay, you can alternatively add returned vtt or srt transcript files as a separate track for a video player. This way, the subtitles can be controlled (toggled on/off) separately from the video itself. For example, to add the video and transcript sources for an HTML5 video player:
textTracks
parameter.