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:

  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 tabs:

    AWS CLIC++GoJavaJavaScript.NETPHPPythonRubyTools for Powershell
    AWS CLI

    To create a transcoding job using the AWS CLI:

    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. // // 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 Creating an Account Endpoint 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 Set up AWS Credentials and Region for Development 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 job specifications in JSON format, see Sample Job Settings Specifications in JSON.

    JavaScript

    Find information and examples for using JavaScript to access MediaConvert in the AWS Elemental MediaConvert Examples topic of the SDK for JavaScript 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.

    .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

    Find information and examples for using PHP to access MediaConvert in the AWS Elemental MediaConvert Examples topic of the AWS SDK for PHP 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.

    Python

    Follow these steps 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 Setting a Nonstandard Endpoint 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 Specifying a Custom or Nonstandard Endpoint 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.