0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

AWS Elemental MediaConvertで作成したジョブテンプレートをCloudFormationで展開する

Posted at

概要

実験的にMediaConvertにてジョブテンプレートを作成し挙動を終え、いざ既存のCloudformation.ymlに追加するとなると少しつまずいたので、そのまとめとなります。

初めに

今回作成したジョブテンプレートは以下の通りです。

{
  "Description": "convert webm to mp3",
  "Category": "mp3",
  "Name": "JobTemplateName",
  "Settings": {
    "TimecodeConfig": {
      "Source": "ZEROBASED"
    },
    "OutputGroups": [
      {
        "Name": "File Group",
        "Outputs": [
          {
            "ContainerSettings": {
              "Container": "RAW"
            },
            "AudioDescriptions": [
              {
                "AudioSourceName": "Audio Selector 1",
                "CodecSettings": {
                  "Codec": "MP3",
                  "Mp3Settings": {
                    "RateControlMode": "VBR",
                    "VbrQuality": 1
                  }
                }
              }
            ]
          }
        ],
        "OutputGroupSettings": {
          "Type": "FILE_GROUP_SETTINGS",
          "FileGroupSettings": {
            "Destination": "s3://output_bucket/"
          }
        }
      }
    ],
    "Inputs": [
      {
        "AudioSelectors": {
          "Audio Selector 1": {
            "DefaultSelection": "DEFAULT"
          }
        },
        "VideoSelector": {},
        "TimecodeSource": "ZEROBASED"
      }
    ]
  },
  "AccelerationSettings": {
    "Mode": "DISABLED"
  },
  "StatusUpdateInterval": "SECONDS_60",
  "Priority": 0,
  "HopDestinations": []
}

ジョブテンプレートをymlに起こす手順

まず初めにAWS CloudShellにて以下のコマンドを実行しテンプレートの設定を取得します。
この時JobTemplateNameにはすでに作成してあるジョブテンプレートの名前を入れてください。

aws mediaconvert get-job-template --name JobTemplateName --query 'JobTemplate.Settings'

コマンド実行後jsonで設定が出力されるのでそれをymlに置き換えます。
(面倒なのでDevToysを使って変換しました)

Inputs:
  - AudioSelectors:
      Audio Selector 1:
        DefaultSelection: DEFAULT
    TimecodeSource: ZEROBASED
    VideoSelector: {}
OutputGroups:
  - Name: File Group
    OutputGroupSettings:
      FileGroupSettings:
        Destination: s3://output_bucket/
      Type: FILE_GROUP_SETTINGS
    Outputs:
      - AudioDescriptions:
          - AudioSourceName: Audio Selector 1
            CodecSettings:
              Codec: MP3
              Mp3Settings:
                RateControlMode: VBR
                VbrQuality: 1
        ContainerSettings:
          Container: RAW
        Extension: mp3
TimecodeConfig:
  Source: ZEROBASED

最後に上記ymlを追加するだけです。
以下のymlは追加後になります。

Resources:
  MediaConvertJobTemplate:
    Type: AWS::MediaConvert::JobTemplate
    UpdateReplacePolicy: Delete
    DeletionPolicy: Delete
    Properties:
      Name: JobTemplateName
      Description: convert webm to mp3
      Category: mp3
      AccelerationSettings: 
        Mode: DISABLED
      StatusUpdateInterval: SECONDS_60
      Priority: 0
      SettingsJson:
        Inputs:
          - AudioSelectors:
              Audio Selector 1:
                DefaultSelection: DEFAULT
            TimecodeSource: ZEROBASED
            VideoSelector: {}
        OutputGroups:
          - Name: File Group
            OutputGroupSettings:
              FileGroupSettings:
                Destination: s3://output_bucket/
              Type: FILE_GROUP_SETTINGS
            Outputs:
              - AudioDescriptions:
                  - AudioSourceName: Audio Selector 1
                    CodecSettings:
                      Codec: MP3
                      Mp3Settings:
                        RateControlMode: VBR
                        VbrQuality: 1
                ContainerSettings:
                  Container: RAW
                Extension: mp3
        TimecodeConfig:
          Source: ZEROBASED

感想

SettingsJsonって名前でタイプがJsonとなっていたので頭がバグり散らかしてつまずいちゃいました...

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?