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
title: Export a portion of a Video Analyzer recorded video to an MP4 file
3
-
description: In this tutorial, you'll learn how to export a portion of a Video Analyzer recorded video as an MP4 which is stored as a Video Analyzer video which can be downloaded and consumed outside of the Video Analyzer account ecosystem.
2
+
title: Export a portion of an Azure Video Analyzer recorded video to an MP4 file
3
+
description: In this tutorial, you learn how to export a portion of a Video Analyzer recorded video as an MP4 which is stored as a Video Analyzer account. The video can be downloaded and consumed outside of the Video Analyzer account ecosystem.
4
4
ms.topic: tutorial
5
5
ms.date: 11/04/2021
6
6
ms.custom: ignite-fall-2021
@@ -9,16 +9,16 @@ ms.custom: ignite-fall-2021
9
9
10
10
[!INCLUDE [header](includes/cloud-env.md)]
11
11
12
-
In this tutorial, you'll learn how to export a portion of video that has been recorded in Azure Video Analyzer account. This exported portion of video is saved as a MP4 file which can be downloaded and consumed outside of the Video Analyzer account.
12
+
In this tutorial, you learn how to export a portion of video that has been recorded in Azure Video Analyzer account. This exported portion of video is saved as an MP4 file which can be downloaded and consumed outside of the Video Analyzer account.
13
+
14
+
The topic demonstrates how to export a portion of the video using the Azure portal and a C# SDK code sample.
13
15
14
16
## Suggested pre-reading
15
17
16
18
Read these articles before you begin:
17
19
18
20
*[Azure Video Analyzer overview](../overview.md)
19
-
*[Azure Video Analyzer terminology](../terminology.md)
*[Event-based video recording](../event-based-video-recording-concept.md)
22
22
23
23
## Prerequisites
24
24
@@ -30,99 +30,159 @@ Prerequisites for this tutorial are:
30
30
31
31
## Overview
32
32
33
-
Video Analyzer can record videos from an RTSP source and in the Video Analyzer account these videos are recorded in a segmented archive. The segmented archive format allows unbounded duration of video recording, however, in some cases it is necessary to save a portion of video as an MP4 so that it can be individually archived, downloaded, or played outside of the Video Analyzer ecosystem.
33
+
Video Analyzer can record videos from an RTSP source. These videos are recorded in a segmented archive and stored in the Video Analyzer account. The segmented archive format allows unbounded duration of video recording. However, in some cases it is necessary to save a portion of video as an MP4 so that it can be individually archived, downloaded, or played outside of the Video Analyzer ecosystem.
34
34
35
35
In this tutorial, you will learn:
36
36
37
-
* About batch pipeline topologies and batch pipeline jobs
37
+
* About batch pipeline topologies and batch pipeline jobs.
38
38
* How to create a batch topology.
39
-
* How to create a batch pipeline job from a Video Analyzer video archive that will create a MP4 file that contains a specified value of time (up to 24 hours).
39
+
* How to create a batch pipeline job from a Video Analyzer video archive. The new video archive creates an MP4 file that contains a specified value of time (up to 24 hours).
40
40
41
41
## Pipeline topology of **batch** kind
42
42
43
-
A pipeline topology of batch kind enables you to describe how recorded video should be processed for exportbased on your custom needs through three interconnected nodes. A pipeline topology of batch kind is the base that is used for pipeline jobs. A pipeline job is the individual instance of a pipeline topology of batch kind. The pipeline job imports the recorded Video Analyzer video and saves it to the Video Analyzer's storage account, as a downloadable MP4 file. The pipeline topology of batch kind uses a [video source node](../pipeline.md#video-source) that connects to an [encoder processor node](../pipeline.md#encoder-processor) and then connects to a [video sink node](../pipeline.md#video-sink).
43
+
A pipeline topology of batch kind enables you to describe how recorded video should be processed for export. The topology is based on your custom needs through three interconnected nodes. A pipeline topology of batch kind is the base that is used for pipeline jobs. A pipeline job is the individual instance of a pipeline topology of batch kind. The pipeline job imports the recorded Video Analyzer video and saves it to the Video Analyzer's storage account, as a downloadable MP4 file. The pipeline topology of batch kind uses a [video source node](../pipeline.md#video-source) that connects to an [encoder processor node](../pipeline.md#encoder-processor) and then connects to a [video sink node](../pipeline.md#video-sink).
44
44
45
45
> [!NOTE]
46
-
> For more information about sources, processors and sinks please see [sources, processors, and sinks](../pipeline.md#sources-processors-and-sinks). For more information on pipeline jobs please see [pipeline jobs](../pipeline.md#batch-pipeline)
46
+
> For more information about sources, processors, and sinks, see [sources, processors, and sinks](../pipeline.md#sources-processors-and-sinks). For more information on pipeline jobs, see [pipeline jobs](../pipeline.md#batch-pipeline)
47
+
48
+
## [Azure portal](#tab/azure-portal)
47
49
48
-
## Create a pipeline job (from Videos)
50
+
###Create a pipeline job (from Videos)
49
51
50
52
1. In the Azure portal navigate to your Video Analyzer account.
51
-
1. Select **Videos** under the `Video Analyzer` section and then select the video stream that should be used to export a portion of video from.
53
+
1. Select **Videos** under the **Video Analyzer** section. Then select the video stream that should be used to export a portion of the video from.
52
54
53
55
> [!div class="mx-imgBorder"]
54
56
> :::image type="content" source="./media/export-portion-of-video-as-mp4/video-analyzer-video.png" alt-text="Image of Azure Video Analyzer's Video Analyzer menu section highlighting the Videos selection.":::
55
-
1. On the Video widget player blade click on **Create Job** at the top.
57
+
1. On the Video widget player blade click **Create Job** at the top.
56
58
57
59
> [!div class="mx-imgBorder"]
58
60
> :::image type="content" source="./media/export-portion-of-video-as-mp4/create-job.png" alt-text="Image of Azure Video Analyzer's video widget blade highlighting the create a job selection.":::
59
-
1. In the `Create Job` fly out blade select:
61
+
1. In the **Create Job** fly out blade select:
60
62
61
63
1. Select **Create from sample** for the `Batch topology`.
62
-
1. Select the **Video export** sample topology in the `Batch topology name` dropdown list.
63
-
1. Enter a name in the `Batch topology name` to save the topology as.
64
+
1. Select the **Video export** sample topology in the `Batch topology name` drop-down list.
65
+
1. Enter a name in the **Batch topology name** field to save the topology as.
64
66
65
67
> [!NOTE]
66
-
> The sample topology will be saved as the name entered above. It will be available to re-use next time a video is to be exported.
67
-
1. In the `Name your job` section enter a **Job name** in the Job name filed and a **Description** for the job in the description field (the description is optional)
68
-
1. In the `Define parameters` section:
69
-
1. Enter the name of the Video Analyzer recorded video in the `sourceVideoName` field.
70
-
1. In the `videoSourceTimeSequenceParameter` field select the start and end dates by clicking on the calendar icon and selecting the dates for each value. In the time fields, enter the start and end times for the pipeline job to use for creating the video clip with.
71
-
> [!NOTE]
72
-
> The time value for a given recorded video is displayed in the upper right hand side of the video widget player. This time value is shown in the image below with a red box around it. The calendar icon is also shown in the image below with a green box around it.
68
+
> The sample topology will be saved as the name entered above. You can re-use the name next time a video is to be exported.
69
+
1. In the **Name your job** section enter a job name and a description (optional).
70
+
1. In the **Define parameters** section specify the following:
73
71
74
-
1. Enter a name for the exported MP4 file in the `exportedVideoName` field.
72
+
1. In the **sourceVideoName** field, enter the name of the Video Analyzer recorded video.
73
+
1. In the **videoSourceTimeSequenceParameter** field, select the start and end dates by clicking on the calendar icon and selecting the dates for each value. In the time fields, enter the start and end times that are used by the pipeline job for creating the video clip.
74
+
75
+
> [!NOTE]
76
+
> The time value for a given recorded video is displayed in the upper right-hand side of the video widget player. This time value is shown in the image below with a red box around it. The calendar icon is also shown in the image below with a green box around it.
77
+
1. Enter a name for the exported MP4 file in the **exportedVideoName** field.
75
78
76
79
> [!div class="mx-imgBorder"]
77
-
> :::image type="content" source="./media/export-portion-of-video-as-mp4/video-widget-job-creation.png" alt-text="Image of Azure Video Analyzer's video player widget and pipeline jobs fly-out blade highlighting the video time stamp in a red box and a green box around the calendar icon.":::
78
-
1. Click **Create** at the bottom of the `Create a job` fly-out blade.
80
+
> :::image type="content" source="./media/export-portion-of-video-as-mp4/video-widget-job-creation.png" alt-text="Image of Video Analyzer's video player widget and pipeline jobs fly-out blade highlighting the video time stamp in a red box and a green box around the calendar icon.":::
81
+
1. Click **Create** at the bottom of the **Create a job** fly-out blade.
79
82
80
-
To monitor the Pipeline Job, navigate to the `Batch Jobs tab`.
81
-
1. Under the `Video Analyzer` section select **Batch**.
82
-
1. Click on the `Jobs` tab at the top of the Batch Blade.
83
+
To monitor the Pipeline Job, navigate to the **Batch Jobs tab**.
84
+
1. Under the **Video Analyzer** section select **Batch**.
85
+
1. Click on the **Jobs** tab at the top of the Batch blade.
83
86
84
-
The Batch Job will enter a processing state, then upon successful completion it will change state to `Completed`. To view the associated MP4 video file:
85
-
1. Click on **Videos** under the `Video Analyzer` section.
87
+
The Batch Job will enter a processing state, then upon successful completion it will change state to `Completed`. To view the associated MP4 video file:
88
+
1. Click on **Videos** under the **Video Analyzer** section.
86
89
1. Click on the video name that matches the Batch Jobs name used previously in step 5.
87
90
88
-
The Video Widget player should start playing the MP4 file. To download the MP4 file click on `Download video` at the top of the blade. This will open the MP4 file in a new browser tab. Right click on the video and click **save as**.
91
+
The Video Widget player should start playing the MP4 file. To download the MP4 file click **Download video** at the top of the blade. This opens the MP4 file in a new browser tab. Right click on the video and click **save as**.
89
92
90
-
## Cancel a pipeline job
93
+
###Cancel a pipeline job
91
94
92
-
Once a pipeline job has entered the processing state the pipeline job can be canceled. To cancel a pipeline job:
95
+
Once a pipeline job has entered the processing state the pipeline job can be canceled. To cancel a pipeline job:
93
96
94
97
1. Navigate to the Video Analyzer account and select **Batch** under **Video Analyzer** section.
95
98
1. In the Batch blade select the **Jobs** tab at the top.
96
-
1. Under the jobs tab you will find a list of jobs that are in different states. Find the job you wish to cancel in the processing state and select **Cancel** on the righthand side of the Batch pipeline Jobs tab and then click **Yes**.
99
+
1. Under the jobs tab you will find a list of jobs that are in different states. Find the job you wish to cancel in the processing state and select **Cancel** on the right-hand side of the Batch pipeline Jobs tab and then click **Yes**.
97
100
98
101
> [!NOTE]
99
102
> A failed pipeline job cannot be canceled.
100
103
101
-
## Delete a pipeline job
104
+
###Delete a pipeline job
102
105
103
-
Once a pipeline job has entered the completed or failed state the pipeline job can be deleted. To delete a pipeline job:
106
+
Once a pipeline job has entered the completed or failed state the pipeline job can be deleted. To delete a pipeline job:
104
107
105
108
1. Navigate to the Video Analyzer account and select **Batch** under **Video Analyzer** section.
106
109
1. In the Batch blade select the **Jobs** tab at the top.
107
-
1. Under the jobs tab you will find a list of jobs that are in different states. Find the job you wish to delete (in the canceled, completed or failed state) and select **Delete** on the righthand side pipeline Jobs and then click **Delete**.
110
+
1. Under the jobs tab you will find a list of jobs that are in different states. Find the job you wish to delete (in the canceled, completed or failed state) and select **Delete** on the right-hand side pipeline Jobs and then click **Delete**.
108
111
109
-
## Delete a pipeline topology of batch kind
112
+
###Delete a pipeline topology of batch kind
110
113
111
-
In order to delete a pipeline topology of batch kind all pipeline jobs that are associated with the pipeline topology must be deleted. To delete a pipeline topology of batch kind:
114
+
In order to delete a pipeline topology of batch kind all pipeline jobs that are associated with the pipeline topology must be deleted. To delete a pipeline topology of batch kind:
112
115
113
116
1. Navigate to the Video Analyzer account.
114
-
2. Click on **Batch** under `Video Analyzer` section.
115
-
3. Under the topologies tab locate your pipeline topology of batch kind to delete and click on the '**...**' at the right hand side of the pipeline topology of batch kind.
116
-
4. Click on **Delete topology**.
117
+
2. Click on **Batch** under the **Video Analyzer** section.
118
+
3. Under the topologies tab locate your pipeline topology of batch kind to delete.
119
+
4. Click '**...**' at the right-hand side of the pipeline topology of batch kind.
120
+
5. Click **Delete topology**.
117
121
118
122
> [!NOTE]
119
123
> All pipeline jobs must be deleted from a pipeline topology of batch kind before a pipeline topology of batch kind can be deleted.
120
124
121
-
## Clean up resources
125
+
###Clean up resources
122
126
123
127
If you want to try other quickstarts or tutorials, keep the resources that you created. Otherwise, go to the Azure portal, go to your resource groups, select the resource group where you ran this quickstart, and delete all the resources.
124
128
129
+
## [C# SDK sample](#tab/csharp-sdk-sample)
130
+
131
+
In this tab, learn how to export a portion of recorded video as an MP4 file using Video Analyzer’s [C# SDK sample code](https://github.com/Azure-Samples/video-analyzer-csharp).
132
+
133
+
### Additional prerequisites
134
+
135
+
Complete the following prerequisites to run the [C# SDK sample code](https://github.com/Azure-Samples/video-analyzer-csharp).
136
+
137
+
1. Get your Azure Active Directory [Tenant ID](../../../active-directory/fundamentals/active-directory-how-to-find-tenant.md).
138
+
1. Register an application with Microsoft identity platform to get app registration [Client ID](../../../active-directory/develop/quickstart-register-app.md#register-an-application) and [Client secret](../../../active-directory/develop/quickstart-register-app.md#add-a-client-secret).
139
+
1.[Visual Studio Code](https://code.visualstudio.com/) on your development machine with following extensions -
1.[.NET Core 3.1 SDK](https://dotnet.microsoft.com/download/dotnet-core/3.1) on your development machine.
143
+
1. A recorded video in the Video Analyzer account, or an [RTSP camera](../quotas-limitations.md#supported-cameras-1) accessible over the internet. Alternatively, you can deploy an [RTSP camera simulator](get-started-livepipelines-portal.md#deploy-rtsp-camera-simulator).
144
+
145
+
### Get the sample code
146
+
147
+
* Clone the Video Analyzer [C# samples repository](https://github.com/Azure-Samples/video-analyzer-csharp).
148
+
* Open your local clone of this git repository in Visual Studio Code.
149
+
* The `src\video-export` folder contains a .NET Core console app to export a portion of a recorded video as an MP4 file.
150
+
* Navigate to `src\video-export\Program.cs`. Provide values for the following variables & save the changes.
| SubscriptionId | Provide Azure subscription ID |
155
+
| ResourceGroup | Provide resource group name |
156
+
| AccountName | Provide Video Analyzer account name |
157
+
| TenantId | Provide tenant ID |
158
+
| ClientId | Provide app registration client ID |
159
+
| Secret | Provide app registration client secret |
160
+
| AuthenticationEndpoint | Provide authentication end point (example: https://login.microsoftonline.com)|
161
+
| ArmEndPoint | Provide ARM end point (example: https://management.azure.com)|
162
+
| TokenAudience | Provide token audience (example: https://management.core.windows.net)|
163
+
| PublicCameraSourceRTSPURL *(optional)*| Provide RTSP source url |
164
+
| PublicCameraSourceRTSPUserName *(optional)*| Provide RTSP source username |
165
+
| PublicCameraSourceRTSPPassword *(optional)*| Provide RTSP source password |
166
+
| SourceVideoName | Provide source video name for export |
167
+
168
+
> [!NOTE]
169
+
> The sample code will first activate a live pipeline to create a video recording. If you already have a video recording in your Video Analyzer account (should be of type `archive`), refer to [Use existing video section](https://github.com/Azure-Samples/video-analyzer-csharp/tree/main/src/video-export#use-existing-video) for the necessary code changes.
170
+
171
+
### Run the sample program to create a batch pipeline
172
+
173
+
* Start a debugging session in VS Code (If this is the default project, hit F5 key or see instructions to [run the sample](https://github.com/Azure-Samples/video-analyzer-csharp/tree/main/src/video-export#running-the-sample)). The TERMINAL window will start displaying messages as you run the program.
174
+
* If the program runs successfully, a batch pipeline is created and activated. You will start seeing some messages printed in the TERMINAL window regarding creation of the topology and pipeline.
175
+
* If the job is successful, login to [Azure portal](https://portal.azure.com). Go to the Video Analyzer account used for this article.
176
+
* Click on Videos blade and choose the video resource created by the pipeline job. The default video name in sample code is `batch-pipeline-exported-video`. Click on the video, and it will trigger a download and playback in the browser window. Alternatively, you can download the file.
177
+
178
+
> [!NOTE]
179
+
> For detailed instructions on customizing pipeline parameters such as exported video name, refer to **[readme.md file for video export](https://github.com/Azure-Samples/video-analyzer-csharp/tree/main/src/video-export)**.
180
+
181
+
### Clean-up resources
182
+
183
+
In the VS Code TERMINAL window, press enter to deactivate the pipeline and cleanup the pipeline and topology created in this article.
184
+
125
185
## Next steps
126
186
127
187
*[Connect cameras directly to the cloud](./connect-cameras-to-cloud.md) in order capture and record video, using [cloud pipelines](../pipeline.md).
128
-
*[Connect cameras to Video Analyzer's service via the Video Analyzer edge module acting as a transparent gateway for video packets via RTSP protocol](./use-remote-device-adapter.md).
188
+
* Connect cameras to Video Analyzer's service via the [Video Analyzer edge module acting as a transparent gateway](./use-remote-device-adapter.md) for video packets via RTSP protocol.
0 commit comments