Tutorial: Export portion of recorded video as an MP4 file

cloud icon
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:

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)

  1. In the Azure portal navigate to your Video Analyzer account.

  2. Select Videos under the Video Analyzer section. Then select the video stream that should be used to export a portion of the video from.

    Image of Azure Video Analyzer's Video Analyzer menu section highlighting the Videos selection.

  3. On the Video widget player blade click Create Job at the top.

    Image of Azure Video Analyzer's video widget blade highlighting the create a job selection.

  4. In the Create Job fly out blade select:

    1. Select Create from sample for the Batch topology.

    2. Select the Video export sample topology in the Batch topology name drop-down list.

    3. 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.

  5. In the Name your job section enter a job name and a description (optional).

  6. In the Define parameters section specify the following:

    1. In the sourceVideoName field, enter the name of the Video Analyzer recorded video.

    2. 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.

    3. Enter a name for the exported MP4 file in the exportedVideoName field.

    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.

  7. Click Create at the bottom of the Create a job fly-out blade.

    To monitor the Pipeline Job, navigate to the Batch Jobs tab.

  8. Under the Video Analyzer section select Batch.

  9. 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:

  10. Click on Videos under the Video Analyzer section.

  11. 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:

  1. Navigate to the Video Analyzer account and select Batch under Video Analyzer section.

  2. In the Batch blade select the Jobs tab at the top.

  3. 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:

  1. Navigate to the Video Analyzer account and select Batch under Video Analyzer section.
  2. In the Batch blade select the Jobs tab at the top.
  3. 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:

  1. Navigate to the Video Analyzer account.

  2. Click on Batch under the Video Analyzer section.

  3. Under the topologies tab locate your pipeline topology of batch kind to delete.

  4. Click '...' at the right-hand side of the pipeline topology of batch kind.

  5. 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.