-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
1,118 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
--- | ||
topic: sample | ||
languages: | ||
- java | ||
products: | ||
- azure-media-services | ||
--- | ||
|
||
# Analyze a media file with a audio analyzer preset | ||
|
||
This sample demonstrates how to analyze audio in a media file. It shows how to perform the following tasks: | ||
|
||
1. Creates a transform that uses a audio analyzer preset. | ||
1. Uploads a media file to an input asset. | ||
1. Submits an analyzer job. | ||
1. Downloads the output asset for verification. | ||
|
||
## Prerequisites | ||
|
||
* Java JDK 1.8 or newer installed | ||
* Maven installed | ||
* An Azure Media Services account. See the steps described in [Create a Media Services account](https://docs.microsoft.com/azure/media-services/latest/create-account-cli-quickstart). | ||
|
||
## Running the example | ||
|
||
### Configure `appsettings.json` with appropriate access values | ||
|
||
Get credentials needed to use Media Services APIs by following [Access APIs](https://docs.microsoft.com/azure/media-services/latest/access-api-cli-how-to). Open the `src/main/resources/conf/appsettings.json` configuration file and paste the values in the file. | ||
|
||
### Clean and build the project | ||
|
||
Open a terminal window, go to the root folder of this project, run `mvn clean compile`. | ||
|
||
### Run this project | ||
|
||
Execute `mvn exec:java`, then follow the instructions in the output console. | ||
|
||
### Optional, do the following steps if you want to use Event Grid for job monitoring | ||
|
||
Please note, there are costs for using Event Hub. For more details, refer [Event Hubs pricing](https://azure.microsoft.com/en-in/pricing/details/event-hubs/) and [FAQ](https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-faq#pricing) | ||
|
||
* Enable Event Grid resource provider | ||
|
||
`az provider register --namespace Microsoft.EventGrid` | ||
|
||
* To check if registered, run the next command. You should see "Registered" | ||
|
||
`az provider show --namespace Microsoft.EventGrid --query "registrationState"` | ||
|
||
* Create an Event Hub | ||
|
||
`namespace=<unique-namespace-name>`\ | ||
`hubname=<event-hub-name>`\ | ||
`az eventhubs namespace create --name $namespace --resource-group <resource-group>`\ | ||
`az eventhubs eventhub create --name $hubname --namespace-name $namespace --resource-group <resource-group>` | ||
|
||
* Subscribe to Media Services events | ||
|
||
`hubid=$(az eventhubs eventhub show --name $hubname --namespace-name $namespace --resource-group <resource-group> --query id --output tsv)`\ | ||
`amsResourceId=$(az ams account show --name <ams-account> --resource-group <resource-group> --query id --output tsv)`\ | ||
`az eventgrid event-subscription create --resource-id $amsResourceId --name <event-subscription-name> --endpoint-type eventhub --endpoint $hubid` | ||
|
||
* Create a storage account and container for Event Processor Host if you don't have one | ||
[Create a storage account for Event Processor Host | ||
](https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-dotnet-standard-getstarted-send#create-a-storage-account-for-event-processor-host) | ||
|
||
* Update appsettings.json with your Event Hub and Storage information | ||
StorageAccountName: The name of your storage account.\ | ||
StorageAccountKey: The access key for your storage account. Navigate to Azure portal, "All resources", search your storage account, then "Access keys", copy key1.\ | ||
StorageContainerName: The name of your container. Click Blobs in your storage account, find you container and copy the name.\ | ||
EventHubConnectionString: The Event Hub connection string. search your namespace you just created. <your namespace> -> Shared access policies -> RootManageSharedAccessKey -> Connection string-primary key.\ | ||
EventHubName: The Event Hub name. <your namespace> -> Event Hubs. | ||
|
||
## Key concepts | ||
|
||
* [Analyzing video and audio files](https://docs.microsoft.com/azure/media-services/latest/analyzing-video-audio-files-concept) | ||
* [Transforms and Jobs](https://docs.microsoft.com/azure/media-services/latest/transforms-jobs-concept) | ||
* [Standard Encoder formats and codecs](https://docs.microsoft.com/azure/media-services/latest/media-encoder-standard-formats) | ||
* [Media Services job error codes](https://docs.microsoft.com/azure/media-services/latest/job-error-codes) | ||
|
||
## Next steps | ||
|
||
* [Azure Media Services pricing](https://azure.microsoft.com/pricing/details/media-services/) | ||
* [Azure Media Services v3 Documentation](https://docs.microsoft.com/azure/media-services/latest/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>sample</groupId> | ||
<artifactId>AudioAnalyzer</artifactId> | ||
<packaging>jar</packaging> | ||
<version>1.0-SNAPSHOT</version> | ||
<name>AudioAnalyzer</name> | ||
<url>http://maven.apache.org</url> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.googlecode.json-simple</groupId> | ||
<artifactId>json-simple</artifactId> | ||
<version>1.1.1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.microsoft.azure.mediaservices.v2018_07_01</groupId> | ||
<artifactId>azure-mgmt-media</artifactId> | ||
<version>1.0.0-beta-4</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.microsoft.rest</groupId> | ||
<artifactId>client-runtime</artifactId> | ||
<version>1.6.8</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.microsoft.azure</groupId> | ||
<artifactId>azure-client-authentication</artifactId> | ||
<version>1.6.8</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.microsoft.azure</groupId> | ||
<artifactId>azure-storage</artifactId> | ||
<version>8.3.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.microsoft.azure</groupId> | ||
<artifactId>azure-arm-client-runtime</artifactId> | ||
<version>1.6.8</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.microsoft.azure</groupId> | ||
<artifactId>azure-client-runtime</artifactId> | ||
<version>1.6.8</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.microsoft.azure</groupId> | ||
<artifactId>azure-storage-blob</artifactId> | ||
<version>11.0.1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.microsoft.azure</groupId> | ||
<artifactId>azure-eventhubs</artifactId> | ||
<version>2.3.2</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.microsoft.azure</groupId> | ||
<artifactId>azure-eventhubs-eph</artifactId> | ||
<version>2.5.2</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
<version>1.7.5</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-log4j12</artifactId> | ||
<version>1.7.5</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-databind</artifactId> | ||
<version>2.9.9.3</version> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.8.1</version> | ||
<configuration> | ||
<source>1.8</source> | ||
<target>1.8</target> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>exec-maven-plugin</artifactId> | ||
<version>1.4.0</version> | ||
<configuration> | ||
<mainClass>sample.AudioAnalyzer</mainClass> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
Oops, something went wrong.