packaging-shaka_package_mpegts

{
    "tags": [
        "itest",
        "packaging",
        "shaka_package_mpegts"
    ],
    "region": "aws:eu-west-1",
    "tasks": [
        {
            "tool": "utils:env",
            "parameters": {
                "mp4_h264_vid1000k": "h264_files/video_640x360_1000k.mp4",
                "mp4_h264_vid1500k": "h264_files/video_960x540_1500k.mp4",
                "mp4_h264_vid2000k": "h264_files/video_1280x720_2000k.mp4",
                "mp4_aac_audio_128k_eng": "aac_files/audio_eng_128k.mp4",
                "mp4_aac_audio_128k_ita": "aac_files/audio_ita_128k.mp4",
                "output_folder": "output"
            }
        },
        {
            "tool": "storage:get",
            "parameters": {
                "location": "s3://{com-castlabs-vtk-test-access-keys}@com.castlabs.vtk.test/IN/3min",
                "files": [
                    "h264_files/*",
                    "aac_files/*"
                ]
            }
        },
        {
            "tool": "drmtoday:ingest-cenc-key",
            "parameters": {
                "key_id": "{randomuuid}",
                "key_seed_id": "ff583d63-21dd-4500-a0d4-26b503d2098a",
                "environment": "STAGING",
                "asset_id": "vtk_integration_test_{job_id}",
                "stream_type": "SD",
                "user": "test::vtktest",
                "password": "{test--vtktest-password}",
                "env_prefix": "sd"
            }
        },
        {
            "tool": "drmtoday:ingest-cenc-key",
            "parameters": {
                "key_id": "{randomuuid}",
                "key_seed_id": "ff583d63-21dd-4500-a0d4-26b503d2098a",
                "environment": "STAGING",
                "asset_id": "vtk_integration_test_{job_id}",
                "stream_type": "HD",
                "user": "test::vtktest",
                "password": "{test--vtktest-password}",
                "env_prefix": "hd",
                "iv": "{sd_iv_hex}"
            }
        },
        {
            "tool": "drmtoday:ingest-cenc-key",
            "parameters": {
                "key_id": "{randomuuid}",
                "key_seed_id": "ff583d63-21dd-4500-a0d4-26b503d2098a",
                "environment": "STAGING",
                "asset_id": "vtk_integration_test_{job_id}",
                "stream_type": "AUDIO",
                "user": "test::vtktest",
                "password": "{test--vtktest-password}",
                "env_prefix": "audio",
                "iv": "{sd_iv_hex}"
            }
        },
        {
            "tool": "shaka:package_mpegts",
            "parameters": {
                "inputs": [
                    {
                        "input_file": "{mp4_h264_vid1000k}",
                        "stream_id": "video",
                        "key_select": "sd_key",
                        "iframe_playlist_name": "video_01_iframe.m3u8",
                        "segment_template": "video_01/$Number$.ts",
                        "playlist_name": "video_01.m3u8",
                        "hls_name": "video_01"
                    },
                    {
                        "input_file": "{mp4_h264_vid1500k}",
                        "stream_id": "video",
                        "key_select": "sd_key",
                        "iframe_playlist_name": "video_02_iframe.m3u8",
                        "segment_template": "video_02/$Number$.ts",
                        "playlist_name": "video_02.m3u8",
                        "hls_name": "video_02"
                    },
                    {
                        "input_file": "{mp4_h264_vid2000k}",
                        "stream_id": "video",
                        "key_select": "hd_key",
                        "iframe_playlist_name": "video_03_iframe.m3u8",
                        "segment_template": "video_03/$Number$.ts",
                        "playlist_name": "video_03.m3u8",
                        "hls_name": "video_03"
                    },
                    {
                        "input_file": "{mp4_aac_audio_128k_eng}",
                        "stream_id": "audio",
                        "key_select": "audio_key",
                        "language": "en-US",
                        "segment_template": "audio_01/$Number$.ts",
                        "playlist_name": "audio_01.m3u8",
                        "hls_group_id": "English",
                        "hls_name": "audio_01"
                    },
                    {
                        "input_file": "{mp4_aac_audio_128k_ita}",
                        "stream_id": "audio",
                        "key_select": "audio_key",
                        "language": "it-IT",
                        "segment_template": "audio_02/$Number$.ts",
                        "playlist_name": "audio_02.m3u8",
                        "hls_group_id": "Italian",
                        "hls_name": "audio_02"
                    }
                ],
                "default_language": "en-US",
                "fragment_duration": "6",
                "segment_duration": "6",
                "output_dir": "{output_folder}",
                "protection_scheme": "cbcs",
                "enable_raw_key_encryption": "True",
                "hls_master_playlist_output": "master.m3u8",
                "protection_systems": [
                    "FairPlay"
                ],
                "iv": "{sd_iv_hex}",
                "drmkeys": [
                    {
                        "key_label": "sd_key",
                        "key_streamtype": "SD",
                        "key": "{sd_hex}",
                        "key_id": "{sd_id_hex}",
                        "key_iv": "{sd_iv_hex}"
                    },
                    {
                        "key_label": "hd_key",
                        "key_streamtype": "HD",
                        "key": "{hd_hex}",
                        "key_id": "{hd_id_hex}",
                        "key_iv": "{hd_iv_hex}"
                    },
                    {
                        "key_label": "audio_key",
                        "key_streamtype": "AUDIO",
                        "key": "{audio_hex}",
                        "key_id": "{audio_id_hex}",
                        "key_iv": "{audio_iv_hex}"
                    }
                ]
            }
        },
        {
            "tool": "m3u8_edit:add_session_key",
            "parameters": {
                "input_master_playlist": "{output_folder}/master.m3u8",
                "input_media_playlists": [
                    "{output_folder}/video_01.m3u8",
                    "{output_folder}/video_02.m3u8",
                    "{output_folder}/video_03.m3u8",
                    "{output_folder}/audio_01.m3u8",
                    "{output_folder}/audio_02.m3u8"
                ]
            }
        },
        {
            "tool": "storage:put",
            "parameters": {
                "location": "s3://{com-castlabs-vtk-test-access-keys}@com.castlabs.vtk.test/OUT/packaging-shaka_package_hls_{job_id}",
                "files": [
                    "{output_folder}/*"
                ]
            }
        }
    ]
}