Definitions
The Definitions object allows you to create global string replacements in the Job JSON. This can be useful for simplifying editing or parameter replacements in the JSON. If a string such as "my_string" is defined in the Definitions section, then Hybrik will replace every occurrence of {{my_string}}
in the rest of the Job JSON with the value of "my_string" in the Definitions section. Using the Job Definition example, every occurrence of {{destination}}
in the Job JSON would be replaced with the path defined at the top. If you need to insert the contents of an object in the definitions into an object, use the "$inherits" label. This can be particularly helpful when dealing with multi-layer outputs, since a setting can be changed in one location and affect all of the output layers. When submitting jobs via the API, you should consider putting all of the parameters that will be replaced by the automation system into the definitions section. This makes it instantly visible which parameters need to be replaced and makes swapping out parameters simple. It is much easier to reference definitions.bitrate than it is to reference elements[1].transcode.payload.targets[0].video.bitrate_kb!
Definitions Example
{
"definitions": {
"source": "s3://my_bucket/my_folder/my_file.mp4",
"destination": "s3://my_bucket/output_folder",
"video_basics": {
"codec": "h264",
"profile": "high",
"level": "3.0",
"frame_rate": "24000/1001"
},
"audio_basics": {
"codec": "aac_lc",
"sample_rate": 48000,
"bitrate_kb": 128
}
},
"name": "My job: {{source}}",
"payload": {
"elements": [
{
"uid": "source_file",
"kind": "source",
"payload": {
"kind": "asset_url",
"payload": {
"storage_provider": "s3",
"url": "{{source}}"
}
}
},
{
"uid": "transcode_task",
"kind": "transcode",
"payload": {
"location": {
"storage_provider": "s3",
"path": "{{destination}}"
},
"targets": [
{
"file_pattern": "{source_basename}_1200kbps.mp4",
"existing_files": "replace",
"container": {
"kind": "mp4"
},
"video": {
"$inherits": "video_basics",
"width": 1280,
"height": 720,
"bitrate_kb": 1200
},
"audio": [
{
"$inherits": "audio_basics",
"channels": 2
}
]
}
]
}
}
],
"connections": [
{
"from": [
{
"element": "source_file"
}
],
"to": {
"success": [
{
"element": "transcode_task"
}
]
}
}
]
}
}