我想通过Lambda(NodeJS)创建一个ElasticTranscoder作业。
如果我定义一个输入(见下文),它可以正常工作。但我有几个源文件。 如果我修改我的编码,以便输入是一个数组,我就会收到错误。
有人可以帮助我吗?
这很好用:
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);
});
这不起作用:
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);
});
我收到错误:
- UnexpectedParameter:意外的密钥' 1'发现在params.Input 在ParamValidator.validate(C:\ Users \ Volkm \ Google Drive \ Quellcode \ nodejs \ ElasticTranscoderJob \ test \ node_modules \ aws-sdk \ lib \ param_validator.js:40:28) 在Request.VALIDATE_PARAMETERS(C:\ Users \ Volkm \ Google Drive \ Quellcode \ nodejs \ ElasticTranscoderJob \ test \ node_modules \ aws-sdk \ lib \ event_listeners.js:125:42) 在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) 在C:\ Users \ Volkm \ Google Drive \ Quellcode \ nodejs \ ElasticTranscoderJob \ test \ node_modules \ aws -sdk \ lib \ event_listeners.js:85:9 在结束时(C:\ Users \ Volkm \ Google Drive \ Quellcode \ nodejs \ ElasticTranscoderJob \ test \ node_modules \ aws-sdk \ lib \ config.js:315:7) 在C:\ Users \ Volkm \ Google Drive \ Quellcode \ nodejs \ ElasticTranscoderJob \ test \ node_modules \ aws-sdk \ lib \ config.js:333:9 在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) 在Config.getCredentials(C:\ Users \ Volkm \ Google Drive \ Quellcode \ nodejs \ ElasticTranscoderJob \ test \ node_modules \ aws-sdk \ lib \ config.js:347:9) 消息:'有2个验证错误:\ n * UnexpectedParameter:Unexpected key \' 0 \'在params.Input中找到\ n * UnexpectedParameter:意外的密钥\' 1 \'在params.Input'中找到, 代码:' MultipleValidationErrors', 错误: [{UnexpectedParameter:Unexpected key' 0'发现在params.Input 在ParamValidator.fail(C:\ Users \ Volkm \ Google Drive \ Quellcode \ nodejs \ ElasticTranscoderJob \ test \ node_modules \ aws-sdk \ lib \ param_validator.js:50:37) 在ParamValidator.validateStructure(C:\ Users \ Volkm \ Google Drive \ Quellcode \ nodejs \ ElasticTranscoderJob \ test \ node_modules \ aws-sdk \ lib \ param_validator.js:77:14) 在ParamValidator.validateMember(C:\ Users \ Volkm \ Google Drive \ Quellcode \ nodejs \ ElasticTranscoderJob \ test \ node_modules \ aws-sdk \ lib \ param_validator.js:88:21) 在ParamValidator.validateStructure(C:\ Users \ Volkm \ Google Drive \ Quellcode \ nodejs \ ElasticTranscoderJob \ test \ node_modules \ aws-sdk \ lib \ param_validator.js:75:14) 在ParamValidator.validateMember(C:\ Users \ Volkm \ Google Drive \ Quellcode \ nodejs \ ElasticTranscoderJob \ test \ node_modules \ aws-sdk \ lib \ param_validator.js:88:21) 在ParamValidator.validate(C:\ Users \ Volkm \ Google Drive \ Quellcode \ nodejs \ ElasticTranscoderJob \ test \ node_modules \ aws-sdk \ lib \ param_validator.js:34:10) 在Request.VALIDATE_PARAMETERS(C:\ Users \ Volkm \ Google Drive \ Quellcode \ nodejs \ ElasticTranscoderJob \ test \ node_modules \ aws-sdk \ lib \ event_listeners.js:125:42) 在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) 在C:\ Users \ Volkm \ Google Drive \ Quellcode \ nodejs \ ElasticTranscoderJob \ test \ node_modules \ aws -sdk \ lib \ event_listeners.js:85:9 消息:'意外的密钥\' 0 \'在params.Input'中找到, 代码:' UnexpectedParameter', 时间:2018-06-10T11:39:59.749Z}, {UnexpectedParameter:Unexpected key' 1'发现在params.Input 在ParamValidator.fail(C:\ Users \ Volkm \ Google Drive \ Quellcode \ nodejs \ ElasticTranscoderJob \ test \ node_modules \ aws-sdk \ lib \ param_validator.js:50:37) 在ParamValidator.validateStructure(C:\ Users \ Volkm \ Google Drive \ Quellcode \ nodejs \ ElasticTranscoderJob \ test \ node_modules \ aws-sdk \ lib \ param_validator.js:77:14) 在ParamValidator.validateMember(C:\ Users \ Volkm \ Google Drive \ Quellcode \ nodejs \ ElasticTranscoderJob \ test \ node_modules \ aws-sdk \ lib \ param_validator.js:88:21) 在ParamValidator.validateStructure(C:\ Users \ Volkm \ Google Drive \ Quellcode \ nodejs \ ElasticTranscoderJob \ test \ node_modules \ aws-sdk \ lib \ param_validator.js:75:14) 在ParamValidator.validateMember(C:\ Users \ Volkm \ Google Drive \ Quellcode \ nodejs \ ElasticTranscoderJob \ test \ node_modules \ aws-sdk \ lib \ param_validator.js:88:21) 在ParamValidator.validate(C:\ Users \ Volkm \ Google Drive \ Quellcode \ nodejs \ ElasticTranscoderJob \ test \ node_modules \ aws-sdk \ lib \ param_validator.js:34:10) 在Request.VALIDATE_PARAMETERS(C:\ Users \ Volkm \ Google Drive \ Quellcode \ nodejs \ ElasticTranscoderJob \ test \ node_modules \ aws-sdk \ lib \ event_listeners.js:125:42) 在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) 在C:\ Users \ Volkm \ Google Drive \ Quellcode \ nodejs \ ElasticTranscoderJob \ test \ node_modules \ aws -sdk \ lib \ event_listeners.js:85:9 消息:'意外的密钥\' 1 \'在params.Input'中找到, 代码:' UnexpectedParameter', 时间:2018-06-10T11:39:59.749Z}], 时间:2018-06-10T11:39:59.749Z}
亲切的问候 斯蒂芬
答案 0 :(得分:0)
createJob操作对一个文件使用不同的属性而不是多个文件。
对于单个输入/输出文件:
transcoder.createJob({
PipelineId: '12345678-vsyssc',
Input: { <input info> },
Output: { <output info> },
});
对于多个输入/输出文件:
transcoder.createJob({
PipelineId: '12345678-vsyssc',
Inputs: [ {<input #1 info>}, {<input #2 info>} ],
Outputs: [ {<output #1 info}, {<output #2 info} ],
});
您使用Input
&amp; Output
(单数)在前者Inputs
&amp;后者Outputs
(复数)。
据猜测,原始的createJobs
方法仅支持单个文件,后来又进行了增强以支持多个文件。为避免破坏向后兼容性,AWS添加了Inputs
&amp; Outputs
。