Skip to main content

Include_conditions

Where "include_if_source_has" sets conditions on whether a particular input track exists, the "include_conditions" can set more sophisticated conditions. You might want to specify, for example, that a particular output track should only be created when the input video is UHD. The "include_conditions" is an array, so that you can set a number of conditions that need to be true in order for the output section to be created.

A condition requiring the source width to be larger than 1920 pixels and the duration to be longer than 10 minutes would be:

"include_conditions": [ "source.video.width > 1920", "source.video.duration_sec > 600" ]

The example below creates 2 outputs (1080p and 720p) if the source file is greater than or equal to 1920 horizontal pixels. Otherwise it only creates a single 720p output.


Example include_conditions

{
{
"name": "Hybrik Include_conditions Example",
"payload": {
"elements": [
{
"uid": "source_file",
"kind": "source",
"payload": {
"kind": "asset_url",
"payload": {
"storage_provider": "s3",
"url": "s3://my_bucket/my_input_folder/my_file.mp4"
}
}
},
{
"uid": "transcode_task",
"kind": "transcode",
"payload": {
"location": {
"storage_provider": "s3",
"path": "s3://my_bucket/my_output_folder"
},
"targets": [
{
"include_conditions": [
"source.video.width >= 1920"
],
"file_pattern": "{source_basename}_1920x1080.mp4",
"existing_files": "replace",
"container": {
"kind": "mp4"
},
"video": {
"codec": "h264",
"bitrate_mode": "vbr",
"bitrate_kb": 3000,
"max_bitrate_kb": 3600,
"width": 1920
},
"audio": [
{
"channels": 2,
"codec": "aac_lc",
"sample_rate": 48000,
"bitrate_kb": 96
}
]
},
{

"file_pattern": "{source_basename}_1280x720.mp4",
"existing_files": "replace",
"container": {
"kind": "mp4"
},
"video": {
"codec": "h264",
"bitrate_mode": "vbr",
"bitrate_kb": 1500,
"max_bitrate_kb": 1200,
"width": 1280
},
"audio": [
{
"channels": 2,
"codec": "aac_lc",
"sample_rate": 48000,
"bitrate_kb": 96
}
]
}

]
}
}
],
"connections": [
{
"from": [
{
"element": "source_file"
}
],
"to": {
"success": [
{
"element": "transcode_task"
}
]
}
}
]
}
}