You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/ai-services/speech-service/includes/how-to/video-translation/rest.md
+72-32Lines changed: 72 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -66,14 +66,14 @@ To create a video translation, you need to construct an HTTP PUT request path an
66
66
- Specify `subtitleMaxCharCountPerSegment`: The maximum number of characters allowed per subtitle segment. This is an optional parameter, and you can set it to 30 if you're unsure.
67
67
- Specify `exportSubtitleInVideo`: A boolean value indicating whether to export subtitles in the video. This is an optional parameter, and you can set it to `true` if you want to include subtitles in the video.
68
68
- Specify the `videoFileUrl`: The URL of the video file you want to translate. The video must be in .mp4 format, less than 500 MB, and shorter than 60 minutes. You can upload the video to Azure Blob Storage and use the Blob URL. For testing purposes, you can use the sample video file provided by Microsoft at [https://speechstudioprodpublicsa.blob.core.windows.net/ttsvoice/VideoTranslation/PublicDoc/SampleData/es-ES-TryOutOriginal.mp4](https://speechstudioprodpublicsa.blob.core.windows.net/ttsvoice/VideoTranslation/PublicDoc/SampleData/es-ES-TryOutOriginal.mp4).
69
-
- Specify `Operation-Id`: The `Operation-Id` must be unique for each operation. The operation ID is valid until the translation is deleted. In the example, `My-Operation-Id-1` is used. Replace `My-Operation-Id-1` with an operation ID of your choice.
70
-
- Specify `translationId`: The `translationId` must be unique. Replace `My-Translation-Id` with a translation ID of your choice.
71
-
- Replace `YourSpeechResourceKey` with your Speech resource key and replace `YourSpeechResourceRegion` with your Speech resource region.
72
69
73
-
To create a translation, run the following command with the settings as previously described.
70
+
For authentication and authorization, you need to include the following headers and path IDs in your request:
71
+
- Set the `Operation-Id` header: The `Operation-Id` must be unique for each operation, such as creating each iteration. Replace `Your-Operation-Id` with a unique ID for this operation.
72
+
- Replace `Your-Translation-Id` in the path. The `translationId` must be unique. Replace `Your-Translation-Id` with a translation ID of your choice. You use this ID to refer to the translation in subsequent API calls.
73
+
- Replace `YourSpeechResourceKey` with your Speech resource key and replace `YourSpeechResourceRegion` with your Speech resource region.
@@ -105,7 +105,7 @@ You should receive a response body in the following format:
105
105
},
106
106
"status": "NotStarted",
107
107
"lastActionDateTime": "2025-03-06T19:13:35.669Z",
108
-
"id": "My-Translation-Id",
108
+
"id": "Your-Translation-Id",
109
109
"displayName": "My translation object",
110
110
"description": "My translation object for video translation iterations",
111
111
"createdDateTime": "2025-03-06T19:13:35.669Z"
@@ -118,26 +118,27 @@ You can use the operation ID that you specified and use the [Get operation by op
118
118
119
119
To start translating your video or update an iteration for an existing translation, you need to construct an HTTP PUT request path and body according to the following instructions:
120
120
121
-
- Specify `Operation-Id`: The `Operation-Id` must be unique for each operation, such as creating each iteration. Replace `My-Operation-Id` with a unique ID for this operation.
122
-
- Specify `translationId`: If multiple iterations are performed under a single translation, the translation ID remains unchanged.
123
-
- Specify `iterationId`: The `iterationId` must be unique for each operation. Replace `My-Iteration-Id` with an iteration ID of your choice.
124
121
- Set the required input: Include details like `speakerCount`, `subtitleMaxCharCountPerSegment`,`exportSubtitleInVideo`, or `webvttFile`. No subtitles are embedded in the output video by default. When creating an iteration, if you already specified the optional parameters `speakerCount`, `subtitleMaxCharCountPerSegment`, and `exportSubtitleInVideo` during the creation of translation, you don’t need to specify them again. The values inherit from translation settings. Once these parameters are defined when creating an iteration, the new values override the original settings.
122
+
- Optionally, you can specify a WebVTT file with subtitles for your original video. The `webvttFile` input parameter isn't required when creating the first iteration. However, [starting from the second iteration](#step-4-create-additional-iterations-optional), you must specify the `webvttFile` parameter in the iteration process.
123
+
124
+
For authentication and authorization, you need to include the following headers and path IDs in your request:
125
+
- Set the `Operation-Id` header: The `Operation-Id` must be unique for each operation, such as creating each iteration. Replace `Your-Operation-Id` with a unique ID for this operation.
126
+
- Replace `Your-Translation-Id` in the path. Use the same translation ID that you specified when you [created the translation](#step-1-create-a-translation). The translation ID remains unchanged.
127
+
- Specify a new `iterationId` in the path. The iteration ID must be unique for each operation. Replace `Your-Iteration-Id-1` with an iteration ID of your choice.
125
128
- Replace `YourSpeechResourceKey` with your Speech resource key and replace `YourSpeechResourceRegion` with your Speech resource region.
126
129
127
130
```azurecli-interactive
128
131
curl -v -X PUT -H "Ocp-Apim-Subscription-Key: YourSpeechResourceKey" \
You should receive a response body in the following format:
142
143
143
144
```json
@@ -148,7 +149,7 @@ You should receive a response body in the following format:
148
149
},
149
150
"status": "NotStarted",
150
151
"lastActionDateTime": "2025-03-06T19:15:38.722Z",
151
-
"id": "My-Iteration-Id",
152
+
"id": "Your-Iteration-Id",
152
153
"createdDateTime": "2025-03-06T19:15:38.722Z"
153
154
}
154
155
```
@@ -159,10 +160,10 @@ You can use the operation ID that you specified and use the [Get operation by op
159
160
160
161
You can download the translated video and subtitles once the iteration status is `Succeeded`. The translated video and subtitles are available in the response body of the [Get an iteration by iteration ID](/rest/api/aiservices/videotranslation/iteration-operations/get-iteration) API.
161
162
162
-
To retrieve details of a specific iteration by its ID, use the HTTP GET request. Replace `YourSpeechResourceKey` with your Speech resource key, `YourSpeechResourceRegion` with your Speech resource region, `My-Translation-Id` with the translation ID you want to check, and `My-Iteration-Id` with the iteration ID you want to check.
163
+
To retrieve details of a specific iteration by its ID, use the HTTP GET request. Replace `YourSpeechResourceKey` with your Speech resource key, `YourSpeechResourceRegion` with your Speech resource region, `Your-Translation-Id` with the translation ID you want to check, and `Your-Iteration-Id` with the iteration ID you want to check.
163
164
164
165
```azurecli-interactive
165
-
curl -v -X GET -H "Ocp-Apim-Subscription-Key: YourSpeechResourceKey" "https://YourSpeechResourceRegion.api.cognitive.microsoft.com/videotranslation/translations/My-Translation-Id/iterations/My-Iteration-Id?api-version=2024-05-20-preview"
166
+
curl -v -X GET -H "Ocp-Apim-Subscription-Key: YourSpeechResourceKey" "https://YourSpeechResourceRegion.api.cognitive.microsoft.com/videotranslation/translations/Your-Translation-Id/iterations/Your-Iteration-Id?api-version=2024-05-20-preview"
166
167
```
167
168
168
169
You should receive a response body in the following format:
@@ -182,7 +183,7 @@ You should receive a response body in the following format:
You can create additional iterations to improve the translation quality. The process is similar to creating the first iteration. You can specify different settings for the new iteration, such as `speakerCount`, `subtitleMaxCharCountPerSegment`, and `exportSubtitleInVideo`.
534
+
You can create additional iterations to improve the translation quality. The process is similar to creating the first iteration.
535
+
536
+
The `webvttFile` parameter isn't required when creating the first iteration. However, starting from the second iteration, you must specify the `webvttFile` parameter in the iteration process. You need to download the webvtt file, make necessary edits, and then upload it to your Azure Blob storage. You need to specify the Blob URL.
537
+
538
+
To start translating your video or update an iteration for an existing translation, you need to construct an HTTP PUT request path and body according to the following instructions:
539
+
540
+
- Specify the required `webvttFile` input parameter. The `webvttFile` parameter is required starting from the second iteration. You need to [download the most recent webvtt file](#download-from-the-result-urls), make the desired edits, and then upload it to your Azure Blob storage. You need to specify the Blob URL. The subtitle file can be in WebVTT or JSON format.
541
+
- Optionally, you can specify new settings for the new iteration, such as `speakerCount`, `subtitleMaxCharCountPerSegment`, and `exportSubtitleInVideo`.
542
+
543
+
For authentication and authorization, you need to include the following headers and path IDs in your request:
544
+
- Set the `Operation-Id` header: The `Operation-Id` must be unique for each operation, such as creating each iteration. Replace `Your-Operation-Id` with a unique ID for this operation.
545
+
- Replace `Your-Translation-Id` in the path. Use the same translation ID that you specified when you [created the translation](#step-1-create-a-translation). The translation ID remains unchanged.
546
+
- Specify a new `iterationId` in the path. The iteration ID must be unique for each operation. Replace `Your-Iteration-Id-2` with an iteration ID of your choice.
547
+
- Replace `YourSpeechResourceKey` with your Speech resource key and replace `YourSpeechResourceRegion` with your Speech resource region.
548
+
549
+
```azurecli-interactive
550
+
curl -v -X PUT -H "Ocp-Apim-Subscription-Key: YourSpeechResourceKey" \
The `webvttFile` parameter isn't required when creating the first iteration. However, starting from the second iteration, you must specify the `webvttFile` parameter in the iteration process. You need to download the webvtt file, make necessary edits, and then upload it to your Azure Blob storage. You need to specify the Blob URL in the curl code.
562
+
You should receive a response body in the following format:
536
563
537
-
The subtitle file can be in WebVTT or JSON format. If you're unsure about how to prepare a WebVTT file, refer to the following sample formats.
You can use the operation ID that you specified and use the [Get operation by operation ID](#get-operation-by-operation-id) API periodically until the returned status is `Succeeded` or `Failed`. This operation allows you to monitor the progress of your creating the iteration process. The status property should progress from `NotStarted` to `Running`, and finally to `Succeeded` or `Failed`.
539
579
540
580
## Get operation by operation ID
541
581
542
582
Check the status of an operation using its operation ID. The operation ID is unique for each operation, so you can track each operation separately. The operation ID is valid until the translation is deleted.
543
583
544
-
- Specify the same `Operation-Id` that you used when creating the translation. In the example, `My-Operation-Id-1` is used. Replace `My-Operation-Id-1` with an operation ID of your choice.
584
+
- Specify the same `Operation-Id` that you used when creating the translation. In the example, `Your-Operation-Id-1` is used. Replace `Your-Operation-Id-1` with an operation ID of your choice.
545
585
- Replace `YourSpeechResourceKey` with your Speech resource key and replace `YourSpeechResourceRegion` with your Speech resource region.
546
586
547
587
```azurecli-interactive
548
-
curl -v -X GET -H "Ocp-Apim-Subscription-Key: YourSpeechResourceKey" "https://YourSpeechResourceRegion.api.cognitive.microsoft.com/videotranslation/operations/My-Operation-Id-1?api-version=2024-05-20-preview"
588
+
curl -v -X GET -H "Ocp-Apim-Subscription-Key: YourSpeechResourceKey" "https://YourSpeechResourceRegion.api.cognitive.microsoft.com/videotranslation/operations/Your-Operation-Id-1?api-version=2024-05-20-preview"
549
589
```
550
590
551
591
You should receive a response body in the following format:
552
592
553
593
```json
554
594
{
555
-
"id": "My-Operation-Id-1",
595
+
"id": "Your-Operation-Id-1",
556
596
"status": "Running"
557
597
}
558
598
```
559
599
560
600
## Delete a translation by translation ID
561
601
562
-
Remove a specific translation identified by `translationId`. This operation also removes all iterations associated with this translation. Replace `YourSpeechResourceKey` with your Speech resource key, `YourSpeechResourceRegion` with your Speech resource region, and `My-Translation-Id` with the translation ID you want to delete. If not deleted manually, the service retains the translation history for up to 31 days.
602
+
Remove a specific translation identified by `translationId`. This operation also removes all iterations associated with this translation. Replace `YourSpeechResourceKey` with your Speech resource key, `YourSpeechResourceRegion` with your Speech resource region, and `Your-Translation-Id` with the translation ID you want to delete. If not deleted manually, the service retains the translation history for up to 31 days.
The response headers include `HTTP/1.1 204 No Content` if the delete request was successful.
569
609
570
-
## Additional information
610
+
## More REST API examples
571
611
572
-
This section provides curl commands for other API calls that aren't described in detail previously. You can explore each API using the following commands.
612
+
This section provides curl commands for other video translation API calls that aren't described in detail previously.
This operation retrieves detailed information about a specific translation, identified by its unique `translationId`. Replace `YourSpeechResourceKey` with your Speech resource key, `YourSpeechResourceRegion` with your Speech resource region, and `My-Translation-Id` with the translation ID you want to check.
624
+
This operation retrieves detailed information about a specific translation, identified by its unique `translationId`. Replace `YourSpeechResourceKey` with your Speech resource key, `YourSpeechResourceRegion` with your Speech resource region, and `Your-Translation-Id` with the translation ID you want to check.
585
625
586
626
```azurecli-interactive
587
-
curl -v -X GET -H "Ocp-Apim-Subscription-Key: YourSpeechResourceKey" "https://YourSpeechResourceRegion.api.cognitive.microsoft.com/videotranslation/translations/My-Translation-Id?api-version=2024-05-20-preview"
627
+
curl -v -X GET -H "Ocp-Apim-Subscription-Key: YourSpeechResourceKey" "https://YourSpeechResourceRegion.api.cognitive.microsoft.com/videotranslation/translations/Your-Translation-Id?api-version=2024-05-20-preview"
588
628
```
589
629
590
630
### List iterations
591
631
592
-
List all iterations for a specific translation. This request lists all iterations without detailed information. Replace `YourSpeechResourceKey` with your Speech resource key, `YourSpeechResourceRegion` with your Speech resource region, and `My-Translation-Id` with the translation ID you want to check.
632
+
List all iterations for a specific translation. This request lists all iterations without detailed information. Replace `YourSpeechResourceKey` with your Speech resource key, `YourSpeechResourceRegion` with your Speech resource region, and `Your-Translation-Id` with the translation ID you want to check.
593
633
594
634
```azurecli-interactive
595
-
curl -v -X GET -H "Ocp-Apim-Subscription-Key: YourSpeechResourceKey" "https://YourSpeechResourceRegion.api.cognitive.microsoft.com/videotranslation/translations/My-Translation-Id/iterations?api-version=2024-05-20-preview"
635
+
curl -v -X GET -H "Ocp-Apim-Subscription-Key: YourSpeechResourceKey" "https://YourSpeechResourceRegion.api.cognitive.microsoft.com/videotranslation/translations/Your-Translation-Id/iterations?api-version=2024-05-20-preview"
0 commit comments