Skip to content

Commit

Permalink
feat: qvbr ffprobe metadata upload
Browse files Browse the repository at this point in the history
  • Loading branch information
oshinongit committed Aug 14, 2024
1 parent 3b706d7 commit 9ab10fe
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/aws/aws-job-qvbr.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: job-name
pipeline: pipeline.yml
encodingProfile: encoding-profile.json
encodingProfile: encoding-profile-qvbr.json
reference: reference.mp4
models:
- HD
Expand Down
2 changes: 1 addition & 1 deletion src/pairVmaf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ function fileExists(file) {
return fs.existsSync(file);
}

async function runFfprobe(file) {
export async function runFfprobe(file) {
return new Promise((resolve, reject) => {
ffmpeg.ffprobe(file, (err, metadata) => {
if (err) {
Expand Down
14 changes: 14 additions & 0 deletions src/pipelines/aws/aws-pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
qualityAnalysisModelToString
} from '../../models/quality-analysis-model';
import logger from '../../logger';
import { runFfprobe } from '../../pairVmaf';

export function isS3URI(url: string): boolean {
try {
Expand Down Expand Up @@ -235,6 +236,19 @@ export default class AWSPipeline implements Pipeline {
`${outputFolder}/${outputObject}`
);
if (!s3Status) return '';
if (variables ? variables['QVBR'] : undefined) {
const url = this.generatePresignedUrl(outputBucket, outputObject, 5);
const metadata = await runFfprobe(url);
const upload = new Upload({
client: this.s3,
params: {
Bucket: outputBucket,
Key: `${outputObject}_metadata`,
Body: JSON.stringify(metadata)
}
});
await upload.done();
}

logger.info('Finished transcoding ' + inputFilename + '.');
return outputURI;
Expand Down

0 comments on commit 9ab10fe

Please sign in to comment.