-
Notifications
You must be signed in to change notification settings - Fork 56
Call mediaConvert.getJob in MediaConvert status lambda #315
Comments
Also... just noticed this block of code in the input lambda: let mcClient = new AWS.MediaConvert();
if (!AWS.config.mediaconvert) {
try {
const endpoints = await mcClient.describeEndpoints().promise();
AWS.config.mediaconvert = { endpoint: endpoints.Endpoints[0].Url };
// Override so config applies
mcClient = new AWS.MediaConvert();
} catch (e) {
console.log(e);
return;
}
} 🤦♂️ |
Hi @kylekirkby, if I'm not wrong you should have inside your SNS message the job detail, no ? What does your const path = require('path')
const { AudioAnalysis } = require('/opt/audio-analysis')
exports.handler = async (event, context) => {
const message = JSON.parse(event.Records[0].Sns.Message)
console.log('Status', message.detail.status)
if (message.detail.status === 'COMPLETE') {
try {
const s3uri =
message.detail.outputGroupDetails[1].outputDetails[0]
.outputFilePaths[0] || undefined
if (!s3uri) throw new Error('s3uri is undefined')
const bucket = path.parse(s3uri).dir.split('/')[2]
const tag = path.parse(s3uri).dir.split('/')[3]
const { transcribe } = new AudioAnalysis({
tag,
mediaFileUri: s3uri,
outputBucket: bucket,
vocabularyFilterName: process.env.VOCABULARY_FILTER_NAME,
outputKey: `${tag}/transcript/`,
mediaFormat: 'mp3',
})
await transcribe.startJob()
} catch (error) {
if (error.name === "ConflictException") {
console.info(error)
return;
}
console.error(error)
}
}
return message
} |
Arhhh! Thanks @nathanagez! I've just noticed
|
@nathanagez - on another note, I'm not seeing |
@nathanagez - I'm also transcribing my videos but I'm using the input mp4 video file. Are you using the audio-only version that MediaConvert creates? |
I think it depends of your MediaConvert job template, I'm using a custom template where I have output groups 🤔 |
Hmmm.. strange! I'm also using a custom template (based on default one) with output groups 🤔. I've added an output group for poster images
|
@nathanagez - |
Is your feature request related to a problem? Please describe.
The Media Convert status lambda currently returns a MediaConvert job ID. This on its own is not very useful. Even when submitting the job to MediaConvert you don't get returned a job ID to match to the status events. I was hoping to call mediaConvert.getJob with the job ID to get the name of the file that the job relates to (with this I could then update the DynamoDB entry for the video with the conversion progress).
I'm currently getting this error message when calling
getJob()
.How can I get the "custom specific" endpoint? I'd put this in by hand but I'd rather it be dynamic if possible due to IaaC principles etc.
Describe the solution you'd like
Some guidance on how to access this endpoint within the MediaConvert status lambda. It would also be good to add this by default as, AFAIK, the MediaConvert response is useless without some way of correlating the status to a specific video.
Describe alternatives you've considered
I've added the region environment variable in hope that this would resolve the issue to no avail.
As I'm writing this issue I've noticed a
userMetadata: {},
attribute is returned in the SNS event message. Maybe when creating the MC job I could tag the job with the video ID. I'll update this ticket if I can get that working.Cheers!
The text was updated successfully, but these errors were encountered: