Skip to content

Commit 33cff1f

Browse files
authored
video Indexer in auto-clipper MMI-3401 (#2550)
* Update .gitignore to include additional media file types and output directories for auto-clipper harness * Enhance .env.sample for Auto Clipper * Add Video Indexer support to AutoClipper Harness - Introduced VideoIndexerClient for handling video uploads and transcript extraction with speaker identification. - Added VideoIndexerRequest class for configuring transcription requests. - Enhanced Program.cs to support Azure Video Indexer as a provider, including error handling for output directory creation. - Updated README.md with new configuration options and output details. - Implemented TranscriptSegment for managing transcript segments with optional speaker identification. - Improved transcript handling to include speaker labels when enabled. * feat(auto-clipper): extend TimestampedTranscript with speaker info * feat(auto-clipper): add Video Indexer configuration options * feat(auto-clipper): implement Azure Video Indexer client * feat(auto-clipper): integrate Video Indexer into transcription pipeline * feat(auto-clipper): add speaker prefix to transcript output * feat(auto-clipper): add CHAN station config with Video Indexer * fix(auto-clipper): strip markdown code fences from LLM response * feat(auto-clipper): update CHAN station config * docs(auto-clipper): update README to reflect changes in transcription providers and configuration options * feat(auto-clipper): add Azure Video Indexer configuration to deployment and overlays * lint fix * update readme * docs(auto-clipper): enhance README with detailed API Key and ARM authentication instructions * feat(auto-clipper): implement ARM authentication support for Azure Video Indexer * feat(auto-clipper): add Azure Video Indexer secret keys to deployment and update README
1 parent f5d65cc commit 33cff1f

30 files changed

Lines changed: 1665 additions & 90 deletions

openshift/kustomize/services/auto-clipper/base/config-map.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ data:
2222
CHES_EMAIL_ENABLED: "true"
2323
CHES_EMAIL_AUTHORIZED: "true"
2424
LLM_API_URL: "https://mmi-ai-foundry-east-us-2.openai.azure.com/openai/v1/chat/completions"
25-
LLM_MODEL_NAME: "gpt-5.1-chat"
25+
LLM_MODEL_NAME: "gpt-5.1-chat"

openshift/kustomize/services/auto-clipper/base/deploy.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,62 @@ spec:
160160
name: azure-openai
161161
key: AZURE_OPENAI_KEY
162162

163+
# Azure Video Indexer Configuration (optional - for speaker identification)
164+
- name: Service__AzureVideoIndexerAccountId
165+
valueFrom:
166+
secretKeyRef:
167+
name: azure-video-indexer
168+
key: AZURE_VIDEO_INDEXER_ACCOUNT_ID
169+
optional: true
170+
- name: Service__AzureVideoIndexerApiKey
171+
valueFrom:
172+
secretKeyRef:
173+
name: azure-video-indexer
174+
key: AZURE_VIDEO_INDEXER_API_KEY
175+
optional: true
176+
- name: Service__AzureVideoIndexerLocation
177+
valueFrom:
178+
secretKeyRef:
179+
name: azure-video-indexer
180+
key: AZURE_VIDEO_INDEXER_LOCATION
181+
optional: true
182+
- name: Service__AzureVideoIndexerArmTenantId
183+
valueFrom:
184+
secretKeyRef:
185+
name: azure-video-indexer
186+
key: AZURE_VIDEO_INDEXER_ARM_TENANT_ID
187+
optional: true
188+
- name: Service__AzureVideoIndexerArmClientId
189+
valueFrom:
190+
secretKeyRef:
191+
name: azure-video-indexer
192+
key: AZURE_VIDEO_INDEXER_ARM_CLIENT_ID
193+
optional: true
194+
- name: Service__AzureVideoIndexerArmClientSecret
195+
valueFrom:
196+
secretKeyRef:
197+
name: azure-video-indexer
198+
key: AZURE_VIDEO_INDEXER_ARM_CLIENT_SECRET
199+
optional: true
200+
- name: Service__AzureVideoIndexerSubscriptionId
201+
valueFrom:
202+
secretKeyRef:
203+
name: azure-video-indexer
204+
key: AZURE_VIDEO_INDEXER_SUBSCRIPTION_ID
205+
optional: true
206+
- name: Service__AzureVideoIndexerResourceGroup
207+
valueFrom:
208+
secretKeyRef:
209+
name: azure-video-indexer
210+
key: AZURE_VIDEO_INDEXER_RESOURCE_GROUP
211+
optional: true
212+
- name: Service__AzureVideoIndexerAccountName
213+
valueFrom:
214+
secretKeyRef:
215+
name: azure-video-indexer
216+
key: AZURE_VIDEO_INDEXER_ACCOUNT_NAME
217+
optional: true
218+
163219
# Service Configuration
164220
- name: Service__MaxFailLimit
165221
valueFrom:

openshift/kustomize/services/auto-clipper/overlays/dev/kustomization.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ secretGenerator:
1616
- name: azure-openai
1717
type: stringData
1818
env: openai.env
19+
- name: azure-video-indexer
20+
type: stringData
21+
env: video-indexer.env
1922

2023
patches:
2124
- target:
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Azure Video Indexer settings for OpenShift test overlay.
2+
# Copy this file to `video-indexer.env` (same folder) and fill real values.
3+
4+
# Required in both API Key mode and ARM mode.
5+
AZURE_VIDEO_INDEXER_ACCOUNT_ID=
6+
AZURE_VIDEO_INDEXER_LOCATION=canadacentral
7+
8+
# API Key mode (trial/dev). In ARM mode this can be left empty.
9+
AZURE_VIDEO_INDEXER_API_KEY=
10+
11+
# ARM mode (recommended). If all three are set, service switches to ARM auth.
12+
AZURE_VIDEO_INDEXER_ARM_TENANT_ID=
13+
AZURE_VIDEO_INDEXER_ARM_CLIENT_ID=
14+
AZURE_VIDEO_INDEXER_ARM_CLIENT_SECRET=
15+
16+
# Additional ARM required values.
17+
AZURE_VIDEO_INDEXER_SUBSCRIPTION_ID=
18+
AZURE_VIDEO_INDEXER_RESOURCE_GROUP=
19+
AZURE_VIDEO_INDEXER_ACCOUNT_NAME=
20+
21+
# Notes:
22+
# 1) ACCOUNT_NAME + ACCOUNT_ID + LOCATION must belong to the same VI account.
23+
# 2) LOCATION must be the real Azure region in ARM mode (not "trial").

openshift/kustomize/services/auto-clipper/overlays/prod/kustomization.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ secretGenerator:
1616
- name: azure-openai
1717
type: stringData
1818
env: openai.env
19+
- name: azure-video-indexer
20+
type: stringData
21+
env: video-indexer.env
1922

2023
patches:
2124
- target:
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Azure Video Indexer settings for OpenShift test overlay.
2+
# Copy this file to `video-indexer.env` (same folder) and fill real values.
3+
4+
# Required in both API Key mode and ARM mode.
5+
AZURE_VIDEO_INDEXER_ACCOUNT_ID=
6+
AZURE_VIDEO_INDEXER_LOCATION=canadacentral
7+
8+
# API Key mode (trial/dev). In ARM mode this can be left empty.
9+
AZURE_VIDEO_INDEXER_API_KEY=
10+
11+
# ARM mode (recommended). If all three are set, service switches to ARM auth.
12+
AZURE_VIDEO_INDEXER_ARM_TENANT_ID=
13+
AZURE_VIDEO_INDEXER_ARM_CLIENT_ID=
14+
AZURE_VIDEO_INDEXER_ARM_CLIENT_SECRET=
15+
16+
# Additional ARM required values.
17+
AZURE_VIDEO_INDEXER_SUBSCRIPTION_ID=
18+
AZURE_VIDEO_INDEXER_RESOURCE_GROUP=
19+
AZURE_VIDEO_INDEXER_ACCOUNT_NAME=
20+
21+
# Notes:
22+
# 1) ACCOUNT_NAME + ACCOUNT_ID + LOCATION must belong to the same VI account.
23+
# 2) LOCATION must be the real Azure region in ARM mode (not "trial").

openshift/kustomize/services/auto-clipper/overlays/test/kustomization.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ secretGenerator:
1616
- name: azure-openai
1717
type: stringData
1818
env: openai.env
19+
- name: azure-video-indexer
20+
type: stringData
21+
env: video-indexer.env
1922

2023
patches:
2124
- target:
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Azure Video Indexer settings for OpenShift test overlay.
2+
# Copy this file to `video-indexer.env` (same folder) and fill real values.
3+
4+
# Required in both API Key mode and ARM mode.
5+
AZURE_VIDEO_INDEXER_ACCOUNT_ID=
6+
AZURE_VIDEO_INDEXER_LOCATION=canadacentral
7+
8+
# API Key mode (trial/dev). In ARM mode this can be left empty.
9+
AZURE_VIDEO_INDEXER_API_KEY=
10+
11+
# ARM mode (recommended). If all three are set, service switches to ARM auth.
12+
AZURE_VIDEO_INDEXER_ARM_TENANT_ID=
13+
AZURE_VIDEO_INDEXER_ARM_CLIENT_ID=
14+
AZURE_VIDEO_INDEXER_ARM_CLIENT_SECRET=
15+
16+
# Additional ARM required values.
17+
AZURE_VIDEO_INDEXER_SUBSCRIPTION_ID=
18+
AZURE_VIDEO_INDEXER_RESOURCE_GROUP=
19+
AZURE_VIDEO_INDEXER_ACCOUNT_NAME=
20+
21+
# Notes:
22+
# 1) ACCOUNT_NAME + ACCOUNT_ID + LOCATION must belong to the same VI account.
23+
# 2) LOCATION must be the real Azure region in ARM mode (not "trial").

services/net/auto-clipper/AutoClipperManager.cs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -635,23 +635,32 @@ private static void CleanupTemporaryFiles(bool isSyncedToS3, params string[] fil
635635

636636
/// <summary>
637637
/// Format the transcript to include newlines.
638+
/// When speaker information is available (from Video Indexer), includes speaker prefix.
639+
/// Azure Speech transcripts have no speaker info and will output plain text.
638640
/// </summary>
639-
/// <param name="transcript"></param>
640-
/// <returns></returns>
641+
/// <param name="segments">Transcript segments with optional speaker information.</param>
642+
/// <returns>Formatted transcript string.</returns>
641643
private static string BuildTranscriptDocument(IReadOnlyList<TimestampedTranscript> segments)
642644
{
643645
if (segments == null || segments.Count == 0) return string.Empty;
644646

645647
var sb = new StringBuilder();
646-
var index = 1;
647648
foreach (var segment in segments)
648649
{
649650
if (string.IsNullOrWhiteSpace(segment.Text)) continue;
650-
// sb.AppendLine(index.ToString(CultureInfo.InvariantCulture));
651-
// sb.AppendLine($"{FormatTimestamp(segment.Start)} --> {FormatTimestamp(segment.End)}");
651+
652+
// Add speaker prefix if available (Video Indexer provides this)
653+
if (!string.IsNullOrWhiteSpace(segment.SpeakerName))
654+
{
655+
sb.Append($"{segment.SpeakerName}: ");
656+
}
657+
else if (segment.SpeakerId.HasValue)
658+
{
659+
sb.Append($"speaker{segment.SpeakerId}: ");
660+
}
661+
652662
sb.AppendLine(segment.Text.Trim());
653663
sb.AppendLine();
654-
index++;
655664
}
656665

657666
return sb.ToString().Trim();

services/net/auto-clipper/AutoClipperService.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ protected override IServiceCollection ConfigureServices(IServiceCollection servi
5757
services.AddSingleton<IAzureSpeechTranscriptionService, AzureSpeechTranscriptionService>();
5858
services.AddHttpClient<IClipSegmentationService, ClipSegmentationService>();
5959

60+
// Register Video Indexer client if configured
61+
var videoIndexerAccountId = this.Configuration.GetSection("Service")["AzureVideoIndexerAccountId"];
62+
var videoIndexerApiKey = this.Configuration.GetSection("Service")["AzureVideoIndexerApiKey"];
63+
if (!string.IsNullOrWhiteSpace(videoIndexerAccountId) && !string.IsNullOrWhiteSpace(videoIndexerApiKey))
64+
{
65+
services.AddHttpClient<IAzureVideoIndexerClient, AzureVideoIndexerClient>();
66+
}
67+
6068
// TODO: Figure out how to validate without resulting in aggregating the config values.
6169
// services.AddOptions<AutoClipperOptions>()
6270
// .Bind(this.Configuration.GetSection("Service"))

0 commit comments

Comments
 (0)