0

I want to create an ElasticTranscoder Job via Lambda (NodeJS).

It works fine if I define one input (see below). But I have several source files. If I modify my coding, so that the input is an array, I'll get errors.

Can someone help me?

This works fine:

    transcoder.createJob({
    PipelineId: '12345678-vsyssc',
    Input: {
        Key: fileName,
        FrameRate: 'auto',
        Resolution: 'auto',
        AspectRatio: 'auto',
        Interlaced: 'auto',
        Container: 'auto'
    },
    Output: {
        Key: 'Output.mp4',
        ThumbnailPattern: '',
        PresetId: '1351620000001-000030',
        Rotate: 'auto'
    }
}, function (err, data) {
    if (err) {
        console.log('Something went wrong:', err)
    } else {
        console.log('Converting is done');
    }
    callback(err, data);
});

This doesnt work:

    transcoder.createJob({
    PipelineId: '12345678-vsyssc',
    Input: [{
        Key: 'VID-20180217-WA0002.mp4',
        FrameRate: 'auto',
        Resolution: 'auto',
        AspectRatio: 'auto',
        Interlaced: 'auto',
        Container: 'auto'
    }, {
        Key: 'VID-20180411-WA0012.mp4',
        FrameRate: 'auto',
        Resolution: 'auto',
        AspectRatio: 'auto',
        Interlaced: 'auto',
        Container: 'auto'
    },
    ],
    Output: {
        Key: 'test123445.mp4',
        ThumbnailPattern: '',
        PresetId: '1351620000001-000030',
        Rotate: 'auto'
    }
}, function (err, data) {
    if (err) {
        console.log('Something went wrong:', err)
    } else {
        console.log('Converting is done');
    }
    callback(err, data);
});

i get the Error:

  • UnexpectedParameter: Unexpected key '1' found in params.Input at ParamValidator.validate (C:\Users\Volkm\Google Drive\Quellcode\nodejs\ElasticTranscoderJob\test\node_modules\aws-sdk\lib\param_validator.js:40:28) at Request.VALIDATE_PARAMETERS (C:\Users\Volkm\Google Drive\Quellcode\nodejs\ElasticTranscoderJob\test\node_modules\aws-sdk\lib\event_listeners.js:125:42) at Request.callListeners (C:\Users\Volkm\Google Drive\Quellcode\nodejs\ElasticTranscoderJob\test\node_modules\aws-sdk\lib\sequential_executor.js:105:20) at callNextListener (C:\Users\Volkm\Google Drive\Quellcode\nodejs\ElasticTranscoderJob\test\node_modules\aws-sdk\lib\sequential_executor.js:95:12) at C:\Users\Volkm\Google Drive\Quellcode\nodejs\ElasticTranscoderJob\test\node_modules\aws-sdk\lib\event_listeners.js:85:9 at finish (C:\Users\Volkm\Google Drive\Quellcode\nodejs\ElasticTranscoderJob\test\node_modules\aws-sdk\lib\config.js:315:7) at C:\Users\Volkm\Google Drive\Quellcode\nodejs\ElasticTranscoderJob\test\node_modules\aws-sdk\lib\config.js:333:9 at SharedIniFileCredentials.get (C:\Users\Volkm\Google Drive\Quellcode\nodejs\ElasticTranscoderJob\test\node_modules\aws-sdk\lib\credentials.js:126:7) at getAsyncCredentials (C:\Users\Volkm\Google Drive\Quellcode\nodejs\ElasticTranscoderJob\test\node_modules\aws-sdk\lib\config.js:327:24) at Config.getCredentials (C:\Users\Volkm\Google Drive\Quellcode\nodejs\ElasticTranscoderJob\test\node_modules\aws-sdk\lib\config.js:347:9) message: 'There were 2 validation errors:\n* UnexpectedParameter: Unexpected key \'0\' found in params.Input\n* UnexpectedParameter: Unexpected key \'1\' found in params.Input', code: 'MultipleValidationErrors', errors: [ { UnexpectedParameter: Unexpected key '0' found in params.Input at ParamValidator.fail (C:\Users\Volkm\Google Drive\Quellcode\nodejs\ElasticTranscoderJob\test\node_modules\aws-sdk\lib\param_validator.js:50:37) at ParamValidator.validateStructure (C:\Users\Volkm\Google Drive\Quellcode\nodejs\ElasticTranscoderJob\test\node_modules\aws-sdk\lib\param_validator.js:77:14) at ParamValidator.validateMember (C:\Users\Volkm\Google Drive\Quellcode\nodejs\ElasticTranscoderJob\test\node_modules\aws-sdk\lib\param_validator.js:88:21) at ParamValidator.validateStructure (C:\Users\Volkm\Google Drive\Quellcode\nodejs\ElasticTranscoderJob\test\node_modules\aws-sdk\lib\param_validator.js:75:14) at ParamValidator.validateMember (C:\Users\Volkm\Google Drive\Quellcode\nodejs\ElasticTranscoderJob\test\node_modules\aws-sdk\lib\param_validator.js:88:21) at ParamValidator.validate (C:\Users\Volkm\Google Drive\Quellcode\nodejs\ElasticTranscoderJob\test\node_modules\aws-sdk\lib\param_validator.js:34:10) at Request.VALIDATE_PARAMETERS (C:\Users\Volkm\Google Drive\Quellcode\nodejs\ElasticTranscoderJob\test\node_modules\aws-sdk\lib\event_listeners.js:125:42) at Request.callListeners (C:\Users\Volkm\Google Drive\Quellcode\nodejs\ElasticTranscoderJob\test\node_modules\aws-sdk\lib\sequential_executor.js:105:20) at callNextListener (C:\Users\Volkm\Google Drive\Quellcode\nodejs\ElasticTranscoderJob\test\node_modules\aws-sdk\lib\sequential_executor.js:95:12) at C:\Users\Volkm\Google Drive\Quellcode\nodejs\ElasticTranscoderJob\test\node_modules\aws-sdk\lib\event_listeners.js:85:9 message: 'Unexpected key \'0\' found in params.Input', code: 'UnexpectedParameter', time: 2018-06-10T11:39:59.749Z }, { UnexpectedParameter: Unexpected key '1' found in params.Input at ParamValidator.fail (C:\Users\Volkm\Google Drive\Quellcode\nodejs\ElasticTranscoderJob\test\node_modules\aws-sdk\lib\param_validator.js:50:37) at ParamValidator.validateStructure (C:\Users\Volkm\Google Drive\Quellcode\nodejs\ElasticTranscoderJob\test\node_modules\aws-sdk\lib\param_validator.js:77:14) at ParamValidator.validateMember (C:\Users\Volkm\Google Drive\Quellcode\nodejs\ElasticTranscoderJob\test\node_modules\aws-sdk\lib\param_validator.js:88:21) at ParamValidator.validateStructure (C:\Users\Volkm\Google Drive\Quellcode\nodejs\ElasticTranscoderJob\test\node_modules\aws-sdk\lib\param_validator.js:75:14) at ParamValidator.validateMember (C:\Users\Volkm\Google Drive\Quellcode\nodejs\ElasticTranscoderJob\test\node_modules\aws-sdk\lib\param_validator.js:88:21) at ParamValidator.validate (C:\Users\Volkm\Google Drive\Quellcode\nodejs\ElasticTranscoderJob\test\node_modules\aws-sdk\lib\param_validator.js:34:10) at Request.VALIDATE_PARAMETERS (C:\Users\Volkm\Google Drive\Quellcode\nodejs\ElasticTranscoderJob\test\node_modules\aws-sdk\lib\event_listeners.js:125:42) at Request.callListeners (C:\Users\Volkm\Google Drive\Quellcode\nodejs\ElasticTranscoderJob\test\node_modules\aws-sdk\lib\sequential_executor.js:105:20) at callNextListener (C:\Users\Volkm\Google Drive\Quellcode\nodejs\ElasticTranscoderJob\test\node_modules\aws-sdk\lib\sequential_executor.js:95:12) at C:\Users\Volkm\Google Drive\Quellcode\nodejs\ElasticTranscoderJob\test\node_modules\aws-sdk\lib\event_listeners.js:85:9 message: 'Unexpected key \'1\' found in params.Input', code: 'UnexpectedParameter', time: 2018-06-10T11:39:59.749Z } ], time: 2018-06-10T11:39:59.749Z }

Kind Regards Stefan

Stefan Volkmer
  • 318
  • 2
  • 13
  • Please show your attempt to transcode multiple files (using Inputs and Outputs) rather than one file (using Input and Output) and tell us what error you see. – jarmod Jun 08 '18 at 12:32
  • @jarmod: I adjusted my question, hope someone can tell me whats the problem – Stefan Volkmer Jun 10 '18 at 11:41
  • The documentation indicates that you should pass (plural) Inputs and Outputs for multiple files, not (singular) Input and Output. – jarmod Jun 10 '18 at 11:59
  • Sorry, i dont understand your point. I try to provide multiple objects, but then it doesn't work.how should i pass multiple objects in an other way as i tried? – Stefan Volkmer Jun 10 '18 at 14:18
  • sorry, now i got it. You are right. if i use the "Inputs"-Property instead of "Input" it works. Thank you so much! – Stefan Volkmer Jun 10 '18 at 21:02
  • Glad it's working. I have added an answer. – jarmod Jun 11 '18 at 00:33

1 Answers1

1

The createJob operation uses different properties for one file vs. multiple files.

For a single input/output file:

transcoder.createJob({
    PipelineId: '12345678-vsyssc',
    Input: { <input info> },
    Output: { <output info> },
});

For multiple input/output files:

transcoder.createJob({
    PipelineId: '12345678-vsyssc',
    Inputs: [ {<input #1 info>}, {<input #2 info>} ],
    Outputs: [ {<output #1 info}, {<output #2 info} ],
});

You use Input & Output (singular) in the former but Inputs & Outputs (plural) in the latter.

At a guess, the original createJobs method only supported a single file and was later enhanced to support multiple files. To avoid breaking backward compatibility AWS added Inputs & Outputs.

jarmod
  • 71,565
  • 16
  • 115
  • 122