3

I'm using AWS SDK PHP.

Using ->createJob( everything is fine, but when I add

'Composition' => array(
                    'TimeSpan' => array(
                        'StartTime' => '00:00:00.000',
                        'Duration' => '00:00:02.000'
                    )
                )

to one of the outputs, I get the following error:

{"error":{"type":"Aws\ElasticTranscoder\Exception\ElasticTranscoderException","message":"Start of structure or map found where not expected.","file":"/Applications/XAMPP/xamppfiles/htdocs/breves/vendor/aws/aws-sdk-php/src/Aws/Common/Exception/NamespaceExceptionFactory.php","line":91}}

I'm trying to cut the video.

Any toughts?

Amazon SDK API Developer Guide

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
jplozano
  • 606
  • 1
  • 7
  • 23

2 Answers2

5

Found out the answer:

it should be an array of "clips", like so:

'Composition' => array(
array(
    'TimeSpan' => array(
        'StartTime' => '00:00:00.000',
        'Duration' => '00:00:02.000'
    )

)

In my case I only needed 1 clip.

More information about duration here: (Optional) Clip Start Time - (StartTime) You can create an output file that contains an excerpt from the input file. Clip Start Time indicates the place in the input file where you want a clip to start. The format can be either HH:mm:ss.SSS (maximum value: 23:59:59.999; SSS is thousandths of a second) or sssss.SSS (maximum value: 86399.999). If you don't specify a value, Elastic Transcoder starts at the beginning of the input file.

(Optional) Clip Duration (Duration) The duration of your excerpt clip. The format can be either HH:mm:ss.SSS (maximum value: 23:59:59.999; SSS is thousandths of a second) or sssss.SSS (maximum value: 86399.999). If you don't specify a value, Elastic Transcoder clips from Clip Start Time to the end of the file.

If you specify a value longer than the duration of the input file, Elastic Transcoder transcodes from Clip Start Time to the end of the file and returns a warning message.

For Detailed info about aws transcoder here

jplozano
  • 606
  • 1
  • 7
  • 23
0

I am posting an answer to add a little more information to the solution to this problem.

You can use Amazon Elastic Transcoder to generate partial excerpts of content, or "clips," from your source media.

As @jplozano mentioned in his followup, he should only have a single clip for each source file. Here is an excerpt from the Amazon Elastic Transcoder API Reference

"Composition":[
        {
           "TimeSpan":
              {
                 "StartTime":"starting place of the clip, in
                    HH:mm:ss.SSS or sssss.SSS",
                 "Duration":"duration of the clip, in HH:mm:ss.SSS
                    or sssss.SSS"
              }
        }

The Composition object contains settings for the clips that make up an output file. Currently, you can specify settings for only a single clip per output file. The Composition object cannot be null. All jobs in a playlist must have the same clip settings.

Beau Bouchard
  • 835
  • 11
  • 28
  • this doesnt seem to work. I keep on getting errors about "Message":"Start of list found where not expected" – ackerchez Jan 10 '17 at 16:47