MediaConvert client

This page contains examples with the MediaConvert client. See the client introduction for a more detailed description how to use a client. You may also want to consider the authentication documentation to understand the many ways you can authenticate with AWS.

The MediaConvert package could be installed with Composer.

composer require async-aws/media-convert

A new client object may be instantiated by:

use AsyncAws\MediaConvert\MediaConvertClient; $mediaConvert = new MediaConvertClient();

The authentication parameters is read from the environment by default. You can also specify a AWS access id and secret:

use AsyncAws\MediaConvert\MediaConvertClient; $mediaConvert = new MediaConvertClient([ 'accessKeyId' => 'my_access_key', 'accessKeySecret' => 'my_access_secret', 'region' => 'eu-central-1', ]);

For all available options, see the configuration reference.

Usage

Create jobs

use AsyncAws\MediaConvert\MediaConvertClient; use AsyncAws\MediaConvert\Input\CreateJobRequest; use AsyncAws\MediaConvert\ValueObject\Input; use AsyncAws\MediaConvert\ValueObject\JobSettings; use AsyncAws\MediaConvert\ValueObject\Output; use AsyncAws\MediaConvert\ValueObject\OutputGroup; $mediaConvert = new MediaConvertClient(); $request = $mediaConvert->createJob(new CreateJobRequest([ 'Settings' => [ new JobSettings([ 'Inputs' => [ new Input(['FileInput' => 's3://my-bucket/file.mov']) ], 'OutputGroups' => [ new OutputGroup([ 'Outputs' => [new Output([ 'Preset' => 'h264' ])], ]), ], ]) ], ])); echo 'Started the processing for the job '. $request->getJob()->getId();

Note: The MediaConvertClient takes care automatically of the discovery of the account-specific endpoint needed for most operations (unlike what the official SDK implements).


The source code to this page is found on GitHub.