【发布时间】:2018-07-20 02:16:12
【问题描述】:
我想将视频自动转码为带有播放列表的加密 hls。 我的 lambda 代码如下,但运行时出现以下错误
{ ValidationException: The MD5 hash of the base64-decoded value for
''Encryption:Key'' must equal the base64-decoded value for ''Encryption:KeyMd5''.
lambda中的代码是
var srcKey = decodeURIComponent(event.Records[0].s3.object.key.replace(/\+/g, " "));
var newKey = key.split('.')[0];
var plainEncryptionKey='t6w9z$C&F)J@NcQf';
var KeyBase64 = new Buffer(plainEncryptionKey).toString('base64');
console.log("plain_base64: " + KeyBase64);
var crypto = require('crypto');
var MD5= crypto.createHash('md5').update(plainEncryptionKey).digest("hex");
var MD5Base64 = new Buffer(MD5).toString('base64');
console.log("md5_base64: " + MD5Base64);
var params = {
PipelineId: pipelineId,
OutputKeyPrefix: newKey + '/',
Input: {
Key: srcKey,
FrameRate: 'auto',
Resolution: 'auto',
AspectRatio: 'auto',
Interlaced: 'auto',
Container: 'auto'
},
Outputs: [{
Key: newKey + '-hls' + '.ts',
ThumbnailPattern: '',
PresetId: '1351620000001-200010', //HLS v3 2mb/s
SegmentDuration: '10',
}],
Playlists: [
{
Name: 'index',
Format: 'HLSv3',
OutputKeys: [ newKey + '-hls' + '.ts', ],
HlsContentProtection: {
InitializationVector: 'VQMKGVjivkBUJLf4BY4uQQ==',
Key: KeyBase64,
KeyMd5: MD5Base64,
KeyStoragePolicy: 'NoStore',
LicenseAcquisitionUrl: 'https://example.com/ekey.php',
Method: 'aes-128'
},
},
我忽略了什么? 我唯一能想到的我想念的是我首先需要加密明码......但是有什么建议吗?
【问题讨论】:
标签: aws-lambda amazon-elastic-transcoder