composer require aws/aws-sdk-php
'providers' => [ ... Aws\Laravel\AwsServiceProvider::class, ],
'aws' => [ 'key' => 'your-aws-access-key-id', 'secret' => 'your-aws-secret-access-key', 'region' => 'your-aws-region', ],
try { $result = $client->createJob($params); } catch (AwsException $e) { $error = $e->getAwsErrorMessage(); // handle error }
其中,$client代表实例化的AWS SDK对象,$params代表Media Convert相关的参数。
代码示例:
use Aws\MediaConvert\MediaConvertClient; use Aws\Exception\AwsException;
$params = [ 'Queue' => 'my-queue', 'Role' => 'my-role', 'Settings' => [ 'OutputGroups' => [ [ 'CustomName' => 'my-output-group', 'Name' => 'File Group', 'Outputs' => [ [ 'Container' => 'MP4', 'NameModifier' => '-1', 'VideoDescription' => [ 'ScalingBehavior' => 'DEFAULT', 'TimecodeInsertion' => 'DISABLED', 'AntiAlias' => 'ENABLED', 'Sharpness' => 50, 'CodecSettings' => [ 'Codec' => 'H_264', 'H264Settings' => [ 'InterlaceMode' => 'PROGRESSIVE', 'NumberReferenceFrames' => 2, 'Syntax' => 'DEFAULT', 'Softness' => 0, 'GopClosedCadence' => 1, 'GopSize' => 90, 'Slices' =>