我正在使用一个脚本,我自动在上传的文件上运行弹性转码器。然后它会将编码版本导出到另一个S3存储桶。
但是它正在写入文件夹。这给我带来了一个问题,因为从技术上讲,文件夹不存在,因此没有创建日期的记录。
这使我很难管理文件的创建日期,因为我们只能看到"文件夹的修改日期"这是空白的。是否可以将我的文件上传到存储桶的根目录,因此不在文件夹内?
我觉得它与此有关:OutputKeyPrefix:newKey +' /', 但是我尝试删除它,并将其设置为'',没有任何成功
exports.handler = function(event, context) {
console.log('Executing Elastic Transcoder');
var bucket = event.Records[0].s3.bucket.name;
var key = event.Records[0].s3.object.key;
var pipelineId = '1521208528859-x';
console.log(key);
console.log(event.Records[0]);
if (bucket !== 'video-upload') {
context.fail('Incorrect Video Input Bucket');
return;
}
var srcKey = decodeURIComponent(event.Records[0].s3.object.key.replace(/\-/g, " ")); //the object may have spaces
var newKey = key.split('.')[0];
var params = {
PipelineId: pipelineId,
OutputKeyPrefix: newKey + '/',
Input: {
Key: srcKey,
FrameRate: 'auto',
Resolution: 'auto',
AspectRatio: 'auto',
Interlaced: 'auto',
Container: 'auto'
},
Outputs: [{
Key: newKey + '.mp4',
ThumbnailPattern: 'thumbs-' + newKey + '-{resolution}' + '-{count}',
PresetId: '1351620000001-000010', //Generic 720p
Watermarks: [{
InputKey: 'watermarks/logo-dark.png',
PresetWatermarkId: 'BottomRight'
}],
}]
};
console.log('Starting Job');
eltr.createJob(params, function(err, data){
if (err){
console.log(err);
} else {
console.log(data);
}
context.succeed('Job well done');
});
};