The Media Mappings section of the job description contains various settings which help the Encoding Service to map the files properly during the Media Mapping phase

Media Mappings

Table of Contents

This job request section defines rules (regular expressions) for finding and mapping source media files, as well as for identifying language codes from filenames. This happens during the Media Mapping Phase.

{
    "VideoStreamExpression": "^video.(mp4|avi|mov)$",
    "AudioFileLanguageExpression": "^audio-([a-zA-Z0-9\\-]+).mp3$",
    "SubtitleFileLanguageExpression": "^subtitle-([a-zA-Z0-9\\-]+).(vtt|ttml|srt)$",
    "CaptionFileLanguageExpression": "^caption-([a-zA-Z0-9\\-]+).(vtt|ttml|srt)$",
    "AudioStreams": [
        {
            "Language": "en",
            "FileNameExpression": "audio-en.mp3"
        },
        {
            "Language": "fr",
            "FileNameExpression": "audio-fr.mp3"
        }
    ],
    "SubtitleStreams": [
        {
            "Language": "en",
            "FileNameExpression": "subtitle-en.vtt"
        },
        {
            "Language": "fr",
            "FileNameExpression": "subtitle-fr.vtt"
        }
    ],
    "CaptionStreams": [
        {
            "Language": "en",
            "FileNameExpression": "caption-en.vtt"
        },
        {
            "Language": "fr",
            "FileNameExpression": "caption-fr.vtt"
        }
    ],
    "AudioLanguages": ["en", "fr"],
    "SubtitleLanguages": ["en", "fr"],
    "CaptionLanguages": ["en", "fr"]
}
Property Description Use Case Required?

VideoStreamExpression

A regular expression for finding the main video file.

You must always provide this expression. Otherwise, Encoding is unable to find the video stream.

To specify just one file name, see an example below with SubtitleFileLanguageExpression.

Yes

AudioFileLanguageExpression

A regular expression for finding the audio files.

Compose this regex if you have audio tracks as external media files. If you want to encode a video with an embedded audio track, remove this property from the job request.

To specify just one file name, see an example below with SubtitleFileLanguageExpression.

No by default. Required if you provide the AudioStreams list.

SubtitleFileLanguageExpression

A regular expression for finding the subtitles files.

Compose this regex if you have subtitles tracks in external files. Usually, they are external.

To search for exactly one subtitle file (language-en.vtt) and nothing else, use the regex: ^language-(en)\\.vtt Where (en) is the language code. The language code must be in its own regex group.

No by default. Required if you provide the SubtitleStreams list.

CaptionFileLanguageExpression

A regular expression for finding the captions files.

Same as for subtitles, but for captions.

No by default. Required if you provide the CaptionStreams list.

AudioStreams, SubtitleStreams, CaptionStreams

A list of objects defining per-language regular expressions for files.

If you have multiple external tracks with different file names, you can define this list to map each track to a language individually.

No

AudioLanguages, SubtitleLanguages, CaptionLanguages

A list of allowed languages for processing.

If you have source content in many languages, but want to pick only a few of them, you can pass this list of allowed languages. Other languages are then ignored. Note that you can provide only one of each file types (audio, subtitles, caption) with the same language code. If the same language code is used in multiple files, only one of them is used.

No

Revision History

The table below lists the document versions and any changes to them.

Version Date Description

1.0

October 20, 2020

  • Initial version.

1.1

April 5, 2021

  • Note about the AudioFileLanguageExpression property.

1.2

August 19, 2021

  • Some notes for the VideoStreamExpression, AudioFileLanguageExpression, and SubtitleFileLanguageExpression properties.