Manav Oza
Manav Oza

Reputation: 31

How to transcode MOV file using AWS elastic transcoder

I want to compress .MOV videos to 360p and 720p using aws transcorder but i'm getting following error while creating job for compressing video

4000 b17c3141-20d2-4168-bf7f-8fb8a5a5ca35: Amazon Elastic Transcoder could not interpret the media file.

I've tried following code and expecting to make it work that we can compress MOV videos using AWS Transcoder

import { S3, ElasticTranscoder } from "aws-sdk";
import { config } from "dotenv";

const awsConversionPresets = {
    360: "1351620000001-000040",
    720: "1351620000001-000010",
};
const region = "ap-southeast-2";

config();

const getVideos = async () => {
    const s3 = new S3({ region });

    const items = await s3
      .listObjectsV2({
        Bucket: "my-bucket-id",
      })
      .promise();

    if (items.Contents) {
      return items.Contents.map((content) => content.Key) as string[];
    }

    throw new Error("No contents");
};

const transcodeVideos = async (videosArr: string[]) => {
    const transcoder = new ElasticTranscoder({ region });

    for (const video of videosArr) {
      const job = await transcoder
        .createJob({
          PipelineId: "1684136955957-d86lw1",
          Input: {
            Key: video,
            Container: "auto",
            AspectRatio: "auto",
            Resolution: "auto",
            FrameRate: "auto",
            Interlaced: "auto",
          },
          Output: {
            Key: `test-output/${video}`,
            PresetId: "1351620000001-100180",
          },
        })
        .promise();
    }
};

const main = async () => {
    const videos = await getVideos();
    transcodeVideos(videos);
};

main();

Upvotes: 3

Views: 347

Answers (1)

If your .mov videos use a modern HDR color profile like this one: BT.2020 HLG (9-18-9) (and most modern iphones record in this format by default), then Elastic Transcoder does not support them anymore. You need to upgrade to their new Media Convert service

enter image description here

Upvotes: 0

Related Questions