Elastic Transcoder "Start of list found where not expected"

768 Views Asked by At

I am having trouble using Elastic Transcoder in PHP. I am trying to use transcoder to grab an audio file from S3, trim it, and place it back. When I try to use the following job creation code I am getting the error: "{"Message":"Start of list found where not expected"}"

When I try to create a JOB I use the following code:

$createJobResult = $transCoderClient->createJob([
    'PipelineId' => {pipelineID},
    'Input' => [
            'Key' => $media->key
        ],
    'Outputs' => [
        [
            'Key' => $newMedia->key,
            'PresetId' => {$presetID},
            'Composition' => [
               [
                   'Timespan' => [
                       'StartTime' => $trimStart,
                       'Duration' => $duration
                       ]
                   ]
               ]
           ]
       ],
       'UserMetaData' => [
           'trimJobId' => $trimQueueEntry->id
       ]
   ]);

can anyone weigh in on this problem and help? When looking at the documentation on Amazon the structure looks alright.

1

There are 1 best solutions below

0
On BEST ANSWER

Figured out the answer after much searching. Here was the proper structure.

$createJobResult = $transCoderClient->createJob([
                'PipelineId' => '{pipelineID}',
                'Input' => [
                    'Key' => (string) $media->key,
                ],
                'Inputs' => [
                    [
                        'Key' => (string) $media->key,
                        'Timespan' => [
                            'StartTime' => 00:00:00.000,
                            'Duration' => 00:00:25.000
                        ]
                    ]
                ],
                'Output' => [
                    'Composition' => [
                        [
                            'TimeSpan' => [
                                'StartTime' => 00:00:00.000,
                                'Duration' => 00:00:25.000
                            ],
                        ],
                    ],
                    'Key' => $newMedia->key,
                    'PresetId' => {presetID},
                ],
            ]);