Receive SRT caption files for your video using Rev.ai

1. Add Rev.AI Get caption step to the Flow

2. Select "Get caption" as the action

3. Setup the Caption Options such as entering the correct language code

Source: the input video

Language code: language code associated with the video

Dictionary: array of phrases to help the AI transcribe more accurate (optional). Each phrase should be in string format (accept double quotes only)

Caption Format: .SRT or .srt or .VTT or .vtt

Rev.ai Access Token

4. Add "Transfer to Storage" step to save the results/output of the Rev.ai step back to your file hosting service like S3.

Source: the source file which will be uploaded

Host: hosting providers: s3 (we support Amazon S3 for now; more options to be added in the future)

Access Key, Secret Key: the AWS credential that has write access to your S3 bucket

Bucket Name, File Name: the destination where the file will be saved. You can save the file to a specific folder and subfolder by using / (as in the example screenshot above). If you leave the name empty or specify the folder only, a unique file name will be used for the uploaded file.

5. Save, Enable then trigger the flow and check the log for the result.

NOTE:

Valid language codes:

User-supplied language to transcribe the audio into.

Enum: "en" "ar" "bg" "ca" "cmn" "cs" "da" "de" "el" "es" "fa" "fi" "fr" "he" "hi" "hr" "hu" "id" "it" "ja" "ko" "lt" "lv" "ms" "nl" "no" "pl" "pt" "ro" "ru" "sk" "sl" "sv" "ta" "te" "tr"

Saving SRT filenames that correspond to the original uploaded file:

Add this code to a Function and then add the Function step before the Transfer to Storage step:

const S3URLParser = require('amazon-s3-uri');

async function main (service, context) {

const { region, bucket, key } = S3URLParser(service.videoURL)
const objectName = getObjectName(key);
console.log(objectName);
const fileName = getMediaFileName(objectName);
console.log(fileName);
const extension = getMediaExtension(objectName);
console.log(extension);
return {
name: fileName,
ext: extension,
resultFileName: `${fileName}${service.ext}`
}
}


function getMediaExtension(fileName) {
return (/[.]/.exec(fileName)) ? /[^.]+$/.exec(fileName) : '';
}

function getMediaFileName(path) {
return path.split("/").pop().split('.')[0];
}

function getObjectName(url) {
return url.split("/").pop();
}

module.exports = main;

Input parameters:

[  {    dataTypeId: 4,    supportedDataTypeIds: [      '4',      '16',      '14',      '12',      '15',      '1',      '2',      '3',      '6',      '7'    ],    require: true,    key: 'videoURL',    dataType: 'string'  },  {    dataTypeId: 4,    supportedDataTypeIds: [      '4',      '16',      '14',      '12',      '15',      '1',      '2',      '3',      '6',      '7'    ],    require: true,    key: 'ext',    dataType: 'string'  }]

Output parameters:

[  {    dataTypeId: 4,    require: true,    key: 'name',    dataType: 'string'  },  {    dataTypeId: 4,    require: true,    key: 'ext',    dataType: 'string'  },  {    dataTypeId: 4,    require: true,    key: 'resultFileName',    dataType: 'string'  }]

Did this answer your question?