analysis.j2.json

[
    // {% if metadata.analysis_type eq 'rekognition' %}
    {% include 'partials/rekognition_analysis.j2.json' %}
    // {% endif %}
]

asset_export.j2.json

[
    {
        "type": "EXPORT",
        "actions": [
            // {% for asset in assets %}
            {% include 'partials/asset_export.j2.json' %}
            // {% endfor %}
        ],
        "metadata": [
            // {% if metadata['cascade_fail_to_children'] is defined %}
            {
                "key": "cascade_fail_to_children",
                "value": "{{metadata.cascade_fail_to_children}}"
            },
            // {% endif %}
            // {% if metadata['cascade_abort_to_children'] is defined %}
            {
                "key": "cascade_abort_to_children",
                "value": "{{metadata.cascade_abort_to_children}}"
            },
            // {% endif %}
            // {% if metadata['cascade_fail_to_parent'] is defined %}
            {
                "key": "cascade_fail_to_parent",
                "value": "{{metadata.cascade_fail_to_parent}}"
            },
            // {% endif %}
            // {% if metadata['cascade_abort_to_parent'] is defined %}
            {
                "key": "cascade_abort_to_parent",
                "value": "{{metadata.cascade_abort_to_parent}}"
            },
            // {% endif %}
        ]
    }
]

file_export.j2.json

[
    {
        "type": "EXPORT",
        "actions": [
            // {% for file in files %}
            {% include 'partials/file_export.j2.json' %}
            // {% endfor %}
        ],
        "metadata": [
            // {% if metadata['cascade_fail_to_children'] is defined %}
            {
                "key": "cascade_fail_to_children",
                "value": "{{metadata.cascade_fail_to_children}}"
            },
            // {% endif %}
            // {% if metadata['cascade_abort_to_children'] is defined %}
            {
                "key": "cascade_abort_to_children",
                "value": "{{metadata.cascade_abort_to_children}}"
            },
            // {% endif %}
            // {% if metadata['cascade_fail_to_parent'] is defined %}
            {
                "key": "cascade_fail_to_parent",
                "value": "{{metadata.cascade_fail_to_parent}}"
            },
            // {% endif %}
            // {% if metadata['cascade_abort_to_parent'] is defined %}
            {
                "key": "cascade_abort_to_parent",
                "value": "{{metadata.cascade_abort_to_parent}}"
            },
            // {% endif %}
        ]
    }
]

ingest.j2.json

[
    {
        "type": "INGEST",
        "actions": [
            {% include 'partials/cleanup.j2.json' %}
            // {% for file in files %}
            {% include 'partials/file_ingest.j2.json' %}
            // {% endfor %}
        ],
        "metadata": [
            {
                "key": "asset_id",
                "value": "{{metadata.target_asset_id}}"
            },
            // {% if metadata['cascade_fail_to_children'] is defined %}
            {
                "key": "cascade_fail_to_children",
                "value": "{{metadata.cascade_fail_to_children}}"
            },
            // {% endif %}
            // {% if metadata['cascade_abort_to_children'] is defined %}
            {
                "key": "cascade_abort_to_children",
                "value": "{{metadata.cascade_abort_to_children}}"
            },
            // {% endif %}
            // {% if metadata['cascade_fail_to_parent'] is defined %}
            {
                "key": "cascade_fail_to_parent",
                "value": "{{metadata.cascade_fail_to_parent}}"
            },
            // {% endif %}
            // {% if metadata['cascade_abort_to_parent'] is defined %}
            {
                "key": "cascade_abort_to_parent",
                "value": "{{metadata.cascade_abort_to_parent}}"
            },
            // {% endif %}
        ]
    }
]

poster_create.j2.json

[
    {
        "type": "POSTER",
        "actions": [
            {% include 'partials/poster_create.j2.json' %}
        ]
    }
]

rekognition_analysis.j2.json

[
    {% include 'partials/rekognition_analysis.j2.json' %}
]

timespan_export.j2.json

[
    // {% if metadata.timespan_type eq 'subtitle' %}
    {% include 'partials/subtitle_export.j2.json' %}
    // {% else %}
    {% include 'partials/marker_export.j2.json' %}
    // {% endif %}
]

render/elemental.j2.json

[
    {
        "type": "RENDER",
        "actions": [
            // {% if metadata['target_asset_id'] is defined %}
            {% include 'partials/cleanup.j2.json' %}
            // {% endif %}
            {% include 'render/partials/get_timeline.j2.json' %}
            {
                "type": "ELEMENTAL_RENDER",
                "metadata": [
                    {
                        "key": "target_storage_id",
                        "value": "{{metadata.target_storage_id}}"
                    },
                    {
                        "key": "target_path",
                        "value": "{{metadata.target_path}}"
                    },
                    {
                        "key": "template_id",
                        "value": "{{metadata.preset_id}}"
                    },
                    // {% if metadata['files'] is defined %}
                    {
                        "key": "outputs",
                        "value": "{{metadata.files | escapejson}}"
                    }
                    // {% endif %}
                ]
            },
            // {% if metadata['target_asset_id'] is defined %}
            // {% for file in files %}
            {
                "type": "INDEX_FILE",
                "metadata": [
                    {
                        "key": "storage_id",
                        "value": "{{metadata.target_storage_id}}"
                    },
                    {
                        "key": "file_name",
                        "value": "${elemental_file_output.{{loop.index0}}}"
                    },
                    {
                        "key": "file_type",
                        "value": "{{file.type}}"
                    },
                    // {% for m in file.metadata %}
                    // {% if m.key.startsWith('file_metadata') %}
                    {
                        "key": "{{m.key}}",
                        "value": "{{m.value}}"
                    },
                    // {% endif %}
                    // {% endfor %}
                ]
            },
            {
                "type": "RESULT",
                "metadata": [
                    {
                        "key": "result:destination_file_id",
                        "value": "${target_file_id}"
                    }
                ]
            },
            {% include 'render/partials/attach_file.j2.json' %}
            // {% endfor %}
            // {% endif %}
        ],
        "metadata": [
            // {% if metadata['cascade_fail_to_children'] is defined %}
            {
                "key": "cascade_fail_to_children",
                "value": "{{metadata.cascade_fail_to_children}}"
            },
            // {% endif %}
            // {% if metadata['cascade_abort_to_children'] is defined %}
            {
                "key": "cascade_abort_to_children",
                "value": "{{metadata.cascade_abort_to_children}}"
            },
            // {% endif %}
            // {% if metadata['cascade_fail_to_parent'] is defined %}
            {
                "key": "cascade_fail_to_parent",
                "value": "{{metadata.cascade_fail_to_parent}}"
            },
            // {% endif %}
            // {% if metadata['cascade_abort_to_parent'] is defined %}
            {
                "key": "cascade_abort_to_parent",
                "value": "{{metadata.cascade_abort_to_parent}}"
            },
            // {% endif %}
        ]
    }
]

render/ffmpeg.j2.json

[
    {
        "type": "RENDER",
        "actions": [
            // {% if metadata['target_asset_id'] is defined and not metadata.retain_asset_on_failure %}
            {% include 'partials/cleanup.j2.json' %}
            // {% endif %}
            {% include 'render/partials/get_timeline.j2.json' %}
            {
                "type": "FFMPEG_RENDER",
                "metadata": [
                    {
                        "key": "target_path",
                        "value": "{{metadata.target_path}}"
                    },
                    {
                        "key": "template_id",
                        "value": "{{metadata.preset_id}}"
                    },
                    // {% if metadata['files'] is defined %}
                    {
                        "key": "outputs",
                        "value": "{{metadata.files | escapejson}}"
                    }
                    // {% endif %}
                ]
            },
            // {% for file in files %}
            {
                "type": "IMPORT_FILE",
                "metadata": [
                    {
                        "key": "target_storage_id",
                        "value": "{{metadata.target_storage_id}}"
                    },
                    {
                        "key": "target_path",
                        "value": "{{file.fileName}}"
                    },
                    {
                        "key": "source_path",
                        "value": "${ffmpeg_file_output.{{loop.index0}}}"
                    },
                    {
                        "key": "file_type",
                        "value": "{{file.type}}"
                    },
                    {
                        "key": "file_url",
                        "value": "${ffmpeg_file_output.{{loop.index0}}}"
                    },
                    // {% if metadata['transcode:source_file_id'] is defined %}
                    {
                        "key": "file_metadata:source_file_id",
                        "value": "{{metadata['transcode:source_file_id']}}"
                    },
                    // {% endif %}
                    // {% for m in file.metadata %}
                    // {% if m.key.startsWith('file_metadata') %}
                    {
                        "key": "{{m.key}}",
                        "value": "{{m.value}}"
                    },
                    // {% endif %}
                    // {% endfor %}
                ]
            },
            {
                "type": "RESULT",
                "metadata": [
                    {
                        "key": "result:destination_file_id",
                        "value": "${target_file_id}"
                    }
                ]
            },
            // {% if metadata['target_asset_id'] is defined %}
            {% include 'render/partials/attach_file.j2.json' %}
            // {% endif %}
            // {% endfor %}
        ],
        "metadata": [
            // {% if metadata['cascade_fail_to_children'] is defined %}
            {
                "key": "cascade_fail_to_children",
                "value": "{{metadata.cascade_fail_to_children}}"
            },
            // {% endif %}
            // {% if metadata['cascade_abort_to_children'] is defined %}
            {
                "key": "cascade_abort_to_children",
                "value": "{{metadata.cascade_abort_to_children}}"
            },
            // {% endif %}
            // {% if metadata['cascade_fail_to_parent'] is defined %}
            {
                "key": "cascade_fail_to_parent",
                "value": "{{metadata.cascade_fail_to_parent}}"
            },
            // {% endif %}
            // {% if metadata['cascade_abort_to_parent'] is defined %}
            {
                "key": "cascade_abort_to_parent",
                "value": "{{metadata.cascade_abort_to_parent}}"
            },
            // {% endif %}
        ]
    }
]

render/select.j2.json

// {% if metadata['transcoder'] is not defined or metadata.transcoder eq 'ffmpeg' %}
{% include 'render/ffmpeg.j2.json' %}
// {% else if metadata.transcoder eq 'elemental' %}
{% include 'render/elemental.j2.json' %}
// {% else %}
[]
// {% endif %}

render/partials/attach_file.j2.json

    {
        "type": "ATTACH_FILE",
        "metadata": [
            {
                "key": "file_id",
                "value": "${target_file_id}"
            },
            {
                "key": "asset_id",
                "value": "{{metadata.target_asset_id}}"
            }
        ]
    },
    {
        "type": "ANALYZE_FILE",
        "metadata": [
            {
                "key": "source_file_id",
                "value": "${target_file_id}"
            },
            {
                "key": "source_path",
                "value": "${file_url}"
            }
        ]
    },
    // {% if file.type eq 'VIDEO' and file.getMetadataValue('skip_image_extraction') ne 'true' %}
    {% include 'render/partials/video_ingest.j2.json' %}
    // {% endif %}

render/partials/get_timeline.j2.json

    {
        "type": "GET_TIMELINE",
        "metadata": [
            // {% if metadata['timeline'] is defined %}
            {
                "key": "timeline",
                "value": "{{metadata.timeline | escapejson }}"
            },
            // {% elif metadata['timeline_asset_id'] is defined %}
            {
                "key": "asset_id",
                "value": "{{metadata.timeline_asset_id}}"
            },
            // {% elif metadata['implicit_timeline_asset_id'] is defined %}
            {
                "key": "implicit_timeline_asset_id",
                "value": "{{metadata.implicit_timeline_asset_id}}"
            },
            // {% elif metadata['implicit_timeline_file_id'] is defined %}
            {
                "key": "implicit_timeline_file_id",
                "value": "{{metadata.implicit_timeline_file_id}}"
            },
            // {% endif %}
            // {% if metadata['expand_timeline_from_video_track'] is defined %}
            {
                "key": "expand_timeline_from_video_track",
                "value": "{{metadata.expand_timeline_from_video_track}}"
            }
            // {% endif %}
        ]
    },

render/partials/video_ingest.j2.json

    {
        "type": "EXPORT_FILE",
        "metadata": [
            {
                "key": "source_file_id",
                "value": "${target_file_id}"
            },
            {
                "key": "target_path",
                "value": "v-{{file.fileName}}"
            },
            {
                "key": "target_path_export",
                "value": "v-{{file.fileName}}"
            },
            {
                "key": "target_uri_exist_policy",
                "value": "overwrite"
            }
        ]
    },
    {
        "type": "POSTER",
        "metadata": [
            {
                "key": "original_file_type",
                "value": "{{file.type}}"
            },
            {
                "key": "source_path",
                "value": "${target_path_export}"
            },
            {
                "key": "target_path_poster",
                "value": "poster_{{uuid}}.jpg"
            }
        ]
    },
    {
        "type": "IMPORT_FILE",
        "metadata": [
            {
                "key": "source_path",
                "value": "${target_path_poster}"
            },
            {
                "key": "skip_if_previous_skipped",
                "value": "true"
            },
            {
                "key": "target_path",
                "value": "posters/${target_path_poster}"
            },
            {
                "key": "target_storage_id",
                "value": "{% storage_id_by_tag poster %}"
            },
            {
                "key": "file_metadata:still_frame:type",
                "value": "poster"
            },
            {
                "key": "file_metadata:ap:legacy:resolution",
                "value": "${poster:resolution}"
            },
            {
                "key": "file_metadata:still_frame:timestamp",
                "value": "${poster:timestamp}"
            },
            {
                "key": "target_path_exist_policy",
                "value": "overwrite"
            }
        ]
    },
    {
        "type": "ATTACH_FILE",
        "metadata": [
            {
                "key": "file_id",
                "value": "${target_file_id}"
            },
            {
                "key": "asset_id",
                "value": "{{metadata.target_asset_id}}"
            },
            {
                "key": "skip_if_previous_skipped",
                "value": "true"
            }
        ]
    },
    {
        "type": "SPRITE_MAP",
        "metadata": [
            {
                "key": "source_path",
                "value": "${target_path_export}"
            },
            {
                "key": "interval_count",
                "value": "50"
            },
            {
                "key": "interval_seconds",
                "value": "10"
            },
            {
                "key": "target_path_spritemap",
                "value": "spritemap_{{uuid}}.jpg"
            }
        ]
    },
    {
        "type": "IMPORT_FILE",
        "metadata": [
            {
                "key": "source_path",
                "value": "${target_path_spritemap}"
            },
            {
                "key": "skip_if_previous_skipped",
                "value": "true"
            },
            {
                "key": "target_path",
                "value": "spritemaps/${target_path_spritemap}"
            },
            {
                "key": "target_storage_id",
                "value": "{% storage_id_by_tag sprite_map %}"
            },
            {
                "key": "file_metadata_file:sprite_map",
                "value": "${target_path_manifest}"
            },
            {
                "key": "file_type",
                "value": "SPRITE_MAP"
            },
            {
                "key": "target_path_exist_policy",
                "value": "overwrite"
            }
        ]
    },
    {
        "type": "ATTACH_FILE",
        "metadata": [
            {
                "key": "file_id",
                "value": "${target_file_id}"
            },
            {
                "key": "asset_id",
                "value": "{{metadata.target_asset_id}}"
            },
            {
                "key": "skip_if_previous_skipped",
                "value": "true"
            }
        ]
    },

partials/asset_export.j2.json

    // {% for file in asset.files %}
    // {% if file.type eq 'VIDEO' and metadata['export_video'] is defined and metadata['export_video'] eq 'true' %}
    {% include 'partials/file_export.j2.json '%}
    // {% else if file.type eq 'AUDIO' and metadata['export_audio'] is defined and metadata['export_audio'] eq 'true' %}
    {% include 'partials/file_export.j2.json '%}
    // {% else if file.type eq 'SUBTITLE' and metadata['export_subtitle'] is defined and metadata['export_subtitle'] eq 'true' %}
    {% include 'partials/file_export.j2.json '%}
    // {% endif %}
    // {% endfor %}
    // {% if metadata['export_markers'] is defined and metadata['export_markers'] eq 'true' %}
    {
        "type": "MARKER_EXPORT",
        "metadata": [
            {
                "key": "asset_id",
                "value": "{{metadata.asset_id}}"
            },
            // {% if metadata["marker_timespan_type"] is defined %}
            {
                "key": "timespan_type",
                "value": "{{metadata.marker_timespan_type}}"
            },
            // {% endif %}
            // {% if metadata["marker_csv_fields"] is defined %}
            {
                "key": "csv_fields",
                "value": "{{metadata.marker_csv_fields}}"
            },
            // {% endif %}
            // {% if metadata["marker_csv_separator"] is defined %}
            {
                "key": "csv_separator",
                "value": "{{metadata.marker_csv_separator}}"
            },
            // {% endif %}
            // {% if metadata["frame_rate_numerator"] is defined %}
            {
                "key": "frame_rate_numerator",
                "value": "{{metadata.frame_rate_numerator}}"
            },
            // {% endif %}
            // {% if metadata["frame_rate_denominator"] is defined %}
            {
                "key": "frame_rate_denominator",
                "value": "{{metadata.frame_rate_denominator}}"
            },
            // {% endif %}
            // {% if metadata["dropframe"] is defined %}
            {
                "key": "dropframe",
                "value": "{{metadata.dropframe}}"
            },
            // {% endif %}
            // {% if metadata["marker_destination_format"] is defined %}
            {
                "key": "destination_format",
                "value": "{{metadata.marker_destination_format}}"
            },
            // {% endif %}
            // {% for m in metadataList %}
            // {% if m.key.startsWith('marker:filter:') %}
            {
                "key": "{{m.key.substring(7)}}",
                "value": "{{m.value}}"
            },
            // {% else if m.key == 'marker_timespan_ids' %}
            {
                "key": "timespan_ids",
                "value": "{{m.value}}"
            },
            // {% endif %}
            // {% endfor %}
            {
                "key": "target_path",
                "value": "{{uuid}}.{{metadata.marker_export_suffix}}"
            }
        ]
    },
    {
        "type": "IMPORT_FILE",
        "metadata": [
            // {% if metadata["target_storage_id"] is defined %}
            {
                "key": "target_storage_id",
                "value": "{{metadata.target_storage_id}}"
            },
            // {% else %}
            {
                "key": "external",
                "value": "true"
            },
            // {% endif %}
            {
                "key": "source_path",
                "value": "{{uuid}}.{{metadata.marker_export_suffix}}"
            },
            {
                "key": "target_path",
                "value": "{{metadata.marker_target_path}}"
            },
            {
                "key": "target_uri_exist_policy",
                "value": "overwrite"
            }
        ]
    },
    // {% endif %}

partials/audio_ingest.j2.json

    {
        "type": "EXPORT_FILE",
        "metadata": [
            {
                "key": "source_file_id",
                "value": "{{file.id}}"
            },
            {
                "key": "target_path",
                "value": "a-{{file.fileName}}"
            },
            {
                "key": "target_path_export",
                "value": "a-{{file.fileName}}"
            }
        ]
    },

    {% include 'partials/waveform.j2.json' %}

partials/baton_ingest.j2.json

    {
        "type": "BATON_IMPORT",
        "metadata": [
            {
                "key": "asset_id",
                "value": "{{metadata.target_asset_id}}"
            },
            {
                "key": "storage_id",
                "value": "{{file.storageId}}"
            },
            {
                "key": "source_path",
                "value": "{{file.url}}"
            },
            {
                "key": "storage_path",
                "value": "{{file.fileName}}"
            },
            {
                "key": "original_file_type",
                "value": "{{file.type}}"
            }
        ]
    },

partials/cleanup.j2.json

    {
        "type": "ASSET_CLEANUP",
        "metadata": [
            {
                "key": "asset_id",
                "value": "{{metadata.target_asset_id}}"
            },
            // {% if metadata["retain_asset_on_failure"] is defined %}
            {
                "key": "retain_asset_on_failure",
                "value": "{{metadata.retain_asset_on_failure}}"
            },
            // {% endif %}
        ]
    },

partials/file_export.j2.json

    {
        "type": "COPY_FILE",
        "metadata": [
            {
                "key": "source_file_id",
                "value": "{{file.id}}"
            },
            // {% if metadata.source_storage_id is defined ‰}
            {
                "key": "source_storage_id",
                "value": "{{metadata.source_storage_id}}"
            },
            // {% endif %}
            // {% if metadata.target_storage_id is defined ‰}
            {
                "key": "target_storage_id",
                "value": "{{metadata.target_storage_id}}"
            },
            // {% endif %}
            // {% if metadata.append_filename is defined ‰}
            {
                "key": "append_filename",
                "value": "{{metadata.append_filename}}"
            },
            // {% endif %}
            {
                "key": "target_path",
                "value": "{{metadata.export_url}}"
            },
            {
                "key": "external",
                "value": "true"
            }
        ]
    },

partials/file_ingest.j2.json

    // {% if file.type eq 'VIDEO' and ((not file.container) or (file.container.videoStreams)) %}
       {% include 'partials/video_ingest.j2.json' %}
    {
        "type": "BUILD_TRANSCODE_JOB",
        "metadata": [
            {
                "key": "transcode_file_id",
                "value": "{{file.id}}"
            },
            {
                "key": "target_path",
                "value": "lowres/{{file.id}}/"
            },
            {
                "key": "target_storage_id",
                "value": "{% storage_id_by_tag lowres %}"
            },
            {
                "key": "force_audio_output_per_track",
                "value": "true"
            },
            // {% if metadata['skip_transcode'] is defined %}
            {
                "key": "skip_transcode",
                "value": "{{metadata.skip_transcode}}"
            },
            // {% endif %}
            // {% for m in metadataList %}
            // {% if m.key eq 'original_extra_tag' or m.key eq 'web_ready_tag' %}
            {
                "key": "{{m.key}}",
                "value": "{{m.value}}"
            },
            // {% endif %}
            // {% endfor %}
        ]
    },
    // {% elif file.type eq 'AUDIO' and ((not file.container) or (file.container.audioStreams)) %}
    {% include 'partials/audio_ingest.j2.json' %}
    // {% elif file.type eq 'SUBTITLE' %}
    {% include 'partials/subtitle_ingest.j2.json' %}
    // {% elif file.type eq 'BATON' %}
    {% include 'partials/baton_ingest.j2.json' %}
    // {% elif file.type eq 'MARKER' %}
    {% include 'partials/marker_ingest.j2.json' %}
    // {% elif file.type eq 'MANIFEST' %}
    {% include 'partials/manifest_ingest.j2.json' %}
    // {% endif %}

partials/manifest_ingest.j2.json

    {
        "type": "MANIFEST_INGEST",
        "metadata": [
            {
                "key": "storage_id",
                "value": "{{file.storageId}}"
            },
            {
                "key": "source_path",
                "value": "{{file.url}}"
            },
            {
                "key": "storage_path",
                "value": "{{file.fileName}}"
            },
            // {% if metadata['manifest_template_id'] is defined %}
            {
                "key": "ingest_template_id",
                "value": "{{metadata.manifest_template_id}}"
            },
            // {% endif %}
            // {% if metadata['manifest_format'] is defined %}
            {
                "key": "manifest_format",
                "value": "{{metadata.manifest_format}}"
            },
            // {% endif %}
            {
                "key": "asset_id",
                "value": "{{metadata.target_asset_id}}"
            }
        ]
    },

partials/marker_export.j2.json

{
    "type": "EXPORT",
    "actions": [
        {
            "type": "MARKER_EXPORT",
            "metadata": [
                {
                    "key": "asset_id",
                    "value": "{{metadata.asset_id}}"
                },
                // {% if metadata["timespan_type"] is defined %}
                {
                    "key": "timespan_type",
                    "value": "{{metadata.timespan_type}}"
                },
                // {% endif %}
                // {% if metadata["csv_fields"] is defined %}
                {
                    "key": "csv_fields",
                    "value": "{{metadata.csv_fields}}"
                },
                // {% endif %}
                // {% if metadata["csv_separator"] is defined %}
                {
                    "key": "csv_separator",
                    "value": "{{metadata.csv_separator}}"
                },
                // {% endif %}
                // {% if metadata["frame_rate_numerator"] is defined %}
                {
                    "key": "frame_rate_numerator",
                    "value": "{{metadata.frame_rate_numerator}}"
                },
                // {% endif %}
                // {% if metadata["frame_rate_denominator"] is defined %}
                {
                    "key": "frame_rate_denominator",
                    "value": "{{metadata.frame_rate_denominator}}"
                },
                // {% endif %}
                // {% if metadata["dropframe"] is defined %}
                {
                    "key": "dropframe",
                    "value": "{{metadata.dropframe}}"
                },
                // {% endif %}
                // {% if metadata["destination_format"] is defined %}
                {
                    "key": "destination_format",
                    "value": "{{metadata.destination_format}}"
                },
                // {% endif %}
                // {% for m in metadataList %}
                // {% if m.key.startsWith('filter:') or m.key == 'timespan_ids' %}
                {
                    "key": "{{m.key}}",
                    "value": "{{m.value}}"
                },
                // {% endif %}
                // {% endfor %}
                {
                    "key": "target_path",
                    "value": "{{uuid}}.{{metadata.export_suffix}}"
                }
            ]
        },
        {
            "type": "IMPORT_FILE",
            "metadata": [
                // {% if metadata["target_storage_id"] is defined %}
                {
                    "key": "target_storage_id",
                    "value": "{{metadata.target_storage_id}}"
                },
                // {% else %}
                {
                    "key": "target_storage_id",
                    "value": "{% storage_id_by_tag marker_export %}"
                },
                // {% endif %}
                {
                    "key": "source_path",
                    "value": "{{uuid}}.{{metadata.export_suffix}}"
                },
                {
                    "key": "target_path",
                    "value": "{{metadata.target_path}}"
                },
                {
                    "key": "target_uri_exist_policy",
                    "value": "increment"
                }
            ]
        },
        {
            "type": "RESULT",
            "metadata": [
                {
                    "key": "result:destination_file_id",
                    "value": "${target_file_id}"
                }
            ]
        }
    ]
},

partials/marker_ingest.j2.json

    {
        "type": "MARKER_IMPORT",
        "metadata": [
            {
                "key": "asset_id",
                "value": "{{metadata.target_asset_id}}"
            },
            {
                "key": "source_path",
                "value": "{{file.url}}"
            },
            {
                "key": "storage_id",
                "value": "{{file.storageId}}"
            },
            {
                "key": "storage_path",
                "value": "{{file.fileName}}"
            },
            {
                "key": "source_format",
                "value": "{{file.container.format}}"
            },
            // {% if file.getOptionalMetadataValue('frame_rate_numerator').isPresent() %}
            {
                "key": "frame_rate_numerator",
                "value": "{{file.getMetadataValue('frame_rate_numerator')}}"
            },
            // {% endif %}
            // {% if file.getOptionalMetadataValue('frame_rate_denominator').isPresent() %}
            {
                "key": "frame_rate_denominator",
                "value": "{{file.getMetadataValue('frame_rate_denominator')}}"
            },
            // {% endif %}
            // {% if file.getOptionalMetadataValue('dropframe').isPresent() %}
            {
                "key": "dropframe",
                "value": "{{file.getMetadataValue('dropframe')}}"
            },
            // {% endif %}
            // {% if file.getOptionalMetadataValue('timespan_type').isPresent() %}
            {
                "key": "timespan_type",
                "value": "{{file.getMetadataValue('timespan_type')}}"
            },
            // {% endif %}
            // {% if file.getOptionalMetadataValue('csv_separator').isPresent() %}
            {
                "key": "csv_separator",
                "value": "{{file.getMetadataValue('csv_separator')}}"
            },
            // {% endif %}
            // {% for m in metadataList %}
            // {% if m.key.startsWith('metadata:') %}
            {
                "key": "{{m.key}}",
                "value": "{{m.value}}"
            },
            // {% endif %}
            // {% endfor %}
        ]
    },

partials/poster_create.j2.json

    {
        "type": "POSTER",
        "metadata": [
            {
                "key": "original_file_type",
                "value": "VIDEO"
            },
            {
                "key": "source_path",
                "value": "{{metadata.source_path}}"
            },
            {
                "key": "image_format",
                "value": "{{metadata.image_format}}"
            },
            {
                "key": "target_path_poster",
                "value": "poster_{{uuid}}.${image_format}"
            },
            // {% if metadata['destination_resolution'] is defined %}
            {
                "key": "destination_resolution",
                "value": "{{metadata.destination_resolution}}"
            },
            // {% endif %}
            // {% if metadata['region_source_in'] is defined %}
            {
                "key": "region_source_in",
                "value": "{{metadata.region_source_in}}"
            },
            // {% endif %}
            // {% if metadata['region_source_out'] is defined %}
            {
                "key": "region_source_out",
                "value": "{{metadata.region_source_out}}"
            },
            // {% endif %}
            // {% if metadata['frame'] is defined %}
            {
                "key": "frame",
                "value": "{{metadata.frame}}"
            }
            // {% endif %}
        ]
    },
    {
        "type": "IMPORT_FILE",
        "metadata": [
            {
                "key": "source_path",
                "value": "${target_path_poster}"
            },
            {
                "key": "target_path",
                "value": "{{metadata.target_path}}"
            },
            {
                "key": "target_storage_id",
                "value": "{{metadata.target_storage_id}}"
            },
            {
                "key": "file_metadata:still_frame:type",
                "value": "poster"
            },
            {
                "key": "file_metadata:ap:legacy:resolution",
                "value": "${poster:resolution}"
            },
            {
                "key": "file_metadata:still_frame:timestamp",
                "value": "${poster:timestamp}"
            },
            // {% for m in metadataList %}
            // {% if m.key.startsWith('file_metadata:') %}
            {
                "key": "{{m.key}}",
                "value": "{{m.value}}"
            },
            // {% endif %}
            // {% endfor %}
        ]
    },
    {
        "type": "RESULT",
        "metadata": [
            {
                "key": "result:destination_file_id",
                "value": "${target_file_id}"
            }
        ]
    },
    // {% if metadata['target_asset_id'] is defined %}
    {
        "type": "ATTACH_FILE",
        "metadata": [
            {
                "key": "file_id",
                "value": "${target_file_id}"
            },
            {
                "key": "asset_id",
                "value": "{{metadata.target_asset_id}}"
            }
        ]
    },
    // {% endif %}

partials/rekognition_allow_fail.j2.json

    {
        "type": "TEMPLATE",
        "metadata": [
            {
                "key": "template_id",
                "value": "rekognition_analysis"
            },
            {
                "key": "propagate_fail_to_parent",
                "value": "false"
            },
            {
                "key": "propagate_abort_to_parent",
                "value": "false"
            },
            {
                "key": "cascade_fail_to_children",
                "value": "false"
            },
            {
                "key": "cascade_abort_to_children",
                "value": "false"
            },
            {
                "key": "asset_id",
                "value": "{{metadata.target_asset_id}}"
            },
            {
                "key": "file_id",
                "value": "{{file.id}}"
            },
            {
                "key": "segment_type",
                "value": "shot"
            }
        ]
    },

partials/rekognition_analysis.j2.json

{
    "type": "REKOGNITION",
    "actions": [
        {
            "type": "ASSET_METADATA_UPDATE",
            "metadata": [
                {
                    "key": "asset_id",
                    "value": "{{metadata.asset_id}}"
                },
                {
                    "key": "metadata:aws_rekognition_status",
                    "value": "active"
                },
                {
                    "key": "metadata:rekognition_job_id",
                    "value": "${av:job:job_id}"
                },
                {
                    "key": "metadata:rekognition_job_started",
                    "value": "${av:job:timestamp}"
                },
                // {% for m in metadataList %}
                // {% if m.key.equals('rekognition_type') %}
                // {% if m.value.equals('shot') %}
                {
                    "key": "metadata:rekognition:{{m.key}}",
                    "value": "{{m.value}}"
                },
                {
                    "key": "metadata:rekognition:shot:status",
                    "value": "active"
                },
                // {% if metadata["shot_confidence"] is defined %}
                {
                    "key": "metadata:rekognition:shot_confidence",
                    "value": "{{metadata.shot_confidence}}"
                },
                // {% endif %}
                // {% endif %}
                // {% if m.value.equals('technical_cue') %}
                {
                    "key": "metadata:rekognition:{{m.key}}",
                    "value": "{{m.value}}"
                },
                {
                    "key": "metadata:rekognition:technical_cue:status",
                    "value": "active"
                },
                // {% if metadata["technical_cue_confidence"] is defined %}
                {
                    "key": "metadata:rekognition:technical_cue_confidence",
                    "value": "{{metadata.technical_cue_confidence}}"
                },
                // {% endif %}
                // {% endif %}
                // {% if m.value.equals('content_moderation') %}
                {
                    "key": "metadata:rekognition:{{m.key}}",
                    "value": "{{m.value}}"
                },
                {
                    "key": "metadata:rekognition:content_moderation:status",
                    "value": "active"
                },
                // {% if metadata["content_moderation_confidence"] is defined %}
                {
                    "key": "metadata:rekognition:content_moderation_confidence",
                    "value": "{{metadata.content_moderation_confidence}}"
                },
                // {% endif %}
                // {% endif %}
                // {% if m.value.equals('label_detection') %}
                {
                    "key": "metadata:rekognition:{{m.key}}",
                    "value": "{{m.value}}"
                },
                {
                    "key": "metadata:rekognition:label_detection:status",
                    "value": "active"
                },
                // {% if metadata["label_detection_confidence"] is defined %}
                {
                    "key": "metadata:rekognition:label_detection_confidence",
                    "value": "{{metadata.label_detection_confidence}}"
                },
                // {% endif %}
                // {% endif %}
                // {% if m.value.equals('celebrity_detection') %}
                {
                    "key": "metadata:rekognition:{{m.key}}",
                    "value": "{{m.value}}"
                },
                {
                    "key": "metadata:rekognition:celebrity_detection:status",
                    "value": "active"
                },
                // {% if metadata["celebrity_detection_confidence"] is defined %}
                {
                    "key": "metadata:rekognition:celebrity_detection_confidence",
                    "value": "{{metadata.celebrity_detection_confidence}}"
                },
                // {% endif %}
                // {% endif %}
                // {% if m.value.equals('face_detection') %}
                {
                    "key": "metadata:rekognition:{{m.key}}",
                    "value": "{{m.value}}"
                },
                {
                    "key": "metadata:rekognition:face_detection:status",
                    "value": "active"
                },
                // {% if metadata["face_detection_confidence"] is defined %}
                {
                    "key": "metadata:rekognition:face_detection_confidence",
                    "value": "{{metadata.face_detection_confidence}}"
                },
                // {% endif %}
                // {% endif %}
                // {% if m.value.equals('text_detection') %}
                {
                    "key": "metadata:rekognition:{{m.key}}",
                    "value": "{{m.value}}"
                },
                {
                    "key": "metadata:rekognition:text_detection:status",
                    "value": "active"
                },
                // {% if metadata["text_detection_confidence"] is defined %}
                {
                    "key": "metadata:rekognition:text_detection_confidence",
                    "value": "{{metadata.text_detection_confidence}}"
                }
                // {% endif %}
                // {% endif %}
                // {% endif %}
                // {% endfor %}
            ]
        },
        {
            "type": "REKOGNITION_MEDIA_ANALYSIS",
            "metadata": [
                {
                    "key": "run_next_on_failure",
                    "value": "true"
                },
                {
                    "key": "asset_id",
                    "value": "{{metadata.asset_id}}"
                },
                {
                    "key": "file_id",
                    "value": "{{metadata.file_id}}"
                },
                {
                    "key": "file_location_id",
                    "value": "{{metadata.file_location_id}}"
                },
                // {% for m in metadataList %}
                // {% if m.key.equals('rekognition_type') %}
                {
                    "key": "{{m.key}}",
                    "value": "{{m.value}}"
                },
                // {% endif %}
                // {% endfor %}
                // {% if metadata["technical_cue_confidence"] is defined %}
                {
                    "key": "technical_cue_confidence",
                    "value": "{{metadata.technical_cue_confidence}}"
                },
                // {% endif %}
                // {% if metadata["shot_confidence"] is defined %}
                {
                    "key": "shot_confidence",
                    "value": "{{metadata.shot_confidence}}"
                },
                // {% endif %}
                // {% if metadata["content_moderation_confidence"] is defined %}
                {
                    "key": "content_moderation_confidence",
                    "value": "{{metadata.content_moderation_confidence}}"
                },
                // {% endif %}
                // {% if metadata["label_detection_confidence"] is defined %}
                {
                    "key": "label_detection_confidence",
                    "value": "{{metadata.label_detection_confidence}}"
                },
                // {% endif %}
                // {% if metadata["celebrity_detection_confidence"] is defined %}
                {
                    "key": "celebrity_detection_confidence",
                    "value": "{{metadata.celebrity_detection_confidence}}"
                },
                // {% endif %}
                // {% if metadata["face_detection_confidence"] is defined %}
                {
                    "key": "face_detection_confidence",
                    "value": "{{metadata.face_detection_confidence}}"
                },
                // {% endif %}
                // {% if metadata["text_detection_confidence"] is defined %}
                {
                    "key": "text_detection_confidence",
                    "value": "{{metadata.text_detection_confidence}}"
                }
                // {% endif %}
            ]
        },
        {
            "type": "ASSET_METADATA_UPDATE",
            "metadata": [
                {
                    "key": "skip_if_previous_succeeded",
                    "value": "true"
                },
                {
                    "key": "asset_id",
                    "value": "{{metadata.asset_id}}"
                },
                {
                    "key": "metadata:aws_rekognition_status",
                    "value": "failed"
                },
                // {% for m in metadataList %}
                // {% if m.key.equals('rekognition_type') %}
                // {% if m.value.equals('shot') %}
                {
                    "key": "metadata:rekognition:shot:status",
                    "value": "failed"
                },
                // {% endif %}
                // {% if m.value.equals('technical_cue') %}
                {
                    "key": "metadata:rekognition:technical_cue:status",
                    "value": "failed"
                },
                // {% endif %}
                // {% if m.value.equals('content_moderation') %}
                {
                    "key": "metadata:rekognition:content_moderation:status",
                    "value": "failed"
                },
                // {% endif %}
                // {% if m.value.equals('label_detection') %}
                {
                    "key": "metadata:rekognition:label_detection:status",
                    "value": "failed"
                },
                // {% endif %}
                // {% if m.value.equals('celebrity_detection') %}
                {
                    "key": "metadata:rekognition:celebrity_detection:status",
                    "value": "failed"
                },
                // {% endif %}
                // {% if m.value.equals('face_detection') %}
                {
                    "key": "metadata:rekognition:face_detection:status",
                    "value": "failed"
                },
                // {% endif %}
                // {% if m.value.equals('text_detection') %}
                {
                    "key": "metadata:rekognition:text_detection:status",
                    "value": "failed"
                }
                // {% endif %}
                // {% endif %}
                // {% endfor %}
            ]
        },
        {
            "type": "ASSET_METADATA_UPDATE",
            "metadata": [
                {
                    "key": "asset_id",
                    "value": "{{metadata.asset_id}}"
                },
                {
                    "key": "metadata:aws_rekognition_status",
                    "value": "done"
                },
                {
                    "key": "metadata:aws_rekognition_job_id",
                    "value": "${rekognition_job_id}"
                },
                // {% for m in metadataList %}
                // {% if m.key.equals('rekognition_type') %}
                // {% if m.value.equals('shot') %}
                {
                    "key": "metadata:rekognition:shot:status",
                    "value": "done"
                },
                // {% endif %}
                // {% if m.value.equals('technical_cue') %}
                {
                    "key": "metadata:rekognition:technical_cue:status",
                    "value": "done"
                },
                // {% endif %}
                // {% if m.value.equals('content_moderation') %}
                {
                    "key": "metadata:rekognition:content_moderation:status",
                    "value": "done"
                },
                // {% endif %}
                // {% if m.value.equals('label_detection') %}
                {
                    "key": "metadata:rekognition:label_detection:status",
                    "value": "done"
                },
                // {% endif %}
                // {% if m.value.equals('celebrity_detection') %}
                {
                    "key": "metadata:rekognition:celebrity_detection:status",
                    "value": "done"
                },
                // {% endif %}
                // {% if m.value.equals('face_detection') %}
                {
                    "key": "metadata:rekognition:face_detection:status",
                    "value": "done"
                },
                // {% endif %}
                // {% if m.value.equals('text_detection') %}
                {
                    "key": "metadata:rekognition:text_detection:status",
                    "value": "done"
                }
                // {% endif %}
                // {% endif %}
                // {% endfor %}
            ]
        }
    ],
    "metadata": [
        // {% if metadata['cascade_fail_to_children'] is defined %}
        {
            "key": "cascade_fail_to_children",
            "value": "{{metadata.cascade_fail_to_children}}"
        },
        // {% endif %}
        // {% if metadata['cascade_abort_to_children'] is defined %}
        {
            "key": "cascade_abort_to_children",
            "value": "{{metadata.cascade_abort_to_children}}"
        },
        // {% endif %}
        // {% if metadata['propagate_fail_to_parent'] is defined %}
        {
            "key": "propagate_fail_to_parent",
            "value": "{{metadata.propagate_fail_to_parent}}"
        },
        // {% endif %}
        // {% if metadata['propagate_abort_to_parent'] is defined %}
        {
            "key": "propagate_abort_to_parent",
            "value": "{{metadata.propagate_abort_to_parent}}"
        }
        // {% endif %}
    ]
},

partials/subtitle_export.j2.json

{
    "type": "EXPORT",
    "actions": [
        {
            "type": "SUBTITLE_EXPORT",
            "metadata": [
                {
                    "key": "asset_id",
                    "value": "{{metadata.asset_id}}"
                },
                // {% if metadata["identifier"] is defined %}
                {
                    "key": "identifier",
                    "value": "{{metadata.identifier}}"
                },
                // {% endif %}
                // {% if metadata["language"] is defined %}
                {
                    "key": "language",
                    "value": "{{metadata.language}}"
                },
                // {% endif %}
                // {% if metadata["subtitle_type"] is defined %}
                {
                    "key": "subtitle_type",
                    "value": "{{metadata.subtitle_type}}"
                },
                // {% endif %}
                {
                    "key": "target_path",
                    "value": "{{uuid}}.{{metadata.export_suffix}}"
                },
                {
                    "key": "destination_format",
                    "value": "{{metadata.destination_format}}"
                }
            ]
        },
        {
            "type": "IMPORT_FILE",
            "metadata": [
                // {% if metadata["target_storage_id"] is defined %}
                {
                    "key": "target_storage_id",
                    "value": "{{metadata.target_storage_id}}"
                },
                // {% else %}
                {
                    "key": "target_storage_id",
                    "value": "{% storage_id_by_tag marker_export %}"
                },
                // {% endif %}
                {
                    "key": "source_path",
                    "value": "{{uuid}}.{{metadata.export_suffix}}"
                },
                {
                    "key": "target_path",
                    "value": "{{metadata.target_path}}"
                },
                {
                    "key": "target_uri_exist_policy",
                    "value": "increment"
                }
            ]
        },
        {
            "type": "RESULT",
            "metadata": [
                {
                    "key": "result:destination_file_id",
                    "value": "${target_file_id}"
                }
            ]
        }
    ]
},

partials/subtitle_ingest.j2.json

    {
        "type": "SUBTITLE_IMPORT",
        "metadata": [
            {
                "key": "asset_id",
                "value": "{{metadata.target_asset_id}}"
            },
            {
                "key": "source_path",
                "value": "{{file.url}}"
            },
            {
                "key": "storage_id",
                "value": "{{file.storageId}}"
            },
            {
                "key": "storage_path",
                "value": "{{file.fileName}}"
            },
            {
                "key": "original_file_type",
                "value": "{{file.type}}"
            },
            {
                "key": "analyze:container_format",
                "value": "{{file.container.format}}"
            },
            // {% if file.getOptionalMetadataValue('identifier').isPresent() %}
            {
                "key": "identifier",
                "value": "{{file.getMetadataValue('identifier')}}"
            },
            // {% else %}
            {
                "key": "identifier",
                "value": "{{file.fileName}}"
            },
            // {% endif %}
            // {% if file.getOptionalMetadataValue('subtitle_type').isPresent() %}
            {
                "key": "subtitle_type",
                "value": "{{file.getMetadataValue('subtitle_type')}}"
            },
            // {% endif %}
            // {% if file.getOptionalMetadataValue('language').isPresent() %}
            {
                "key": "language",
                "value": "{{file.getMetadataValue('language')}}"
            },
            // {% endif %}
        ]
    },

partials/video_ingest.j2.json

    {
        "type": "EXPORT_FILE",
        "metadata": [
            {
                "key": "source_file_id",
                "value": "{{file.id}}"
            },
            {
                "key": "target_path",
                "value": "v-{{file.fileName}}"
            },
            {
                "key": "target_path_export",
                "value": "v-{{file.fileName}}"
            }
        ]
    },
    {
        "type": "POSTER",
        "metadata": [
            {
                "key": "original_file_type",
                "value": "{{file.type}}"
            },
            {
                "key": "source_path",
                "value": "${target_path_export}"
            },
            {
                "key": "target_path_poster",
                "value": "poster_{{file.id}}_{{uuid}}.jpg"
            }
        ]
    },
    {
        "type": "IMPORT_FILE",
        "metadata": [
            {
                "key": "source_path",
                "value": "${target_path_poster}"
            },
            {
                "key": "skip_if_previous_skipped",
                "value": "true"
            },
            {
                "key": "target_path",
                "value": "posters/${target_path_poster}"
            },
            {
                "key": "target_storage_id",
                "value": "{% storage_id_by_tag poster %}"
            },
            {
                "key": "file_metadata:still_frame:type",
                "value": "poster"
            },
            {
                "key": "file_metadata:ap:legacy:resolution",
                "value": "${poster:resolution}"
            },
            {
                "key": "file_metadata:still_frame:timestamp",
                "value": "${poster:timestamp}"
            },
            {
                "key": "file_metadata:original_file_id",
                "value": "{{file.id}}"
            },
            {
                "key": "target_path_exist_policy",
                "value": "overwrite"
            }
        ]
    },
    {
        "type": "ATTACH_FILE",
        "metadata": [
            {
                "key": "file_id",
                "value": "${target_file_id}"
            },
            {
                "key": "asset_id",
                "value": "{{metadata.target_asset_id}}"
            },
            {
                "key": "skip_if_previous_skipped",
                "value": "true"
            }
        ]
    },
    {
        "type": "SPRITE_MAP",
        "metadata": [
            {
                "key": "original_file_type",
                "value": "{{file.type}}"
            },
            {
                "key": "source_path",
                "value": "${target_path_export}"
            },
            {
                "key": "interval_count",
                "value": "50"
            },
            {
                "key": "interval_seconds",
                "value": "10"
            },
            {
                "key": "target_path_spritemap",
                "value": "spritemap_{{file.id}}_{{uuid}}.jpg"
            }
        ]
    },
    {
        "type": "IMPORT_FILE",
        "metadata": [
            {
                "key": "source_path",
                "value": "${target_path_spritemap}"
            },
            {
                "key": "skip_if_previous_skipped",
                "value": "true"
            },
            {
                "key": "target_path",
                "value": "spritemaps/${target_path_spritemap}"
            },
            {
                "key": "target_storage_id",
                "value": "{% storage_id_by_tag sprite_map %}"
            },
            {
                "key": "file_metadata_file:sprite_map",
                "value": "${target_path_manifest}"
            },
            {
                "key": "file_metadata:original_file_id",
                "value": "{{file.id}}"
            },
            {
                "key": "file_type",
                "value": "SPRITE_MAP"
            },
            {
                "key": "target_path_exist_policy",
                "value": "overwrite"
            }
        ]
    },
    {
        "type": "ATTACH_FILE",
        "metadata": [
            {
                "key": "file_id",
                "value": "${target_file_id}"
            },
            {
                "key": "asset_id",
                "value": "{{metadata.target_asset_id}}"
            },
            {
                "key": "skip_if_previous_skipped",
                "value": "true"
            }
        ]
    },
    // {% if metadata.run_rekognition eq 'true' %}
    {% include 'partials/rekognition_allow_fail.j2.json' %}
    // {% endif %}

    {% include 'partials/waveform.j2.json' %}

partials/waveform.j2.json

    // {% if file.container and file.container.audioStreams %}
    {
        "type": "WAVEFORM",
        "metadata": [
            {
                "key": "source_path",
                "value": "${target_path_export}"
            },
            {
                "key": "target_path_prefix",
                "value": "waveform_{{ file.id }}_{{ uuid }}"
            },
            {
                "key": "tracks",
                "value": "{{file.container.audioStreams.size()}}"
            },
            {
                "key": "sample_rate_modifier",
                "value": "2"
            },
            {
                "key": "sample_rate_modifier",
                "value": "32"
            },
            {
                "key": "sample_rate_modifier",
                "value": "500"
            },
            // {% for stream in file.container.audioStreams %}
            // {% set track = loop.index - 1 %}
            {
                "key": "channels.{{track}}",
                "value": "{{stream.channels}}"
            },
            // {% endfor %}
        ]
    },
    // {% for stream in file.container.audioStreams %}
    // {% set track = loop.index - 1 %}
    // {% for ar in [2, 32, 500] %}
    {
        "type": "IMPORT_FILE",
        "metadata": [
            {
                "key": "source_path",
                "value": "${waveform_file.{{track}}.{{ar}}}.gz"
            },
            {
                "key": "target_path",
                "value": "waveforms/${waveform_file.{{track}}.{{ar}}}.gz"
            },
            {
                "key": "target_storage_id",
                "value": "{% storage_id_by_tag waveform %}"
            },
            {
                "key": "content_encoding",
                "value": "gzip"
            },
            {
                "key": "file_metadata:waveform:ar",
                "value": "{{ ar }}"
            },
            {
                "key": "file_metadata:waveform:source_file_id",
                "value": "{{ file.id }}"
            },
            {
                "key": "file_metadata:waveform:track",
                "value": "{{ track }}"
            },
            {
                "key": "file_metadata:waveform:channels",
                "value": "{{ stream.channels }}"
            },
            {
                "key": "file_metadata:original_file_id",
                "value": "{{ file.id }}"
            },
            {
                "key": "file_type",
                "value": "WAVEFORM"
            },
            {
                "key": "target_path_exist_policy",
                "value": "overwrite"
            }
        ]
    },
    {
        "type": "ATTACH_FILE",
        "metadata": [
            {
                "key": "file_id",
                "value": "${target_file_id}"
            },
            {
                "key": "asset_id",
                "value": "{{metadata.target_asset_id}}"
            },
            {
                "key": "skip_if_previous_skipped",
                "value": "true"
            }
        ]
    },
    // {% endfor %}
    // {% endfor %}
    // {% endif %}

partials/waveform_old.j2.json

{% if file.container and file.container.audioStreams %}
  {% for stream in file.container.audioStreams %}
    {% set track = loop.index - 1 %}

    {
      "type": "SHELL",
      "metadata": [
        { "key": "target_path_pcm0", "value": "{{ file.fileName }}_{{ track }}.pcm" },
        { "key": "command", "value": "ffmpeg" },
        { "key": "command", "value": "-hide_banner" },
        { "key": "command", "value": "-loglevel" },
        { "key": "command", "value": "warning" },
        { "key": "command", "value": "-n" },
        { "key": "command", "value": "-i" },
        { "key": "command", "value": "${target_path_export}" },
        { "key": "command", "value": "-vn" },
        { "key": "command", "value": "-map" },
        { "key": "command", "value": "0:a:{{ track }}" },
        { "key": "command", "value": "-c:a" },
        { "key": "command", "value": "pcm_s8" },
        { "key": "command", "value": "-ar" },
        { "key": "command", "value": "32000" },
        { "key": "command", "value": "-f" },
        { "key": "command", "value": "s8" },
        { "key": "command", "value": "${target_path_pcm0}" }
      ]
    },

    {% for ar in [2, 32, 500] %}
      {
        "type": "SHELL",
        "metadata": [
          { "key": "target_path_pcm", "value": "{{ file.fileName }}_{{ track }}_{{ ar }}.pcm" },
          { "key": "command", "value": "${av.runner.bindir}/subsample" },
          { "key": "command", "value": "${target_path_pcm0}" },
          { "key": "command", "value": "{{ stream.channels }}" },
          { "key": "command", "value": "{{ 32000 / ar }}" },
          { "key": "command", "value": "${target_path_pcm}" }
        ]
      },
      {
        "type": "SHELL",
        "metadata": [
          { "key": "command", "value": "gzip" },
          { "key": "command", "value": "-8" },
          { "key": "command", "value": "${target_path_pcm}" }
        ]
      },
      {
        "type": "IMPORT_FILE",
        "metadata": [
          {
            "key": "source_path",
            "value": "${target_path_pcm}.gz"
          },
          {
            "key": "target_path",
            "value": "waveforms/${target_path_pcm}"
          },
          {
            "key": "target_storage_id",
            "value": "{% storage_id_by_tag waveform %}"
          },
          {
            "key": "content_encoding",
            "value": "gzip"
          },
          {
            "key": "file_metadata:waveform:ar",
            "value": "{{ ar }}"
          },
          {
            "key": "file_metadata:waveform:source_file_id",
            "value": "{{ file.id }}"
          },
          {
            "key": "file_metadata:waveform:track",
            "value": "{{ track }}"
          },
          {
            "key": "file_metadata:waveform:channels",
            "value": "{{ stream.channels }}"
          },
          {
            "key": "file_type",
            "value": "WAVEFORM"
          },
          {
            "key": "target_path_exist_policy",
            "value": "overwrite"
          }
        ]
      },

      {
        "type": "ATTACH_FILE",
        "metadata": [
          {
            "key": "file_id",
            "value": "${target_file_id}"
          },
          {
            "key": "asset_id",
            "value": "{{metadata.target_asset_id}}"
          },
          {
            "key": "skip_if_previous_skipped",
            "value": "true"
          }
        ]
      },

    {% endfor %}
  {% endfor %}
{% endif %}