Media Mapping
This article discusses the media mapping phase of encoding. You can find an overview of the entire encoding process in the Job Processing article.
File naming convention
Use simple file naming conventions to specify the language and other properties for the track(s) in a source media file.
Please note that if you already have all the necessary metadata present in the source media then you generally don't need to specify anything in the file names. We automatically detect this metadata. The exceptions to this are Closed Captions and Descriptive Audio which cannot be detected from metadata at this time and must be signalled using the file names.
To use file naming conventions, set MediaDetection to Convention in MediaMappings:
{
"MediaDetection": "Convention"
}
Regex
To decide which input files represent which streams, the Encoding Service uses the settings in the MediaMappings section. There are three layers of settings which enable more and more focused filtering of the input files.
First, regular expressions can be used to filter the files which represent the video/audio/subtitle/caption streams.
{
"VideoStreamExpression": "^video.(mp4|avi|mov|mkv|mxf)$",
"AudioFileLanguageExpression": "^audio-([a-zA-Z0-9\\-]+).mp3$",
"DescriptiveAudioFileLanguageExpression": "^descriptive_audio-([a-zA-Z0-9\\-]+).mp3$",
"SubtitleFileLanguageExpression": "^subtitle-([a-zA-Z0-9\\-]+).(vtt|ttml|srt)$",
"CaptionFileLanguageExpression": "^caption-([a-zA-Z0-9\\-]+).(vtt|ttml|srt)$"
}
Files not matched by any of the provided regular expressions will not be used
at all. Only a single file is expected with a video stream. All the other
streams can be specified separately for every language. Use a regular
expression group to match the language - the first matched group will be
treated as the language code. For example, the file audio-DEU.mp3 will be
interpreted as an audio track for the language "DEU" (German).
See Languages in the Axinom Encoding Overview article for details on how the Encoding Service handles languages.
Second, if the file names do not clearly indicate a language, more generic patterns can be used to match all audio/subtitles/captions files and then a specific mapping can be used to map a file to a language, e.g.:
{
"AudioStreams": [
{
"Language": "en",
"FileNameExpression": "audio-en.mp3"
},
{
"Language": "fr",
"FileNameExpression": "audio-fr.mp3"
}
]
}
Finally, the list of languages to be used can be further limited:
{
"AudioLanguages": ["fr"]
}
Even though two audio streams were found - English and French, only the one in French (audio-fr.mp3) will be used for encoding.