AWS Elemental Replace audio with multiple smaller clips

112 views Asked by At

I have 1 video file and 2 audio files. I want to replace the video's audio with the 2 audio files (one after the other).

This is what I have so far, but the resulting video always comes out with the input video's audio, and the audio tracks are ignored.

{
  "Queue": "arn:aws:mediaconvert:eu-central-1:foo:queues/Default",
  "UserMetadata": {},
  "Role": "arn:aws:iam::foobar",
  "Settings": {
    "TimecodeConfig": {
      "Source": "ZEROBASED"
    },
    "OutputGroups": [
      {
        "CustomName": "OutputVideo",
        "Name": "File Group",
        "Outputs": [
          {
            "ContainerSettings": {
              "Container": "MP4",
              "Mp4Settings": {}
            },
            "VideoDescription": {
              "CodecSettings": {
                "Codec": "H_264",
                "H264Settings": {
                  "MaxBitrate": 50000000,
                  "RateControlMode": "QVBR",
                  "SceneChangeDetect": "TRANSITION_DETECTION"
                }
              }
            },
            "AudioDescriptions": [
              {
                "AudioSourceName": "Audio Selector 1",
                "CodecSettings": {
                  "Codec": "AAC",
                  "AacSettings": {
                    "Bitrate": 96000,
                    "CodingMode": "CODING_MODE_2_0",
                    "SampleRate": 48000
                  }
                }
              }
            ]
          }
        ],
        "OutputGroupSettings": {
          "Type": "FILE_GROUP_SETTINGS",
          "FileGroupSettings": {
            "Destination": "s3://mybucket/outputvideo.mp4"
          }
        }
      }
    ],
    "Inputs": [
      {
        "AudioSelectors": {
          "Audio Selector 1": {
            "DefaultSelection": "NOT_DEFAULT"
          }
        },
        "VideoSelector": {},
        "TimecodeSource": "ZEROBASED",
        "FileInput": "s3://mybucket/inputvideo.mp4"
      },
      {
        "AudioSelectors": {
          "Audio Selector 1": {
            "DefaultSelection": "DEFAULT",
            "ExternalAudioFileInput": "s3://mybucket/inputaudio_0.mp3"
          }
        },
        "TimecodeSource": "ZEROBASED"
      },
      {
        "AudioSelectors": {
          "Audio Selector 1": {
            "Offset": 5000,
            "DefaultSelection": "DEFAULT",
            "ExternalAudioFileInput": "s3://mybucket/inputaudio_1.mp3"
          }
        },
        "TimecodeSource": "ZEROBASED"
      }
    ]
  },
  "AccelerationSettings": {
    "Mode": "DISABLED"
  },
  "StatusUpdateInterval": "SECONDS_60",
  "Priority": 0
}

1

There are 1 answers

0
Aske Doerge On

Figured out I needed to combine the audio clips into an Audio Selector Group and select that in the Output:

{
  "Queue": "arn:aws:mediaconvert:eu-central-1:foo"
  "UserMetadata": {},
  "Role": "arn:aws:iam::foobar"
  "Settings": {
    "TimecodeConfig": {
      "Source": "ZEROBASED"
    },
    "OutputGroups": [
      {
        "CustomName": "OutputVideo",
        "Name": "File Group",
        "Outputs": [
          {
            "ContainerSettings": {
              "Container": "MP4",
              "Mp4Settings": {}
            },
            "VideoDescription": {
              "CodecSettings": {
                "Codec": "H_264",
                "H264Settings": {
                  "MaxBitrate": 50000000,
                  "RateControlMode": "QVBR",
                  "SceneChangeDetect": "TRANSITION_DETECTION"
                }
              }
            },
            "AudioDescriptions": [
              {
                "AudioSourceName": "Audio Selector Group 1",
                "CodecSettings": {
                  "Codec": "AAC",
                  "AacSettings": {
                    "VbrQuality": "MEDIUM_HIGH",
                    "RateControlMode": "VBR",
                    "CodingMode": "CODING_MODE_2_0",
                    "SampleRate": 48000
                  }
                }
              }
            ]
          }
        ],
        "OutputGroupSettings": {
          "Type": "FILE_GROUP_SETTINGS",
          "FileGroupSettings": {
            "Destination": "s3://mybucket/outputvideo.mp4"
          }
        }
      }
    ],
    "Inputs": [
      {
        "AudioSelectors": {
          "Audio Selector 1": {
            "DefaultSelection": "DEFAULT"
          },
          "Audio Selector 2": {
            "Tracks": [
              1
            ],
            "Offset": 0,
            "DefaultSelection": "NOT_DEFAULT",
            "SelectorType": "TRACK",
            "ExternalAudioFileInput": "s3://mybucket/inputaudio0.mp3"
          },
          "Audio Selector 3": {
            "Tracks": [
              1
            ],
            "Offset": 10000,
            "DefaultSelection": "NOT_DEFAULT",
            "SelectorType": "TRACK",
            "ExternalAudioFileInput": "s3://mybucket/inputaudio1.mp3"
          }
        },
        "AudioSelectorGroups": {
          "Audio Selector Group 1": {
            "AudioSelectorNames": [
              "Audio Selector 2",
              "Audio Selector 3"
            ]
          }
        },
        "VideoSelector": {},
        "TimecodeSource": "ZEROBASED",
        "FileInput": "s3://mybucket/inputvideo.mp4"
      }
    ]
  },
  "AccelerationSettings": {
    "Mode": "DISABLED"
  },
  "StatusUpdateInterval": "SECONDS_60",
  "Priority": 0
}