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
- Sora supports the following video durations: 5, 10, 15, and 20 seconds.
41
+
- Sora supports video durations between 1 and 20 seconds.
42
42
- You can request multiple video variants in a single job: for 1080p resolutions, this feature is disabled; for 720p, the maximum is two variants; for other resolutions, the maximum is four variants.
43
43
- You can have two video creation jobs running at the same time. You must wait for one of the jobs to finish before you can create another.
44
44
- Jobs are available for up to 24 hours after they're created. After that, you must create a new job to generate the video again.
@@ -49,3 +49,6 @@ Sora has a robust safety stack including content filtering, abuse monitoring, se
49
49
50
50
Sora doesn't generate scenes with acts of violence but can generate adjacent content, such as realistic war-like footage.
| height | integer | The height of the video. The following dimensions are supported: 480x480, 854x480, 720x720, 1280x720, 1080x1080 and 1920x1080. | Yes ||
1081
+
| height | integer | The height of the video. The following dimensions are supported: 480x480, 480x854, 854x480, 720x720, 720x1280, 1280x720, 1080x1080, 1080x1920, 1920x1080. | Yes ||
1082
1082
| model | string | The name of the deployment to use for this request. | Yes ||
1083
1083
| n_seconds | integer | The duration of the video generation job. Must be between 1 and 20 seconds. | No | 5 |
1084
1084
| n_variants | integer | The number of videos to create as variants for this job. Must be between 1 and 5. Smaller dimensions allow more variants. | No | 1 |
1085
1085
| prompt | string | The prompt for this video generation job. | Yes ||
1086
-
| width | integer | The width of the video. The following dimensions are supported: 480x480, 854x480, 720x720, 1280x720, 1080x1080 and 1920x1080. | Yes ||
1086
+
| width | integer | The width of the video. The following dimensions are supported: 480x480, 480x854, 854x480, 720x720, 720x1280, 1280x720, 1080x1080, 1080x1920, 1920x1080. | Yes ||
1087
1087
1088
1088
### Responses
1089
1089
@@ -2276,12 +2276,12 @@ The tool calls generated by the model, such as function calls.
2276
2276
2277
2277
| Name | Type | Description | Required | Default |
| height | integer | The height of the video. The following dimensions are supported: 480x480, 854x480, 720x720, 1280x720, 1080x1080 and 1920x1080. | Yes ||
2279
+
| height | integer | The height of the video. The following dimensions are supported: 480x480, 480x854, 854x480, 720x720, 720x1280, 1280x720, 1080x1080, 1080x1920, 1920x1080. | Yes ||
2280
2280
| model | string | The name of the deployment to use for this request. | Yes ||
2281
2281
| n_seconds | integer | The duration of the video generation job. Must be between 1 and 20 seconds. | No | 5 |
2282
2282
| n_variants | integer | The number of videos to create as variants for this job. Must be between 1 and 5. Smaller dimensions allow more variants. | No | 1 |
2283
2283
| prompt | string | The prompt for this video generation job. | Yes ||
2284
-
| width | integer | The width of the video. The following dimensions are supported: 480x480, 854x480, 720x720, 1280x720, 1080x1080 and 1920x1080. | Yes ||
2284
+
| width | integer | The width of the video. The following dimensions are supported: 480x480, 480x854, 854x480, 720x720, 720x1280, 1280x720, 1080x1080, 1080x1920, 1920x1080. | Yes ||
In this quickstart, you generate video clips using the Azure OpenAI service. The example uses the Sora model, which is a video generation model that creates realistic and imaginative video scenes from text instructions. This guide shows you how to create a video generation job, poll for its status, and retrieve the generated video.
11
+
12
+
For more information on video generation, see [Video generation concepts](../concepts/video-generation.md).
- An Azure subscription. <ahref="https://azure.microsoft.com/free/ai-services"target="_blank">Create one for free</a>.
15
+
- <ahref="https://www.python.org/"target="_blank">Python 3.8 or later version</a>. We recommend using Python 3.10 or later, but having at least Python 3.8 is required. If you don't have a suitable version of Python installed, you can follow the instructions in the [VS Code Python Tutorial](https://code.visualstudio.com/docs/python/python-tutorial#_install-a-python-interpreter) for the easiest way of installing Python on your operating system.
16
+
- An Azure OpenAI resource created in one of the supported regions. For more information about region availability, see the [models and versions documentation](/azure/ai-services/openai/concepts/models#video-generation-models).
17
+
- Then, you need to deploy a `sora` model with your Azure OpenAI resource. For more information, see [Create a resource and deploy a model with Azure OpenAI](../how-to/create-resource.md).
18
+
19
+
## Microsoft Entra ID prerequisites
20
+
21
+
For the recommended keyless authentication with Microsoft Entra ID, you need to:
22
+
- Install the [Azure CLI](/cli/azure/install-azure-cli) used for keyless authentication with Microsoft Entra ID.
23
+
- Assign the `Cognitive Services User` role to your user account. You can assign roles in the Azure portal under **Access control (IAM)** > **Add role assignment**.
24
+
25
+
## Set up
26
+
27
+
1. Create a new folder `video-generation-quickstart` and go to the quickstart folder with the following command:
1. Create a virtual environment. If you already have Python 3.10 or higher installed, you can create a virtual environment using the following commands:
34
+
35
+
# [Windows](#tab/windows)
36
+
37
+
```bash
38
+
py -3 -m venv .venv
39
+
.venv\scripts\activate
40
+
```
41
+
42
+
# [Linux](#tab/linux)
43
+
44
+
```bash
45
+
python3 -m venv .venv
46
+
source .venv/bin/activate
47
+
```
48
+
49
+
# [macOS](#tab/macos)
50
+
51
+
```bash
52
+
python3 -m venv .venv
53
+
source .venv/bin/activate
54
+
```
55
+
56
+
---
57
+
58
+
Activating the Python environment means that when you run ```python``` or ```pip``` from the command line, you then use the Python interpreter contained in the ```.venv``` folder of your application. You can use the ```deactivate```command to exit the python virtual environment, and can later reactivate it when needed.
59
+
60
+
> [!TIP]
61
+
> We recommend that you create and activate a new Python environment to use to install the packages you need for this tutorial. Don't install packages into your global python installation. You should always use a virtual or conda environment when installing python packages, otherwise you can break your global installation of Python.
62
+
63
+
1. For the **recommended** keyless authentication with Microsoft Entra ID, install the `azure-identity` package with:
You can generate a video with the Sora model by creating a video generation job, polling for its status, and retrieving the generated video. The following code shows how to do this via the REST API using Python.
77
+
78
+
## [Microsoft Entra ID](#tab/keyless)
79
+
80
+
1. Create the `sora-quickstart.py` file with the following code:
81
+
82
+
```python
83
+
import requests
84
+
import base64
85
+
import os
86
+
from azure.identity import DefaultAzureCredential
87
+
88
+
# Set environment variables or edit the corresponding values here.
Copy file name to clipboardExpand all lines: articles/ai-services/openai/video-generation-quickstart.md
+9-100Lines changed: 9 additions & 100 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,112 +7,21 @@ ms.service: azure-ai-openai
7
7
ms.topic: quickstart
8
8
author: PatrickFarley
9
9
ms.author: pafarley
10
-
ms.date: 05/22/2025
10
+
ms.date: 5/29/2025
11
11
---
12
12
13
13
# Quickstart: Generate a video with Sora (preview)
14
14
15
-
In this quickstart, you generate video clips using the Azure OpenAI service. The example uses the Sora model, which is a video generation model that creates realistic and imaginative video scenes from text instructions. This guide shows you how to create a video generation job, poll for its status, and retrieve the generated video.
15
+
[!INCLUDE [REST API quickstart](includes/video-generation-rest.md)]
16
16
17
-
For more information on video generation, see [Video generation concepts](./concepts/video-generation.md).
17
+
## Clean-up resources
18
18
19
+
If you want to clean up and remove an Azure OpenAI resource, you can delete the resource. Before deleting the resource, you must first delete any deployed models.
- An Azure subscription. <ahref="https://azure.microsoft.com/free/ai-services"target="_blank">Create one for free</a>.
23
-
- <ahref="https://www.python.org/"target="_blank">Python 3.8 or later version</a>.
24
-
- An Azure OpenAI resource created in a supported region. See [Region availability](/azure/ai-services/openai/concepts/models#model-summary-table-and-region-availability).
25
-
- Then, you need to deploy a `sora` model with your Azure resource. For more information, see [Create a resource and deploy a model with Azure OpenAI](./how-to/create-resource.md).
26
-
-[Python 3.8 or later version](https://www.python.org/).
24
+
## Related content
27
25
28
-
29
-
## Setup
30
-
31
-
### Retrieve key and endpoint
32
-
33
-
To successfully call the Azure OpenAI APIs, you need the following information about your Azure OpenAI resource:
34
-
35
-
| Variable | Name | Value |
36
-
|---|---|---|
37
-
|**Endpoint**|`api_base`| The endpoint value is located under **Keys and Endpoint** for your resource in the Azure portal. You can also find the endpoint via the **Deployments** page in Azure AI Foundry portal. An example endpoint is: `https://docs-test-001.openai.azure.com/`. |
38
-
|**Key**|`api_key`| The key value is also located under **Keys and Endpoint** for your resource in the Azure portal. Azure generates two keys for your resource. You can use either value. |
39
-
40
-
Go to your resource in the Azure portal. On the navigation pane, select **Keys and Endpoint** under **Resource Management**. Copy the **Endpoint** value and an access key value. You can use either the **KEY 1** or **KEY 2** value. Always having two keys allows you to securely rotate and regenerate keys without causing a service disruption.
41
-
42
-
:::image type="content" source="./media/quickstarts/endpoint.png" alt-text="Screenshot that shows the Keys and Endpoint page for an Azure OpenAI resource in the Azure portal." lightbox="./media/quickstarts/endpoint.png":::
0 commit comments