AWS Elemental MediaConvert CreateJob Example Using theSDK for Java - AWS Elemental MediaConvert API Reference
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China.

AWS Elemental MediaConvert CreateJob Example Using theSDK for Java

For information about setting up your credentials and Amazon Region in your client configuration, see Set up Amazon Credentials and Region for Development in the Amazon SDK for Java Developer Guide.

This procedure shows you how to get your endpoint and send MediaConvert requests to it.

  1. Add the following import statements:

    import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration; import com.amazonaws.regions.Region; import*;
  2. Determine the Region for your endpoint and create an AWSMediaConvert client object for it:

    String region = "us-west-2"; AWSMediaConvert mediaConvertClient = AWSMediaConvertClientBuilder.standard() .withRegion(region) .build();
  3. Call the describeEndpoints method to retrieve the endpoint and save the endpoint's URL:

    DescribeEndpointsRequest request = new DescribeEndpointsRequest(); String endpoint = mediaConvertClient.describeEndpoints(request) .getEndpoints() .get(0).getUrl();

    Make the DescribeEndpoints call only once, then hardcode or cache your endpoint. This endpoint is specific to your Amazon Region and won't change.

    Don't use DescribeEndpoints to create your Amazon client each time that you make a request to MediaConvert. Otherwise, you will reach the throttle maximum on the public API endpoint.

  4. Create a job request and a submit job request object:

    CreateJobRequest jobParam = new CreateJobRequest() .withSettings(jobSettings); CreateJobResult mcResponse = new CreateJobResult(); mcResponse = mcClient.createJob(jobParam)

    The jobSettings object specifies your transcoding job settings. You can use the AWS Elemental MediaConvert console to generate your job specification in JSON format. For more information and sample JSON job specifications, see Creating Your Job Specification.

    After you specify your job in JSON format, translate it according to the SDK for Java documentation to create your jobSettings object.