Contents Array
The contents array should be applied in source tasks when your Hybrik job requires audio mapping and/or the use of a combination of multiple source elements.
Options for the object kind
in a contents array are:
- audio
- video
- subtitle
- closed_caption
- metadata
Three example cases appear below, with example json files at the end of this page:
- Audio Mapping (Source URL)
- Multiple Source Elements (Asset_Complex Source)
- Stitched Sequence with Multiple Source Elements (Asset_Complex Source)
Audio Mapping
If your source asset contains one or more audio tracks, mapping can be used to build the virtual audio pipeline to include only the tracks and channels that are intended to be accessed in downstream tasks. The example source task below includes the contents
array, which maps audio tracks 3 (mono) & 4 (mono) to a single stereo track:
{
"uid": "source",
"kind": "source",
"payload": {
"kind": "asset_url",
"payload": {
"storage_provider": "s3",
"url": "{{source_audio_path}}/{{source_audio_file}}",
"contents": [
{
"kind": "audio",
"payload": {
"language": "eng"
},
"map": [
{
"input": {
"track": 2,
"channel": 0
},
"output": {
"track": 0,
"channel": 0
}
},
{
"input": {
"track": 3,
"channel": 0
},
"output": {
"track": 0,
"channel": 1
}
}
]
}
]
}
}
}
Multiple Source Elements
When you need to combine multiple source elements to produce an output, the contents array enables you to define which media streams from each source are added to the virtual pipeline. The following source task json demonstrates how three separate files are combined to fill the pipeline with video, audio and subtitle media:
{
"uid": "source",
"kind": "source",
"payload": {
"kind": "asset_complex",
"payload": {
"kind": "sequence",
"asset_versions": [
{
"version_uid": "0",
"asset_components": [
{
"location": {
"storage_provider": "s3",
"path": "{{source_video_path}}"
},
"kind": "name",
"name": "{{source_video_file}}",
"component_uid": "video",
"contents": [
{
"kind": "video"
}
]
},
{
"location": {
"storage_provider": "s3",
"path": "{{source_audio_path}}"
},
"kind": "name",
"name": "{{source_audio_file}}",
"component_uid": "audio",
"contents": [
{
"kind": "audio",
"payload": {
"language": "eng"
},
"map": [
{
"input": {
"track": 0,
"channel": 0
},
"output": {
"track": 0,
"channel": 0
}
},
{
"input": {
"track": 1,
"channel": 0
},
"output": {
"track": 0,
"channel": 1
}
}
]
}
]
},
{
"location": {
"storage_provider": "s3",
"path": "{{source_subtitle_path}}"
},
"kind": "name",
"name": "{{source_subtitle_file}}",
"component_uid": "audio",
"contents": [
{
"kind": "subtitle",
"payload": {
"format": "auto",
"language": "en"
}
}
]
}
]
}
]
}
}
}
Stitched Sequence with Multiple Source Elements
Extending the media pipeline to be comprised of a sequence of segments (aka stitching assets) can be achieved by adding version objects in the asset_versions
array. A full job example of this is available below.
More details on source stitching can be found in the Asset Complex Tutorial.