Tutorial: Export portion of recorded video as an MP4 file
Alternatively, check out topics under Create intelligent video applications on the edge.
Note
Azure Video Analyzer has been retired and is no longer available.
Azure Video Analyzer for Media is not affected by this retirement. It is now rebranded to Azure Video Indexer. Click here to read more.
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.
The topic demonstrates how to export a portion of the video using the Azure portal and a C# SDK code sample.
Suggested pre-reading
Read these articles before you begin:
Prerequisites
Prerequisites for this tutorial are:
- An Azure account that includes an active subscription. Create an account for free if you don't already have one.
- Video Analyzer account.
- Have completed Quickstart: Detect motion in a (simulated) live video, record the video to the Video Analyzer account or any Video Analyzer pipeline that records to a video sink.
Overview
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.
In this tutorial, you will learn:
- About batch pipeline topologies and batch pipeline jobs.
- How to create a batch topology.
- 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).
Pipeline topology of batch kind
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 that connects to an encoder processor node and then connects to a video sink node.
Note
For more information about sources, processors, and sinks, see sources, processors, and sinks. For more information on pipeline jobs, see pipeline jobs
Create a pipeline job (from Videos)
In the Azure portal navigate to your Video Analyzer account.
Select Videos under the Video Analyzer section. Then select the video stream that should be used to export a portion of the video from.
On the Video widget player blade click Create Job at the top.
In the Create Job fly out blade select:
Select Create from sample for the
Batch topology
.Select the Video export sample topology in the
Batch topology name
drop-down list.Enter a name in the Batch topology name field to save the topology as.
Note
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.
In the Name your job section enter a job name and a description (optional).
In the Define parameters section specify the following:
In the sourceVideoName field, enter the name of the Video Analyzer recorded video.
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.
Note
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.
Enter a name for the exported MP4 file in the exportedVideoName field.
Click Create at the bottom of the Create a job fly-out blade.
To monitor the Pipeline Job, navigate to the Batch Jobs tab.
Under the Video Analyzer section select Batch.
Click on the Jobs tab at the top of the Batch blade.
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:Click on Videos under the Video Analyzer section.
Click on the video name that matches the Batch Jobs name used previously in step 5.
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.
Cancel a pipeline job
Once a pipeline job has entered the processing state the pipeline job can be canceled. To cancel a pipeline job:
Navigate to the Video Analyzer account and select Batch under Video Analyzer section.
In the Batch blade select the Jobs tab at the top.
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.
Note
A failed pipeline job cannot be canceled.
Delete a pipeline job
Once a pipeline job has entered the completed or failed state the pipeline job can be deleted. To delete a pipeline job:
- Navigate to the Video Analyzer account and select Batch under Video Analyzer section.
- In the Batch blade select the Jobs tab at the top.
- 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.
Delete a pipeline topology of batch kind
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:
Navigate to the Video Analyzer account.
Click on Batch under the Video Analyzer section.
Under the topologies tab locate your pipeline topology of batch kind to delete.
Click '...' at the right-hand side of the pipeline topology of batch kind.
Click Delete topology.
Note
All pipeline jobs must be deleted from a pipeline topology of batch kind before a pipeline topology of batch kind can be deleted.
Clean up resources
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.