AWS Elemental MediaConvert API Reference
API Reference

Getting Started with AWS Elemental MediaConvert Using the AWS SDKs or the AWS CLI

To get started with AWS Elemental MediaConvert using one of the AWS SDKS or the AWS Command Line Interface (AWS CLI), follow this general procedure. For specific instructions and examples, choose a language in the final step of this procedure.

  1. Set up AWS Identity and Access Management (IAM) permissions for both yourself and for the MediaConvert service to access your resources on your behalf:

    • For information about setting up permissions for yourself, see the IAM User Guide.

    • For information about setting up permissions for the service to access your resources, see the Set Up IAM Permissions topic of the MediaConvert User Guide.

  2. In your client configuration, specify your authentication credentials and your AWS Region. For instructions that are specific to the programming language that you use, choose from this list of links to open the relevant topics in the AWS CLI or SDK guides:

  3. Get your account-specific endpoint and send your MediaConvert requests to it. With most AWS services, you send your service request to a public endpoint. But with MediaConvert, you request an endpoint that is specific to your account, and then you send your service requests to that.

    For specific instructions and code samples, choose one of the following programming languages:

    AWS CLIC++GoJavaJavaScript.NETPHPPythonRubyTools for Powershell
    AWS CLI

    T create a transcoding job using the AWS Command Line Interface:

    1. Use describe-endpoints to get your account endpoint and set your region. In this example, the region is set to ap-northeast-3.:

      aws mediaconvert describe-endpoints --region ap-northeast-3
    2. Use the --endpoint-url option to send your request to your account endpoint:

      aws --endpoint-url=https://abcd1234.mediaconvert.region-name-1.amazonaws.com --region=region-name-1 mediaconvert create-job --cli-input-json=file://~/job.json

      In the preceding example, job.json specifies your transcoding job settings. You can use the MediaConvert console to generate the JSON job specification by choosing your job settings, and then choosing Show job JSON at the bottom of the Job section. For sample job specifications, see Sample Job Settings Specifications in JSON.

    C++

    To send requests using the SDK for C++:

    // MediaConvertPort.cpp : Defines the entry point for the console application. // #include "stdafx.h" // do not include this line in the example :) // Imports needed #include <aws/core/Aws.h> #include <aws/core/utils/Outcome.h> #include <aws/mediaconvert/MediaConvertClient.h> #include <aws/mediaconvert/Model/DescribeEndpointsRequest.h> #include <aws/mediaconvert/Model/CreateJobRequest.h> #include <aws/mediaconvert/Model/CreateJobResult.h> /* ---------------------------------------------- * Permissions IAM user needs to run this example * ---------------------------------------------- * { "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": [ "mediaconvert:DescribeEndpoints", "mediaconvert:CreateJob" ], "Resource": "*" } ] } */ /* -------------------------------------- * JSON job settings used in this example * -------------------------------------- * { "Queue": "arn:aws:mediaconvert:us-west-2:505474453218:queues/Default", "UserMetadata": { "Customer": "Amazon" }, "Role": "Your AWS Elemental MediaConvert role ARN", "Settings": { "OutputGroups": [ { "Name": "File Group", "OutputGroupSettings": { "Type": "FILE_GROUP_SETTINGS", "FileGroupSettings": { "Destination": "s3://youroutputdestination" } }, "Outputs": [ { "VideoDescription": { "ScalingBehavior": "DEFAULT", "TimecodeInsertion": "DISABLED", "AntiAlias": "ENABLED", "Sharpness": 50, "CodecSettings": { "Codec": "H_264", "H264Settings": { "InterlaceMode": "PROGRESSIVE", "NumberReferenceFrames": 3, "Syntax": "DEFAULT", "Softness": 0, "GopClosedCadence": 1, "GopSize": 90, "Slices": 1, "GopBReference": "DISABLED", "SlowPal": "DISABLED", "SpatialAdaptiveQuantization": "ENABLED", "TemporalAdaptiveQuantization": "ENABLED", "FlickerAdaptiveQuantization": "DISABLED", "EntropyEncoding": "CABAC", "Bitrate": 5000000, "FramerateControl": "SPECIFIED", "RateControlMode": "CBR", "CodecProfile": "MAIN", "Telecine": "NONE", "MinIInterval": 0, "AdaptiveQuantization": "HIGH", "CodecLevel": "AUTO", "FieldEncoding": "PAFF", "SceneChangeDetect": "ENABLED", "QualityTuningLevel": "SINGLE_PASS", "FramerateConversionAlgorithm": "DUPLICATE_DROP", "UnregisteredSeiTimecode": "DISABLED", "GopSizeUnits": "FRAMES", "ParControl": "SPECIFIED", "NumberBFramesBetweenReferenceFrames": 2, "RepeatPps": "DISABLED", "FramerateNumerator": 30, "FramerateDenominator": 1, "ParNumerator": 1, "ParDenominator": 1 } }, "AfdSignaling": "NONE", "DropFrameTimecode": "ENABLED", "RespondToAfd": "NONE", "ColorMetadata": "INSERT" }, "AudioDescriptions": [ { "AudioTypeControl": "FOLLOW_INPUT", "CodecSettings": { "Codec": "AAC", "AacSettings": { "AudioDescriptionBroadcasterMix": "NORMAL", "RateControlMode": "CBR", "CodecProfile": "LC", "CodingMode": "CODING_MODE_2_0", "RawFormat": "NONE", "SampleRate": 48000, "Specification": "MPEG4", "Bitrate": 64000 } }, "LanguageCodeControl": "FOLLOW_INPUT", "AudioSourceName": "Audio Selector 1" } ], "ContainerSettings": { "Container": "MP4", "Mp4Settings": { "CslgAtom": "INCLUDE", "FreeSpaceBox": "EXCLUDE", "MoovPlacement": "PROGRESSIVE_DOWNLOAD" } }, "NameModifier": "_1" } ] } ], "AdAvailOffset": 0, "Inputs": [ { "AudioSelectors": { "Audio Selector 1": { "Offset": 0, "DefaultSelection": "NOT_DEFAULT", "ProgramSelection": 1, "SelectorType": "TRACK", "Tracks": [ 1 ] } }, "VideoSelector": { "ColorSpace": "FOLLOW" }, "FilterEnable": "AUTO", "PsiControl": "USE_PSI", "FilterStrength": 0, "DeblockFilter": "DISABLED", "DenoiseFilter": "DISABLED", "TimecodeSource": "EMBEDDED", "FileInput": "s3://yourinputfile" } ], "TimecodeConfig": { "Source": "EMBEDDED" } } } */ int main() { // Initialize the C++ SDK Aws::SDKOptions options; Aws::InitAPI(options); { std::string mediaConvertRole = "arn:aws:iam::640773029566:role/media-convert-role"; std::string fileInput = "s3://media-convert-sample/my-video.mp4"; std::string fileOutput = "s3://media-convert-sample"; // Once you know what your customer endpoint is, set it here std::string mediaConvertEndpoint = ""; // If we do not have our customer-specific endpoint if (mediaConvertEndpoint.empty()) { // Obtain the customer-specific MediaConvert endpoint Aws::Client::ClientConfiguration clientConfig; clientConfig.region = "us-west-2"; Aws::MediaConvert::MediaConvertClient client(clientConfig); Aws::MediaConvert::Model::DescribeEndpointsRequest request; // need to strip https:// from endpoint for C++ mediaConvertEndpoint = client.DescribeEndpoints(request).GetResult().GetEndpoints().at(0).GetUrl().substr(8); } // Create MediaConvert Client with the endpoints and region from above Aws::Client::ClientConfiguration mcClientConfig; // also need to set region endpoint, must match endpoint embedded in custom endpoint mcClientConfig.region = "us-west-2"; mcClientConfig.endpointOverride = mediaConvertEndpoint; Aws::MediaConvert::MediaConvertClient mcClient(mcClientConfig); // Create Job request Aws::MediaConvert::Model::CreateJobRequest createJobRequest; createJobRequest.SetRole(mediaConvertRole); Aws::Http::HeaderValueCollection hvc; hvc.emplace("Customer", "Amazon"); createJobRequest.SetUserMetadata(hvc); // Create job settings Aws::MediaConvert::Model::JobSettings jobSettings; jobSettings.SetAdAvailOffset(0); Aws::MediaConvert::Model::TimecodeConfig timecodeConfig; timecodeConfig.SetSource(Aws::MediaConvert::Model::TimecodeSource::EMBEDDED); jobSettings.SetTimecodeConfig(timecodeConfig); createJobRequest.SetSettings(jobSettings); // Output Group Aws::MediaConvert::Model::OutputGroup og; og.SetName("File Group"); Aws::MediaConvert::Model::OutputGroupSettings ogs; ogs.SetType(Aws::MediaConvert::Model::OutputGroupType::FILE_GROUP_SETTINGS); Aws::MediaConvert::Model::FileGroupSettings fgs; fgs.SetDestination(fileOutput); ogs.SetFileGroupSettings(fgs); og.SetOutputGroupSettings(ogs); Aws::MediaConvert::Model::Output output; output.SetNameModifier("_1"); Aws::MediaConvert::Model::VideoDescription vdes; vdes.SetScalingBehavior(Aws::MediaConvert::Model::ScalingBehavior::DEFAULT); vdes.SetTimecodeInsertion(Aws::MediaConvert::Model::VideoTimecodeInsertion::DISABLED); vdes.SetAntiAlias(Aws::MediaConvert::Model::AntiAlias::ENABLED); vdes.SetSharpness(50); vdes.SetAfdSignaling(Aws::MediaConvert::Model::AfdSignaling::NONE); vdes.SetDropFrameTimecode(Aws::MediaConvert::Model::DropFrameTimecode::ENABLED); vdes.SetRespondToAfd(Aws::MediaConvert::Model::RespondToAfd::NONE); vdes.SetColorMetadata(Aws::MediaConvert::Model::ColorMetadata::INSERT); Aws::MediaConvert::Model::VideoCodecSettings vcs; vcs.SetCodec(Aws::MediaConvert::Model::VideoCodec::H_264); Aws::MediaConvert::Model::H264Settings h264; h264.SetNumberReferenceFrames(3); h264.SetSyntax(Aws::MediaConvert::Model::H264Syntax::DEFAULT); h264.SetSoftness(0); h264.SetGopClosedCadence(1); h264.SetGopSize(90); h264.SetSlices(1); h264.SetGopBReference(Aws::MediaConvert::Model::H264GopBReference::DISABLED); h264.SetSlowPal(Aws::MediaConvert::Model::H264SlowPal::DISABLED); h264.SetSpatialAdaptiveQuantization(Aws::MediaConvert::Model::H264SpatialAdaptiveQuantization::ENABLED); h264.SetTemporalAdaptiveQuantization(Aws::MediaConvert::Model::H264TemporalAdaptiveQuantization::ENABLED); h264.SetFlickerAdaptiveQuantization(Aws::MediaConvert::Model::H264FlickerAdaptiveQuantization::DISABLED); h264.SetEntropyEncoding(Aws::MediaConvert::Model::H264EntropyEncoding::CABAC); h264.SetBitrate(5000000); h264.SetFramerateControl(Aws::MediaConvert::Model::H264FramerateControl::SPECIFIED); h264.SetRateControlMode(Aws::MediaConvert::Model::H264RateControlMode::CBR); h264.SetCodecProfile(Aws::MediaConvert::Model::H264CodecProfile::MAIN); h264.SetTelecine(Aws::MediaConvert::Model::H264Telecine::NONE); h264.SetMinIInterval(0); h264.SetAdaptiveQuantization(Aws::MediaConvert::Model::H264AdaptiveQuantization::HIGH); h264.SetCodecLevel(Aws::MediaConvert::Model::H264CodecLevel::AUTO); h264.SetFieldEncoding(Aws::MediaConvert::Model::H264FieldEncoding::PAFF); h264.SetSceneChangeDetect(Aws::MediaConvert::Model::H264SceneChangeDetect::ENABLED); h264.SetQualityTuningLevel(Aws::MediaConvert::Model::H264QualityTuningLevel::SINGLE_PASS); h264.SetFramerateConversionAlgorithm(Aws::MediaConvert::Model::H264FramerateConversionAlgorithm::DUPLICATE_DROP); h264.SetUnregisteredSeiTimecode(Aws::MediaConvert::Model::H264UnregisteredSeiTimecode::DISABLED); h264.SetGopSizeUnits(Aws::MediaConvert::Model::H264GopSizeUnits::FRAMES); h264.SetParControl(Aws::MediaConvert::Model::H264ParControl::SPECIFIED); h264.SetNumberBFramesBetweenReferenceFrames(2); h264.SetRepeatPps(Aws::MediaConvert::Model::H264RepeatPps::DISABLED); h264.SetFramerateNumerator(30); h264.SetFramerateDenominator(1); h264.SetParNumerator(1); h264.SetParDenominator(1); vcs.SetH264Settings(h264); vdes.SetCodecSettings(vcs); output.SetVideoDescription(vdes); Aws::MediaConvert::Model::AudioDescription ades; ades.SetLanguageCodeControl(Aws::MediaConvert::Model::AudioLanguageCodeControl::FOLLOW_INPUT); // This name matches one specified in the Inputs below ades.SetAudioSourceName("Audio Selector 1"); Aws::MediaConvert::Model::AudioCodecSettings acs; acs.SetCodec(Aws::MediaConvert::Model::AudioCodec::AAC); Aws::MediaConvert::Model::AacSettings aac; aac.SetAudioDescriptionBroadcasterMix(Aws::MediaConvert::Model::AacAudioDescriptionBroadcasterMix::NORMAL); aac.SetRateControlMode(Aws::MediaConvert::Model::AacRateControlMode::CBR); aac.SetCodecProfile(Aws::MediaConvert::Model::AacCodecProfile::LC); aac.SetCodingMode(Aws::MediaConvert::Model::AacCodingMode::CODING_MODE_2_0); aac.SetRawFormat(Aws::MediaConvert::Model::AacRawFormat::NONE); aac.SetSampleRate(48000); aac.SetSpecification(Aws::MediaConvert::Model::AacSpecification::MPEG4); aac.SetBitrate(64000); acs.SetAacSettings(aac); ades.SetCodecSettings(acs); Aws::Vector<Aws::MediaConvert::Model::AudioDescription> adess; adess.emplace_back(ades); output.SetAudioDescriptions(adess); Aws::MediaConvert::Model::ContainerSettings mp4container; mp4container.SetContainer(Aws::MediaConvert::Model::ContainerType::MP4); Aws::MediaConvert::Model::Mp4Settings mp4; mp4.SetCslgAtom(Aws::MediaConvert::Model::Mp4CslgAtom::INCLUDE); mp4.SetFreeSpaceBox(Aws::MediaConvert::Model::Mp4FreeSpaceBox::EXCLUDE); mp4.SetMoovPlacement(Aws::MediaConvert::Model::Mp4MoovPlacement::PROGRESSIVE_DOWNLOAD); mp4container.SetMp4Settings(mp4); output.SetContainerSettings(mp4container); og.AddOutputs(output); jobSettings.AddOutputGroups(og); // End Output Group Aws::MediaConvert::Model::Input input; input.SetFilterEnable(Aws::MediaConvert::Model::InputFilterEnable::AUTO); input.SetPsiControl(Aws::MediaConvert::Model::InputPsiControl::USE_PSI); input.SetFilterStrength(0); input.SetDeblockFilter(Aws::MediaConvert::Model::InputDeblockFilter::DISABLED); input.SetDenoiseFilter(Aws::MediaConvert::Model::InputDenoiseFilter::DISABLED); input.SetTimecodeSource(Aws::MediaConvert::Model::InputTimecodeSource::EMBEDDED); input.SetFileInput(fileInput); Aws::MediaConvert::Model::AudioSelector audsel; audsel.SetOffset(0); audsel.SetDefaultSelection(Aws::MediaConvert::Model::AudioDefaultSelection::NOT_DEFAULT); audsel.SetProgramSelection(1); audsel.SetSelectorType(Aws::MediaConvert::Model::AudioSelectorType::TRACK); audsel.AddTracks(1); input.AddAudioSelectors("Audio Select 1", audsel); Aws::MediaConvert::Model::VideoSelector vidsel; vidsel.SetColorSpace(Aws::MediaConvert::Model::ColorSpace::FOLLOW); input.SetVideoSelector(vidsel); jobSettings.AddInputs(input); createJobRequest.SetSettings(jobSettings); Aws::MediaConvert::Model::CreateJobOutcome createJobResponse = mcClient.CreateJob(createJobRequest); std::cout << createJobResponse.GetResult().GetJob().GetId() << std::endl; } Aws::ShutdownAPI(options); return 0; }
    Go

    After you use the DescribeEndpoints method to request an account-specific endpoint, send your requests to it as described in the Creating an Account Endpoint topic in the AWS SDK for Go Developer Guide.

    Important

    Make the DescribeEndpoints call only once in your application. Don't use DescribeEndpoints to create your AWS client each time that you make a request to MediaConvert. Otherwise, you will reach the throttle maximum on the public API endpoint.

    Java

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

    This procedure shows you how to get your account-specific 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 com.amazonaws.services.mediaconvert.*;
    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();

      Important

      Make the DescribeEndpoints call only once in your application. Don't use DescribeEndpoints to create your AWS 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)

      Note

      The jobSettings object contains settings parameters. For sample JSON file job specifications, see Sample Job Settings Specifications in JSON.

    JavaScript

    To send requests using the AWS SDK for JavaScript:

    1. Get your account-specific endpoint.

      Create a Node.js module with the file name emc_getendpoint.js.

      Create an object to pass the empty request parameters for the describeEndpoints method of the AWS.MediaConvert client class. To call the describeEndpoints method, create a promise for invoking an MediaConvert service object, passing the parameters. Then handle the response in the promise callback.

      Important

      Make the DescribeEndpoints call only once in your application. Don't use DescribeEndpoints to create your AWS client each time that you make a request to MediaConvert. Otherwise, you will reach the throttle maximum on the public API endpoint.

      // Load the AWS SDK for Node.js var AWS = require( 'aws-sdk'); // Set the region AWS.config.update({ region: 'us-west-2'}); // Create empty request parameters var params = { MaxResults: 0, }; // Create a promise on a MediaConvert object var endpointPromise = new AWS.MediaConvert({ apiVersion:'2017-08-29'}).describeEndpoints(params).promise(); endpointPromise.then( function ( data ) { console.log( "Your MediaConvert endpoint is ", data.Endpoints); }, function ( err ) { console.log( "Error", err); } );

      To run the example, type the following at the command line:

      node ec2_getendpoint.js
    2. Configure the SDK.

      Configure the SDK for JavaScript by creating a global configuration object, and then setting the region for your code. In this example, the region is set to us-west-2. Because AWS Elemental MediaConvert uses endpoints that are unique to each AWS account , you must also configure the AWS.MediaConvert client class to use your custom endpoint. To do this, set the endpoint parameter on AWS.config.mediaconvert.

    3. Define your transcoding job.

      Create a Node.js module with the file name emc_createjob.js. Create the JSON that defines the transcode job parameters. These parameters are detailed. You can use the AWS Elemental MediaConvert console to generate the JSON job specification by choosing your job settings, and then choosing Show job JSON at the bottom of the Job section. For sample job specifications, see Sample Job Settings Specifications in JSON.

      For your Node.js module, wrap the JSON job specification as follows:

      var params = { JSON job specification here }
    4. Create your transcoding job.

      After creating the job parameters JSON, call the createJob method by creating a promise for invoking an AWS.MediaConvert service object, passing the parameters. Then handle the response in the promise callback. The ID of the job that is created is returned in the response data:

      // Create a promise on a MediaConvert object var endpointPromise = new AWS.MediaConvert({ apiVersion: '2017-08-29'}).createJob(params).promise(); // Handle the promise's fulfilled/rejected status endpointPromise.then( function ( data ) { console.log( "Job created! ", data); }, function ( err ) { console.log( "Error", err); } );

      To run the example, type the following at the command line:

      node ec2_createjob.js
    .NET

    To send requests using the AWS SDK for .NET:

    using System; using Amazon.MediaConvert; using Amazon.MediaConvert.Model; namespace MediaConvertNET { /* ---------------------------------------------- * Permissions IAM user needs to run this example * ---------------------------------------------- * { "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": [ "mediaconvert:DescribeEndpoints", "mediaconvert:CreateJob" ], "Resource": "*" } ] } */ /* -------------------------------------- * JSON job settings used in this example * -------------------------------------- * { "Queue": "arn:aws:mediaconvert:us-west-2:505474453218:queues/Default", "UserMetadata": { "Customer": "Amazon" }, "Role": "Your AWS Elemental MediaConvert role ARN", "Settings": { "OutputGroups": [ { "Name": "File Group", "OutputGroupSettings": { "Type": "FILE_GROUP_SETTINGS", "FileGroupSettings": { "Destination": "s3://youroutputdestination" } }, "Outputs": [ { "VideoDescription": { "ScalingBehavior": "DEFAULT", "TimecodeInsertion": "DISABLED", "AntiAlias": "ENABLED", "Sharpness": 50, "CodecSettings": { "Codec": "H_264", "H264Settings": { "InterlaceMode": "PROGRESSIVE", "NumberReferenceFrames": 3, "Syntax": "DEFAULT", "Softness": 0, "GopClosedCadence": 1, "GopSize": 90, "Slices": 1, "GopBReference": "DISABLED", "SlowPal": "DISABLED", "SpatialAdaptiveQuantization": "ENABLED", "TemporalAdaptiveQuantization": "ENABLED", "FlickerAdaptiveQuantization": "DISABLED", "EntropyEncoding": "CABAC", "Bitrate": 5000000, "FramerateControl": "SPECIFIED", "RateControlMode": "CBR", "CodecProfile": "MAIN", "Telecine": "NONE", "MinIInterval": 0, "AdaptiveQuantization": "HIGH", "CodecLevel": "AUTO", "FieldEncoding": "PAFF", "SceneChangeDetect": "ENABLED", "QualityTuningLevel": "SINGLE_PASS", "FramerateConversionAlgorithm": "DUPLICATE_DROP", "UnregisteredSeiTimecode": "DISABLED", "GopSizeUnits": "FRAMES", "ParControl": "SPECIFIED", "NumberBFramesBetweenReferenceFrames": 2, "RepeatPps": "DISABLED", "FramerateNumerator": 30, "FramerateDenominator": 1, "ParNumerator": 1, "ParDenominator": 1 } }, "AfdSignaling": "NONE", "DropFrameTimecode": "ENABLED", "RespondToAfd": "NONE", "ColorMetadata": "INSERT" }, "AudioDescriptions": [ { "AudioTypeControl": "FOLLOW_INPUT", "CodecSettings": { "Codec": "AAC", "AacSettings": { "AudioDescriptionBroadcasterMix": "NORMAL", "RateControlMode": "CBR", "CodecProfile": "LC", "CodingMode": "CODING_MODE_2_0", "RawFormat": "NONE", "SampleRate": 48000, "Specification": "MPEG4", "Bitrate": 64000 } }, "LanguageCodeControl": "FOLLOW_INPUT", "AudioSourceName": "Audio Selector 1" } ], "ContainerSettings": { "Container": "MP4", "Mp4Settings": { "CslgAtom": "INCLUDE", "FreeSpaceBox": "EXCLUDE", "MoovPlacement": "PROGRESSIVE_DOWNLOAD" } }, "NameModifier": "_1" } ] } ], "AdAvailOffset": 0, "Inputs": [ { "AudioSelectors": { "Audio Selector 1": { "Offset": 0, "DefaultSelection": "NOT_DEFAULT", "ProgramSelection": 1, "SelectorType": "TRACK", "Tracks": [ 1 ] } }, "VideoSelector": { "ColorSpace": "FOLLOW" }, "FilterEnable": "AUTO", "PsiControl": "USE_PSI", "FilterStrength": 0, "DeblockFilter": "DISABLED", "DenoiseFilter": "DISABLED", "TimecodeSource": "EMBEDDED", "FileInput": "s3://yourinputfile" } ], "TimecodeConfig": { "Source": "EMBEDDED" } } } */ class Program { static void Main(string[] args) { String mediaConvertRole = "Your AWS Elemental MediaConvert role ARN"; String fileInput = "s3://yourinputfile"; String fileOutput = "s3://youroutputdestination"; // Once you know what your customer endpoint is, set it here String mediaConvertEndpoint = ""; // If we do not have our customer-specific endpoint if (String.IsNullOrEmpty(mediaConvertEndpoint)) { // Obtain the customer-specific MediaConvert endpoint AmazonMediaConvertClient client = new AmazonMediaConvertClient(Amazon.RegionEndpoint.USWest2); DescribeEndpointsRequest describeRequest = new DescribeEndpointsRequest(); DescribeEndpointsResponse describeResponse = client.DescribeEndpoints(describeRequest); mediaConvertEndpoint = describeResponse.Endpoints[0].Url; } // Since we have a service url for MediaConvert, we do not // need to set RegionEndpoint. If we do, the ServiceURL will // be overwritten AmazonMediaConvertConfig mcConfig = new AmazonMediaConvertConfig { ServiceURL = mediaConvertEndpoint, }; AmazonMediaConvertClient mcClient = new AmazonMediaConvertClient(mcConfig); CreateJobRequest createJobRequest = new CreateJobRequest(); createJobRequest.Role = mediaConvertRole; createJobRequest.UserMetadata.Add("Customer", "Amazon"); #region Create job settings JobSettings jobSettings = new JobSettings(); jobSettings.AdAvailOffset = 0; jobSettings.TimecodeConfig = new TimecodeConfig(); jobSettings.TimecodeConfig.Source = TimecodeSource.EMBEDDED; createJobRequest.Settings = jobSettings; #region OutputGroup OutputGroup ofg = new OutputGroup(); ofg.Name = "File Group"; ofg.OutputGroupSettings = new OutputGroupSettings(); ofg.OutputGroupSettings.Type = OutputGroupType.FILE_GROUP_SETTINGS; ofg.OutputGroupSettings.FileGroupSettings = new FileGroupSettings(); ofg.OutputGroupSettings.FileGroupSettings.Destination = fileOutput; Output output = new Output(); output.NameModifier = "_1"; #region VideoDescription VideoDescription vdes = new VideoDescription(); output.VideoDescription = vdes; vdes.ScalingBehavior = ScalingBehavior.DEFAULT; vdes.TimecodeInsertion = VideoTimecodeInsertion.DISABLED; vdes.AntiAlias = AntiAlias.ENABLED; vdes.Sharpness = 50; vdes.AfdSignaling = AfdSignaling.NONE; vdes.DropFrameTimecode = DropFrameTimecode.ENABLED; vdes.RespondToAfd = RespondToAfd.NONE; vdes.ColorMetadata = ColorMetadata.INSERT; vdes.CodecSettings = new VideoCodecSettings(); vdes.CodecSettings.Codec = VideoCodec.H_264; H264Settings h264 = new H264Settings(); h264.InterlaceMode = H264InterlaceMode.PROGRESSIVE; h264.NumberReferenceFrames = 3; h264.Syntax = H264Syntax.DEFAULT; h264.Softness = 0; h264.GopClosedCadence = 1; h264.GopSize = 90; h264.Slices = 1; h264.GopBReference = H264GopBReference.DISABLED; h264.SlowPal = H264SlowPal.DISABLED; h264.SpatialAdaptiveQuantization = H264SpatialAdaptiveQuantization.ENABLED; h264.TemporalAdaptiveQuantization = H264TemporalAdaptiveQuantization.ENABLED; h264.FlickerAdaptiveQuantization = H264FlickerAdaptiveQuantization.DISABLED; h264.EntropyEncoding = H264EntropyEncoding.CABAC; h264.Bitrate = 5000000; h264.FramerateControl = H264FramerateControl.SPECIFIED; h264.RateControlMode = H264RateControlMode.CBR; h264.CodecProfile = H264CodecProfile.MAIN; h264.Telecine = H264Telecine.NONE; h264.MinIInterval = 0; h264.AdaptiveQuantization = H264AdaptiveQuantization.HIGH; h264.CodecLevel = H264CodecLevel.AUTO; h264.FieldEncoding = H264FieldEncoding.PAFF; h264.SceneChangeDetect = H264SceneChangeDetect.ENABLED; h264.QualityTuningLevel = H264QualityTuningLevel.SINGLE_PASS; h264.FramerateConversionAlgorithm = H264FramerateConversionAlgorithm.DUPLICATE_DROP; h264.UnregisteredSeiTimecode = H264UnregisteredSeiTimecode.DISABLED; h264.GopSizeUnits = H264GopSizeUnits.FRAMES; h264.ParControl = H264ParControl.SPECIFIED; h264.NumberBFramesBetweenReferenceFrames = 2; h264.RepeatPps = H264RepeatPps.DISABLED; h264.FramerateNumerator = 30; h264.FramerateDenominator = 1; h264.ParNumerator = 1; h264.ParDenominator = 1; output.VideoDescription.CodecSettings.H264Settings = h264; #endregion VideoDescription #region AudioDescription AudioDescription ades = new AudioDescription(); ades.LanguageCodeControl = AudioLanguageCodeControl.FOLLOW_INPUT; // This name matches one specified in the Inputs below ades.AudioSourceName = "Audio Selector 1"; ades.CodecSettings = new AudioCodecSettings(); ades.CodecSettings.Codec = AudioCodec.AAC; AacSettings aac = new AacSettings(); aac.AudioDescriptionBroadcasterMix = AacAudioDescriptionBroadcasterMix.NORMAL; aac.RateControlMode = AacRateControlMode.CBR; aac.CodecProfile = AacCodecProfile.LC; aac.CodingMode = AacCodingMode.CODING_MODE_2_0; aac.RawFormat = AacRawFormat.NONE; aac.SampleRate = 48000; aac.Specification = AacSpecification.MPEG4; aac.Bitrate = 64000; ades.CodecSettings.AacSettings = aac; output.AudioDescriptions.Add(ades); #endregion AudioDescription #region Mp4 Container output.ContainerSettings = new ContainerSettings(); output.ContainerSettings.Container = ContainerType.MP4; Mp4Settings mp4 = new Mp4Settings(); mp4.CslgAtom = Mp4CslgAtom.INCLUDE; mp4.FreeSpaceBox = Mp4FreeSpaceBox.EXCLUDE; mp4.MoovPlacement = Mp4MoovPlacement.PROGRESSIVE_DOWNLOAD; output.ContainerSettings.Mp4Settings = mp4; #endregion Mp4 Container ofg.Outputs.Add(output); createJobRequest.Settings.OutputGroups.Add(ofg); #endregion OutputGroup #region Input Input input = new Input(); input.FilterEnable = InputFilterEnable.AUTO; input.PsiControl = InputPsiControl.USE_PSI; input.FilterStrength = 0; input.DeblockFilter = InputDeblockFilter.DISABLED; input.DenoiseFilter = InputDenoiseFilter.DISABLED; input.TimecodeSource = InputTimecodeSource.EMBEDDED; input.FileInput = fileInput; AudioSelector audsel = new AudioSelector(); audsel.Offset = 0; audsel.DefaultSelection = AudioDefaultSelection.NOT_DEFAULT; audsel.ProgramSelection = 1; audsel.SelectorType = AudioSelectorType.TRACK; audsel.Tracks.Add(1); input.AudioSelectors.Add("Audio Selector 1", audsel); input.VideoSelector = new VideoSelector(); input.VideoSelector.ColorSpace = ColorSpace.FOLLOW; createJobRequest.Settings.Inputs.Add(input); #endregion Input #endregion Create job settings try { CreateJobResponse createJobResponse = mcClient.CreateJob(createJobRequest); Console.WriteLine("Job Id: {0}", createJobResponse.Job.Id); } catch (BadRequestException bre) { // If the enpoint was bad if (bre.Message.StartsWith("You must use the customer-")) { // The exception contains the correct endpoint; extract it mediaConvertEndpoint = bre.Message.Split('\'')[1]; // Code to retry query } } } } }

    For more information about sending requests to an account endpoint, see the Overriding Endpoints in the AWS SDK for .NET post in the AWS Developer Blog.

    PHP

    After you use the DescribeEndpoints method to request an account-specific endpoint, send your requests to it as described in the Configuration Options > endpoint topic in the AWS SDK for PHP Developer Guide.

    To send MediaConvert requests using the AWS SDK for PHP:

    1. Add the following import statements:

      require 'vendor/autoload.php'; use Aws\MediaConvert\MediaConvertClient; use Aws\Exception\AwsException;
    2. Determine the region for your endpoint and create an AWSMediaConvert client object for it:

      $client = new Aws\MediaConvert\MediaConvertClient([ 'profile' => 'default', 'version' => '2017-08-29', 'region' => 'us-east-1' ]);
    3. Call the describeEndpoints method to retrieve the endpoint and save the endpoint's URL:

      $URI = $client->getEndpoint() //Returns UriInterface $endpoints= $client->describeEndpoints(['NextToken' => '']); $token = $URI->getHost(); try { $result = $client->describeEndpoints([]); }catch (AwsException $e) { // output error message if fails echo $e->getMessage(); echo "\n"; } $single_endpoint_url = $result['Endpoints'][0]['Url'];
    4. Create another AWSMediaConvert client object using the region and the endpoint URL that you just retrieved:

      $mediaConvertClient = new MediaConvertClient([ 'profile' => 'default', 'version' => '2017-08-29', 'region' => 'us-east-1', 'endpoint' => $single_endpoint_url ]);

      This is the client object to use for all of your job requests.

    5. Create a job request and submit it:

      try { $result = $mediaConvertClient -> createJob([ ClientRequestToken => , //String Idempotency token for CreateJob operation. JobTemplate => , //String either a job template or the transcoding settings Role => 'ARN' , //REQUIRED The IAM role you use for creating this job. Settings => $jobSetting , //Settings is a JobSettings object that contains Settings parameters. Queue => ,//Optional ]); }catch (AwsException $e) { // output error message if fails echo $e->getMessage(); echo "\n"; }

      For more information on the createJob call, see https://docs-aws.amazon.com/aws-sdk-php/v3/api/api-mediaconvert-2017-08-29.html#createjob.

    Each job converts an input file into an output file or files. For more information, see the AWS Elemental MediaConvert User Guide at https://docs.aws.amazon.com/mediaconvert/latest/ug/.

    Simple example: Job settings for MediaConvert:

    $jobSetting = [ "OutputGroups" => [ [ "Name" => "File Group", "OutputGroupSettings" => [ "Type" => "FILE_GROUP_SETTINGS", "FileGroupSettings" => [ "Destination" => "s3://testbucket/output" ] ], "Outputs" => [ [ "VideoDescription" => [ "ScalingBehavior" => "DEFAULT", "TimecodeInsertion" => "DISABLED", "AntiAlias" => "ENABLED", "Sharpness" => 50, "CodecSettings" => [ "Codec" => "H_264", "H264Settings" => [ "InterlaceMode" => "PROGRESSIVE", "NumberReferenceFrames" => 3, "Syntax" => "DEFAULT", "Softness" => 0, "GopClosedCadence" => 1, "GopSize" => 90, "Slices" => 1, "GopBReference" => "DISABLED", "SlowPal" => "DISABLED", "SpatialAdaptiveQuantization" => "ENABLED", "TemporalAdaptiveQuantization" => "ENABLED", "FlickerAdaptiveQuantization" => "DISABLED", "EntropyEncoding" => "CABAC", "Bitrate" => 5000000, "FramerateControl" => "SPECIFIED", "RateControlMode" => "CBR", "CodecProfile" => "MAIN", "Telecine" => "NONE", "MinIInterval" => 0, "AdaptiveQuantization" => "HIGH", "CodecLevel" => "AUTO", "FieldEncoding" => "PAFF", "SceneChangeDetect" => "ENABLED", "QualityTuningLevel" => "SINGLE_PASS", "FramerateConversionAlgorithm" => "DUPLICATE_DROP", "UnregisteredSeiTimecode" => "DISABLED", "GopSizeUnits" => "FRAMES", "ParControl" => "SPECIFIED", "NumberBFramesBetweenReferenceFrames" => 2, "RepeatPps" => "DISABLED", "FramerateNumerator" => 30, "FramerateDenominator" => 1, "ParNumerator" => 1, "ParDenominator" => 1 ] ], "AfdSignaling" => "NONE", "DropFrameTimecode" => "ENABLED", "RespondToAfd" => "NONE", "ColorMetadata" => "INSERT" ], "AudioDescriptions" => [ [ "AudioTypeControl" => "FOLLOW_INPUT", "CodecSettings" => [ "Codec" => "AAC", "AacSettings" => [ "AudioDescriptionBroadcasterMix" => "NORMAL", "RateControlMode" => "CBR", "CodecProfile" => "LC", "CodingMode" => "CODING_MODE_2_0", "RawFormat" => "NONE", "SampleRate" => 48000, "Specification" => "MPEG4", "Bitrate" => 64000 ] ], "LanguageCodeControl" => "FOLLOW_INPUT", "AudioSourceName" => "Audio Selector 1" ] ], "ContainerSettings" => [ "Container" => "MP4", "Mp4Settings" => [ "CslgAtom" => "INCLUDE", "FreeSpaceBox" => "EXCLUDE", "MoovPlacement" => "PROGRESSIVE_DOWNLOAD" ] ], "NameModifier" => "_1" ] ] ] ], "AdAvailOffset" => 0, "Inputs" => [ [ "AudioSelectors" => [ "Audio Selector 1" => [ "Offset" => 0, "DefaultSelection" => "NOT_DEFAULT", "ProgramSelection" => 1, "SelectorType" => "TRACK", "Tracks" => [ 1 ] ] ], "VideoSelector" => [ "ColorSpace" => "FOLLOW" ], "FilterEnable" => "AUTO", "PsiControl" => "USE_PSI", "FilterStrength" => 0, "DeblockFilter" => "DISABLED", "DenoiseFilter" => "DISABLED", "TimecodeSource" => "EMBEDDED", "FileInput" => "s3://aws-website-scout-99sou/feed/WrongPriorities.mp4" ] ], "TimecodeConfig" => [ "Source" => "EMBEDDED" ] ];

    Complex example: Job settings for MediaConvert:

    "Queue" => "arn => aws => mediaconvert => us-west-2 => 111122223333 => queues/Default", "UserMetadata" => [ "Customer" => "Amazon" ], "Role" => "arn => aws => iam => => 111122223333 => role/MediaConvertRole", "Settings" => [ "OutputGroups" => [ [ "CustomName" => "", "Name" => "DASH ISO", "Outputs" => [ [ "ContainerSettings" => [ "Container" => "MPD" ], "VideoDescription" => [ "Width" => 1080, "ScalingBehavior" => "DEFAULT", "Height" => 720, "TimecodeInsertion" => "DISABLED", "AntiAlias" => "ENABLED", "Sharpness" => 50, "CodecSettings" => [ "Codec" => "H_264", "H264Settings" => [ "InterlaceMode" => "PROGRESSIVE", "NumberReferenceFrames" => 3, "Syntax" => "DEFAULT", "Softness" => 0, "GopClosedCadence" => 1, "GopSize" => 30, "Slices" => 1, "GopBReference" => "DISABLED", "SlowPal" => "DISABLED", "SpatialAdaptiveQuantization" => "ENABLED", "TemporalAdaptiveQuantization" => "ENABLED", "FlickerAdaptiveQuantization" => "DISABLED", "EntropyEncoding" => "CABAC", "Bitrate" => 5000000, "FramerateControl" => "INITIALIZE_FROM_SOURCE", "RateControlMode" => "CBR", "CodecProfile" => "MAIN", "Telecine" => "NONE", "MinIInterval" => 0, "AdaptiveQuantization" => "HIGH", "CodecLevel" => "AUTO", "FieldEncoding" => "PAFF", "SceneChangeDetect" => "ENABLED", "QualityTuningLevel" => "SINGLE_PASS", "FramerateConversionAlgorithm" => "DUPLICATE_DROP", "UnregisteredSeiTimecode" => "DISABLED", "GopSizeUnits" => "FRAMES", "ParControl" => "INITIALIZE_FROM_SOURCE", "NumberBFramesBetweenReferenceFrames" => 2, "RepeatPps" => "DISABLED", "HrdBufferSize" => 10000000 ] ], "AfdSignaling" => "NONE", "DropFrameTimecode" => "ENABLED", "RespondToAfd" => "NONE", "ColorMetadata" => "INSERT" ], "NameModifier" => "-1080" ], [ "ContainerSettings" => [ "Container" => "MPD" ], "AudioDescriptions" => [ [ "AudioTypeControl" => "FOLLOW_INPUT", "AudioSourceName" => "Audio Selector 1", "CodecSettings" => [ "Codec" => "AAC", "AacSettings" => [ "AudioDescriptionBroadcasterMix" => "NORMAL", "Bitrate" => 96000, "RateControlMode" => "CBR", "CodecProfile" => "LC", "CodingMode" => "CODING_MODE_2_0", "RawFormat" => "NONE", "SampleRate" => 48000, "Specification" => "MPEG4" ] ], "LanguageCodeControl" => "FOLLOW_INPUT" ] ], "NameModifier" => "-audio" ] ], "OutputGroupSettings" => [ "Type" => "DASH_ISO_GROUP_SETTINGS", "DashIsoGroupSettings" => [ "SegmentLength" => 30, "Destination" => "s3 => //testbucket/drm/10/dash-drm/master", "Encryption" => [ "SpekeKeyProvider" => [ "ResourceId" => "drm-test-1", "SystemIds" => [ "edef8ba9-79d6-4ace-a3c8-27dcd51d21ed" ], "Url" => "https => //abcdefg123.execute-api.us-west-2.amazonaws.com/live/speke/v1.0/copyProtection" ] ], "FragmentLength" => 2, "SegmentControl" => "SINGLE_FILE", "HbbtvCompliance" => "NONE" ] ] ], [ "Name" => "Apple HLS", "OutputGroupSettings" => [ "Type" => "HLS_GROUP_SETTINGS", "HlsGroupSettings" => [ "ManifestDurationFormat" => "INTEGER", "SegmentLength" => 10, "TimedMetadataId3Period" => 10, "CaptionLanguageSetting" => "OMIT", "TimedMetadataId3Frame" => "PRIV", "CodecSpecification" => "RFC_4281", "OutputSelection" => "MANIFESTS_AND_SEGMENTS", "ProgramDateTimePeriod" => 600, "MinSegmentLength" => 0, "DirectoryStructure" => "SINGLE_DIRECTORY", "ProgramDateTime" => "EXCLUDE", "SegmentControl" => "SEGMENTED_FILES", "ManifestCompression" => "NONE", "ClientCache" => "ENABLED", "StreamInfResolution" => "INCLUDE", "Destination" => "s3 => //testbucket/hls/no-drm/master" ] ], "Outputs" => [ [ "VideoDescription" => [ "ScalingBehavior" => "DEFAULT", "TimecodeInsertion" => "DISABLED", "AntiAlias" => "ENABLED", "Sharpness" => 50, "CodecSettings" => [ "Codec" => "H_264", "H264Settings" => [ "InterlaceMode" => "PROGRESSIVE", "NumberReferenceFrames" => 3, "Syntax" => "DEFAULT", "Softness" => 0, "GopClosedCadence" => 1, "GopSize" => 90, "Slices" => 1, "GopBReference" => "DISABLED", "SlowPal" => "DISABLED", "SpatialAdaptiveQuantization" => "ENABLED", "TemporalAdaptiveQuantization" => "ENABLED", "FlickerAdaptiveQuantization" => "DISABLED", "EntropyEncoding" => "CABAC", "Bitrate" => 5000000, "FramerateControl" => "INITIALIZE_FROM_SOURCE", "RateControlMode" => "CBR", "CodecProfile" => "MAIN", "Telecine" => "NONE", "MinIInterval" => 0, "AdaptiveQuantization" => "HIGH", "CodecLevel" => "AUTO", "FieldEncoding" => "PAFF", "SceneChangeDetect" => "ENABLED", "QualityTuningLevel" => "SINGLE_PASS", "FramerateConversionAlgorithm" => "DUPLICATE_DROP", "UnregisteredSeiTimecode" => "DISABLED", "GopSizeUnits" => "FRAMES", "ParControl" => "INITIALIZE_FROM_SOURCE", "NumberBFramesBetweenReferenceFrames" => 2, "RepeatPps" => "DISABLED" ] ], "AfdSignaling" => "NONE", "DropFrameTimecode" => "ENABLED", "RespondToAfd" => "NONE", "ColorMetadata" => "INSERT" ], "AudioDescriptions" => [ [ "AudioTypeControl" => "FOLLOW_INPUT", "CodecSettings" => [ "Codec" => "AAC", "AacSettings" => [ "AudioDescriptionBroadcasterMix" => "NORMAL", "RateControlMode" => "CBR", "CodecProfile" => "LC", "CodingMode" => "CODING_MODE_2_0", "RawFormat" => "NONE", "SampleRate" => 48000, "Specification" => "MPEG4" ] ], "LanguageCodeControl" => "FOLLOW_INPUT" ] ], "OutputSettings" => [ "HlsSettings" => [ "AudioGroupId" => "program_audio", "AudioRenditionSets" => "program_audio", "IFrameOnlyManifest" => "EXCLUDE" ] ], "ContainerSettings" => [ "Container" => "M3U8", "M3u8Settings" => [ "AudioFramesPerPes" => 4, "PcrControl" => "PCR_EVERY_PES_PACKET", "PmtPid" => 480, "PrivateMetadataPid" => 503, "ProgramNumber" => 1, "PatInterval" => 0, "PmtInterval" => 0, "Scte35Source" => "NONE", "NielsenId3" => "NONE", "TimedMetadata" => "NONE", "VideoPid" => 481, "AudioPids" => [ 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492 ] ] ], "NameModifier" => "_v1" ], [ "AudioDescriptions" => [ [ "AudioTypeControl" => "FOLLOW_INPUT", "CodecSettings" => [ "Codec" => "AAC", "AacSettings" => [ "AudioDescriptionBroadcasterMix" => "NORMAL", "RateControlMode" => "CBR", "CodecProfile" => "LC", "CodingMode" => "CODING_MODE_2_0", "RawFormat" => "NONE", "SampleRate" => 48000, "Specification" => "MPEG4", "Bitrate" => 64000 ] ], "LanguageCodeControl" => "FOLLOW_INPUT", "AudioSourceName" => "Audio Selector 1", "StreamName" => "English", "LanguageCode" => "ENG" ] ], "OutputSettings" => [ "HlsSettings" => [ "AudioGroupId" => "program_audio", "AudioRenditionSets" => "program_audio", "IFrameOnlyManifest" => "EXCLUDE", "AudioTrackType" => "ALTERNATE_AUDIO_AUTO_SELECT_DEFAULT" ] ], "ContainerSettings" => [ "Container" => "M3U8", "M3u8Settings" => [ "AudioFramesPerPes" => 4, "PcrControl" => "PCR_EVERY_PES_PACKET", "PmtPid" => 480, "PrivateMetadataPid" => 503, "ProgramNumber" => 1, "PatInterval" => 0, "PmtInterval" => 0, "Scte35Source" => "NONE", "NielsenId3" => "NONE", "TimedMetadata" => "NONE", "VideoPid" => 481, "AudioPids" => [ 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492 ] ] ], "NameModifier" => "_a1" ], [ "AudioDescriptions" => [ [ "AudioTypeControl" => "FOLLOW_INPUT", "CodecSettings" => [ "Codec" => "AAC", "AacSettings" => [ "AudioDescriptionBroadcasterMix" => "NORMAL", "RateControlMode" => "CBR", "CodecProfile" => "LC", "CodingMode" => "CODING_MODE_2_0", "RawFormat" => "NONE", "SampleRate" => 48000, "Specification" => "MPEG4", "Bitrate" => 64000 ] ], "LanguageCodeControl" => "FOLLOW_INPUT", "AudioSourceName" => "Audio Selector 2", "StreamName" => "Spanish", "LanguageCode" => "SPA" ] ], "OutputSettings" => [ "HlsSettings" => [ "AudioGroupId" => "program_audio", "AudioRenditionSets" => "program_audio", "IFrameOnlyManifest" => "EXCLUDE", "AudioTrackType" => "ALTERNATE_AUDIO_AUTO_SELECT" ] ], "ContainerSettings" => [ "Container" => "M3U8", "M3u8Settings" => [ "AudioFramesPerPes" => 4, "PcrControl" => "PCR_EVERY_PES_PACKET", "PmtPid" => 480, "PrivateMetadataPid" => 503, "ProgramNumber" => 1, "PatInterval" => 0, "PmtInterval" => 0, "Scte35Source" => "NONE", "NielsenId3" => "NONE", "TimedMetadata" => "NONE", "VideoPid" => 481, "AudioPids" => [ 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492 ] ] ], "NameModifier" => "_a2" ] ] ] ], "AdAvailOffset" => 0, "Inputs" => [ [ "AudioSelectors" => [ "Audio Selector 1" => [ "Offset" => 0, "DefaultSelection" => "DEFAULT", "ProgramSelection" => 1, "SelectorType" => "TRACK", "Tracks" => [ 1 ] ], "Audio Selector 2" => [ "Offset" => 0, "DefaultSelection" => "NOT_DEFAULT", "ProgramSelection" => 1, "SelectorType" => "TRACK", "Tracks" => [ 2 ] ] ], "VideoSelector" => [ "ColorSpace" => "FOLLOW" ], "FilterEnable" => "AUTO", "PsiControl" => "USE_PSI", "FilterStrength" => 0, "DeblockFilter" => "DISABLED", "DenoiseFilter" => "DISABLED", "TimecodeSource" => "EMBEDDED", "FileInput" => "s3 => //testbucket-input/720/test_file.mp4" ] ], "TimecodeConfig" => [ "Source" => "ZEROBASED" ] ] ]
    Python

    To send requests using the AWS SDK for Python (Boto):

    1. Use the describe_endpoints method to request an account-specific endpoint.

      Important

      Make the DescribeEndpoints call only once in your application. Don't use DescribeEndpoints to create your AWS client each time that you make a request to MediaConvert. Otherwise, you will reach the throttle maximum on the public API endpoint.

    2. Specify the transcoding settings for your job in a JSON file.

      You can use the AWS Elemental MediaConvert console to generate the JSON job specification by choosing your job settings, and then choosing Show job JSON at the bottom of the Job section. For sample job specifications, see Sample Job Settings Specifications in JSON.

    3. Perform these steps in your Python code, as demonstrated in the example that follows these steps:

      1. Create the client with your account-specific endpoint specified.

      2. Load your settings JSON file.

      3. Create the transcoding job using create_job.

      import json import boto3 # Create MediaConvert client mediaconvert_client = boto3.client('mediaconvert', endpoint_url='https://abcd1234.mediaconvert.us-west-2.amazonaws.com') # Load job.json from disk and store as Python object: job_object with open("job.json", "r") as jsonfile: job_object = json.load(jsonfile) # Create MediaConvert job by unpacking the arguments from job_object. The job object contains the required parameters # for create_job. Pass these to create_job using Python's ** argument unpacking syntax. mediaconvert_client.create_job(**job_object)
    Ruby

    After you use the DescribeEndpointsRequest method to request an account-specific endpoint, send your requests to it as described in the Setting a Nonstandard Endpoint topic in the AWS SDK for Ruby Developer Guide.

    Important

    Make the DescribeEndpoints call only once in your application. Don't use DescribeEndpoints to create your AWS client each time that you make a request to MediaConvert. Otherwise, you will reach the throttle maximum on the public API endpoint.

    Tools for Powershell

    After you use the Get-EMCEndpoint Cmdlet to request an account-specific endpoint, send your requests to it as described in the Specifying a Custom or Nonstandard Endpoint topic in the AWS Tools for PowerShell User Guide. In brief, you specify your account-specific endpoint as a URL by adding the -EndpointUrl common parameter to your AWS Tools for PowerShell command.

    In this example, replace https://abcd1234.mediaconvert.us-west-1.amazonaws.com with the endpoint that you get back from your Get-EMCEndpoint Cmdlet request:

    AWS-PowerShellCmdlet -EndpointUrl "https://abcd1234.mediaconvert.us-west-1.amazonaws.com." -Other -Parameters

    Important

    Make the DescribeEndpoints call only once in your application. Don't use DescribeEndpoints to create your AWS client each time that you make a request to MediaConvert. Otherwise, you will reach the throttle maximum on the public API endpoint.