php-elasticaHow can I use Amazon Elastic Transcoder with PHP?
Amazon Elastic Transcoder is a media transcoding service that can be used to convert media files from their original source format into different formats that are optimized for different devices. The service can be used with PHP by using the AWS SDK for PHP.
The following example code will demonstrate how to use the AWS SDK for PHP to create a job in Amazon Elastic Transcoder:
<?php
// Include the SDK using the Composer autoloader
require 'vendor/autoload.php';
use Aws\ElasticTranscoder\ElasticTranscoderClient;
$client = ElasticTranscoderClient::factory(array(
'key' => 'YOUR_AWS_ACCESS_KEY_ID',
'secret' => 'YOUR_AWS_SECRET_ACCESS_KEY',
'region' => 'us-east-1'
));
$result = $client->createJob(array(
'Input' => array(
'Key' => 'input.mp4',
),
'Output' => array(
'Key' => 'output.mp4',
'PresetId' => '1351620000001-000010'
)
));
echo $result['Job']['Id'];
This code will output the ID for the newly created job in Amazon Elastic Transcoder.
Parts of the code:
require 'vendor/autoload.php'
: Includes the AWS SDK for PHP using the Composer autoloader.use Aws\ElasticTranscoder\ElasticTranscoderClient
: Loads the Elastic Transcoder client.$client = ElasticTranscoderClient::factory(...)
: Creates an Elastic Transcoder client.$result = $client->createJob(...)
: Creates a job in Elastic Transcoder.echo $result['Job']['Id']
: Outputs the ID for the newly created job.
Helpful links
More of Php Elastica
- How do I configure PHP Elastica using YML?
- How can I use PHP and Elastica to parse XML data?
- How can I use Elastic Search with PHP?
- How do I use Elastic Search with PHP?
- How can I use the Elasticsearch PHP client to interact with an Elasticsearch server?
- How can I use Elastica to create a query in PHP?
- How can I use PHP to create an elastic query?
- How can I use a PHP Elastic Query Builder to create an effective search query?
- How can I use the Elastica options with PHP?
See more codes...