@aws-cdk/aws-medialive-alpha 2.268.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/.jsii +60888 -0
  2. package/.jsii.tabl.json.gz +0 -0
  3. package/.warnings.jsii.js +524 -0
  4. package/LICENSE +201 -0
  5. package/NOTICE +2 -0
  6. package/README.md +1297 -0
  7. package/grants.json +27 -0
  8. package/lib/audio-codec-settings.d.ts +901 -0
  9. package/lib/audio-codec-settings.js +1098 -0
  10. package/lib/audio-selector.d.ts +170 -0
  11. package/lib/audio-selector.js +306 -0
  12. package/lib/avail-settings.d.ts +231 -0
  13. package/lib/avail-settings.js +226 -0
  14. package/lib/caption-selector.d.ts +234 -0
  15. package/lib/caption-selector.js +413 -0
  16. package/lib/caption-settings.d.ts +349 -0
  17. package/lib/caption-settings.js +482 -0
  18. package/lib/channel-features.d.ts +106 -0
  19. package/lib/channel-features.js +85 -0
  20. package/lib/channel-placement-group.d.ts +73 -0
  21. package/lib/channel-placement-group.js +132 -0
  22. package/lib/channel.d.ts +687 -0
  23. package/lib/channel.js +1096 -0
  24. package/lib/cluster.d.ts +129 -0
  25. package/lib/cluster.js +158 -0
  26. package/lib/color-correction.d.ts +39 -0
  27. package/lib/color-correction.js +29 -0
  28. package/lib/destinations.d.ts +242 -0
  29. package/lib/destinations.js +455 -0
  30. package/lib/encode-configuration.d.ts +615 -0
  31. package/lib/encode-configuration.js +629 -0
  32. package/lib/enums.d.ts +698 -0
  33. package/lib/enums.js +1045 -0
  34. package/lib/file-location.d.ts +65 -0
  35. package/lib/file-location.js +150 -0
  36. package/lib/framerate.d.ts +31 -0
  37. package/lib/framerate.js +71 -0
  38. package/lib/index.d.ts +26 -0
  39. package/lib/index.js +43 -0
  40. package/lib/input-attachment.d.ts +319 -0
  41. package/lib/input-attachment.js +228 -0
  42. package/lib/input-security-group.d.ts +51 -0
  43. package/lib/input-security-group.js +123 -0
  44. package/lib/input-specification.d.ts +111 -0
  45. package/lib/input-specification.js +181 -0
  46. package/lib/input.d.ts +505 -0
  47. package/lib/input.js +803 -0
  48. package/lib/m2ts-settings.d.ts +421 -0
  49. package/lib/m2ts-settings.js +469 -0
  50. package/lib/m3u8-settings.d.ts +272 -0
  51. package/lib/m3u8-settings.js +304 -0
  52. package/lib/medialive-grants.generated.d.ts +30 -0
  53. package/lib/medialive-grants.generated.js +92 -0
  54. package/lib/network.d.ts +83 -0
  55. package/lib/network.js +132 -0
  56. package/lib/output-group.d.ts +924 -0
  57. package/lib/output-group.js +941 -0
  58. package/lib/outputs.d.ts +304 -0
  59. package/lib/outputs.js +598 -0
  60. package/lib/sdi-source.d.ts +124 -0
  61. package/lib/sdi-source.js +180 -0
  62. package/lib/shared.d.ts +44 -0
  63. package/lib/shared.js +146 -0
  64. package/lib/video-codec-settings.d.ts +1500 -0
  65. package/lib/video-codec-settings.js +1722 -0
  66. package/lib/video-selection.d.ts +92 -0
  67. package/lib/video-selection.js +95 -0
  68. package/package.json +135 -0
  69. package/rosetta/_generated.ts-fixture +6 -0
  70. package/rosetta/default.ts-fixture +21 -0
package/README.md ADDED
@@ -0,0 +1,1297 @@
1
+ # AWS::MediaLive Construct Library
2
+ <!--BEGIN STABILITY BANNER-->
3
+
4
+ ---
5
+
6
+ ![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge)
7
+
8
+ > The APIs of higher level constructs in this module are experimental and under active development.
9
+ > They are subject to non-backward compatible changes or removal in any future version. These are
10
+ > not subject to the [Semantic Versioning](https://semver.org/) model and breaking changes will be
11
+ > announced in the release notes. This means that while you may use them, you may need to update
12
+ > your source code when upgrading to a newer version of this package.
13
+
14
+ ---
15
+
16
+ <!--END STABILITY BANNER-->
17
+
18
+ ## AWS Elemental MediaLive
19
+
20
+ AWS Elemental MediaLive is a real-time video service that lets you create live outputs for broadcast and streaming delivery.
21
+
22
+ This package contains constructs for working with AWS Elemental MediaLive, including Inputs, Input Security Groups, Channels, and MediaLive Anywhere resources (Networks, Clusters, Channel Placement Groups, SDI Sources).
23
+
24
+ For further information on AWS Elemental MediaLive, see [the documentation](https://docs.aws.amazon.com/medialive/latest/ug/what-is.html). See [supported codecs per output group](https://docs.aws.amazon.com/medialive/latest/ug/outputs-supported-codecs.html).
25
+
26
+ The following example creates an SRT caller input, encodes it to H.264 + AAC, and outputs HLS segments to an S3 bucket:
27
+
28
+ ```ts
29
+ declare const stack: Stack;
30
+ declare const bucket: s3.IBucket;
31
+
32
+ const input = new medialive.Input(stack, 'SrtInput', {
33
+ inputName: 'my-srt-input',
34
+ input: medialive.InputConfiguration.srtCaller([{
35
+ srtListenerAddress: '203.0.113.10',
36
+ srtListenerPort: 5000,
37
+ }]),
38
+ });
39
+
40
+ const video = medialive.EncodeConfiguration.video({
41
+ name: 'video_720p',
42
+ codec: medialive.VideoCodecSettings.h264({
43
+ rateControl: medialive.H264RateControl.cbr({ bitrate: Bitrate.mbps(3) }),
44
+ framerate: medialive.Framerate.FPS_30,
45
+ }),
46
+ width: 1280,
47
+ height: 720,
48
+ });
49
+
50
+ const audio = medialive.EncodeConfiguration.audio({
51
+ name: 'audio_aac',
52
+ codec: medialive.AudioCodecSettings.aac({ bitrate: Bitrate.kbps(192) }),
53
+ });
54
+
55
+ new medialive.Channel(stack, 'Channel', {
56
+ inputs: [{ input }],
57
+ outputGroups: [
58
+ medialive.OutputGroupConfiguration.hls({
59
+ name: 'hls',
60
+ destinations: [medialive.OutputDestination.toBucket(bucket, 'live/stream')],
61
+ outputs: [{ encodes: [video, audio], outputName: 'hls_out' }],
62
+ }),
63
+ ],
64
+ });
65
+ ```
66
+
67
+ ## Input
68
+
69
+ An input represents the upstream source that feeds a MediaLive channel. Use `InputConfiguration` factory methods to create different input types.
70
+
71
+ ### SRT Caller
72
+
73
+ MediaLive connects to a remote SRT listener:
74
+
75
+ ```ts
76
+ declare const stack: Stack;
77
+ new medialive.Input(stack, 'SrtInput', {
78
+ inputName: 'srt-caller',
79
+ input: medialive.InputConfiguration.srtCaller([{
80
+ srtListenerAddress: '203.0.113.10',
81
+ srtListenerPort: 5000,
82
+ }]),
83
+ });
84
+ ```
85
+
86
+ ### SRT Listener
87
+
88
+ MediaLive listens for an incoming SRT connection. SRT listener inputs require an input security
89
+ group. To receive encrypted content, supply a `decryption` block referencing a Secrets Manager
90
+ secret that holds the passphrase — the secret is passed by reference, so MediaLive resolves the ARN
91
+ at synth time:
92
+
93
+ ```ts
94
+ declare const stack: Stack;
95
+ declare const passphrase: secretsmanager.ISecret;
96
+
97
+ const sg = new medialive.InputSecurityGroup(stack, 'SrtSg', {
98
+ allowlistRules: ['203.0.113.0/24'],
99
+ });
100
+
101
+ new medialive.Input(stack, 'SrtListenerInput', {
102
+ inputName: 'srt-listener',
103
+ input: medialive.InputConfiguration.srtListener({
104
+ inputSecurityGroups: [sg],
105
+ minimumLatency: Duration.millis(500),
106
+ streamId: 'my-stream-id',
107
+ decryption: {
108
+ algorithm: medialive.SrtDecryptionAlgorithm.AES256,
109
+ passphraseSecret: passphrase,
110
+ },
111
+ }),
112
+ });
113
+ ```
114
+
115
+ ### AWS Elemental MediaConnect Router
116
+
117
+ Creates a MediaConnect Router Input with automatic encryption:
118
+
119
+ ```ts
120
+ declare const stack: Stack;
121
+ new medialive.Input(stack, 'RouterInput', {
122
+ inputName: 'mc-router',
123
+ input: medialive.InputConfiguration.mediaConnectRouter(),
124
+ });
125
+ ```
126
+
127
+ An input created this way is the only kind `@aws-cdk/aws-mediaconnect-alpha`'s `RouterOutputConfiguration.mediaLiveInput()` can deliver to — pointing it at any other input type synths but fails at deploy.
128
+
129
+ ### MP4 File from S3
130
+
131
+ Use `InputSource.fromBucket()` to reference an S3 object:
132
+
133
+ ```ts
134
+ declare const stack: Stack;
135
+ declare const bucket: s3.IBucket;
136
+
137
+ new medialive.Input(stack, 'FileInput', {
138
+ inputName: 'mp4-file',
139
+ input: medialive.InputConfiguration.mp4File([
140
+ medialive.InputSource.fromBucket(bucket, 'media/input.mp4'),
141
+ ]),
142
+ });
143
+ ```
144
+
145
+ ### Importing an Existing Input
146
+
147
+ ```ts
148
+ declare const stack: Stack;
149
+ const input = medialive.Input.fromInputArn(stack, 'Imported',
150
+ 'arn:aws:medialive:us-east-1:123456789012:input:1234567');
151
+ ```
152
+
153
+ ## Input Security Group
154
+
155
+ An input security group controls which IPv4 CIDR blocks can push content to a push-type input.
156
+
157
+ ```ts
158
+ declare const stack: Stack;
159
+ const sg = new medialive.InputSecurityGroup(stack, 'SG', {
160
+ allowlistRules: ['203.0.113.0/24'],
161
+ });
162
+ ```
163
+
164
+ ### Importing an Existing Input Security Group
165
+
166
+ ```ts
167
+ declare const stack: Stack;
168
+ const sg = medialive.InputSecurityGroup.fromInputSecurityGroupArn(stack, 'Imported',
169
+ 'arn:aws:medialive:us-east-1:123456789012:inputSecurityGroup:1234567');
170
+ ```
171
+
172
+ ## Channel
173
+
174
+ A channel takes one or more inputs, encodes them, and produces output groups. If no `role` is provided, the channel auto-creates an IAM role with the `medialive.amazonaws.com` service principal.
175
+
176
+ Minimal example — single input, single HLS output:
177
+
178
+ ```ts
179
+ declare const stack: Stack;
180
+ declare const input: medialive.IInput;
181
+ declare const bucket: s3.IBucket;
182
+
183
+ const video = medialive.EncodeConfiguration.video({
184
+ name: 'video_720p',
185
+ codec: medialive.VideoCodecSettings.h264({
186
+ rateControl: medialive.H264RateControl.cbr({ bitrate: Bitrate.mbps(3) }),
187
+ framerate: medialive.Framerate.FPS_30,
188
+ }),
189
+ width: 1280,
190
+ height: 720,
191
+ });
192
+
193
+ const audio = medialive.EncodeConfiguration.audio({
194
+ name: 'audio_aac',
195
+ codec: medialive.AudioCodecSettings.aac({ bitrate: Bitrate.kbps(192) }),
196
+ });
197
+
198
+ new medialive.Channel(stack, 'Channel', {
199
+ inputs: [{ input }],
200
+ outputGroups: [
201
+ medialive.OutputGroupConfiguration.hls({
202
+ name: 'hls',
203
+ destinations: [medialive.OutputDestination.toBucket(bucket, 'live/stream')],
204
+ outputs: [{ encodes: [video, audio], outputName: 'hls_out' }],
205
+ }),
206
+ ],
207
+ });
208
+ ```
209
+
210
+ ### STANDARD Channel with MediaPackage V2
211
+
212
+ A STANDARD channel runs two pipelines for redundancy. Each output group needs two destinations — one per pipeline.
213
+
214
+ ```ts
215
+ declare const stack: Stack;
216
+ declare const input: medialive.IInput;
217
+ declare const mpChannel: mediapackagev2.IChannel;
218
+
219
+ const hdVideo = medialive.EncodeConfiguration.video({
220
+ name: 'video_1080p',
221
+ codec: medialive.VideoCodecSettings.h265({
222
+ rateControl: medialive.H265RateControl.qvbr({
223
+ maxBitrate: Bitrate.mbps(8),
224
+ qvbrQualityLevel: 7,
225
+ }),
226
+ framerate: medialive.Framerate.FPS_30,
227
+ }),
228
+ width: 1920,
229
+ height: 1080,
230
+ });
231
+
232
+ const sdVideo = medialive.EncodeConfiguration.video({
233
+ name: 'video_480p',
234
+ codec: medialive.VideoCodecSettings.h265({
235
+ rateControl: medialive.H265RateControl.qvbr({
236
+ maxBitrate: Bitrate.mbps(2),
237
+ qvbrQualityLevel: 7,
238
+ }),
239
+ framerate: medialive.Framerate.FPS_30,
240
+ }),
241
+ width: 854,
242
+ height: 480,
243
+ });
244
+
245
+ const audio = medialive.EncodeConfiguration.audio({
246
+ name: 'audio_aac',
247
+ codec: medialive.AudioCodecSettings.aac({ bitrate: Bitrate.kbps(192) }),
248
+ });
249
+
250
+ new medialive.Channel(stack, 'Channel', {
251
+ channelClass: medialive.ChannelClass.STANDARD,
252
+ inputs: [{ input }],
253
+ outputGroups: [
254
+ medialive.OutputGroupConfiguration.mediaPackageV2({
255
+ name: 'emp',
256
+ channel: mpChannel,
257
+ outputs: [
258
+ { encode: hdVideo, outputName: 'hd' },
259
+ { encode: sdVideo, outputName: 'sd' },
260
+ { encode: audio, outputName: 'audio' },
261
+ ],
262
+ }),
263
+ ],
264
+ });
265
+ ```
266
+
267
+ ### Global Configuration
268
+
269
+ `globalConfiguration` sets channel-wide behaviour: how the pipelines are locked together and the output timing source. All fields are optional and fall back to MediaLive defaults.
270
+
271
+ ```ts
272
+ declare const stack: Stack;
273
+ declare const input: medialive.IInput;
274
+ declare const bucket: s3.IBucket;
275
+ declare const video: medialive.EncodeConfiguration;
276
+ declare const audio: medialive.EncodeConfiguration;
277
+
278
+ new medialive.Channel(stack, 'Channel', {
279
+ inputs: [{ input }],
280
+ timecodeConfig: {
281
+ source: medialive.TimecodeSource.EMBEDDED,
282
+ },
283
+ globalConfiguration: {
284
+ outputLocking: medialive.OutputLocking.epoch(),
285
+ outputTimingSource: medialive.OutputTimingSource.INPUT_CLOCK,
286
+ },
287
+ outputGroups: [
288
+ medialive.OutputGroupConfiguration.hls({
289
+ name: 'hls',
290
+ destinations: [medialive.OutputDestination.toBucket(bucket, 'live/stream')],
291
+ outputs: [{ encodes: [video, audio], outputName: 'hls_out' }],
292
+ }),
293
+ ],
294
+ });
295
+ ```
296
+
297
+ #### Output locking
298
+
299
+ `outputLocking` synchronises the frames emitted by a channel's two pipelines. Pick a strategy with
300
+ the `OutputLocking` factory:
301
+
302
+ - `OutputLocking.pipeline()` — synchronise each pipeline's output to the other. Choose how with
303
+ `method`: `PipelineLockingMethod.SOURCE_TIMECODE` (default, needs reliable embedded timecodes) or
304
+ `PipelineLockingMethod.VIDEO_ALIGNMENT` (visual content matching, no timecodes required).
305
+ - `OutputLocking.epoch()` — synchronise to the Unix epoch (optionally a `customEpoch`/`jamSyncTime`).
306
+ Requires `outputTimingSource: OutputTimingSource.INPUT_CLOCK` (enforced at synth).
307
+ - `OutputLocking.disabled()` — no synchronisation.
308
+
309
+ ```ts
310
+ // Video-aligned pipeline locking — useful when sources lack reliable timecodes
311
+ const locking = medialive.OutputLocking.pipeline({
312
+ method: medialive.PipelineLockingMethod.VIDEO_ALIGNMENT,
313
+ });
314
+ ```
315
+
316
+ #### Input-loss behavior
317
+
318
+ `inputLossBehavior` controls what MediaLive emits when the input is lost: a black period, then a
319
+ repeated frame, then either a solid colour or a slate image. Provide the slate as a
320
+ [`FileLocation`](#file-locations).
321
+
322
+ ```ts
323
+ declare const slateBucket: s3.IBucket;
324
+
325
+ const inputLoss: medialive.InputLossBehavior = {
326
+ blackFrame: Duration.seconds(1),
327
+ repeatFrame: Duration.seconds(5),
328
+ imageType: medialive.InputLossImageType.SLATE,
329
+ imageSlate: medialive.FileLocation.fromBucket(slateBucket, 'slates/offline.png'),
330
+ };
331
+ ```
332
+
333
+ ## File locations
334
+
335
+ Several channel features reference a file MediaLive reads at runtime — an input-loss slate, an
336
+ avail-blanking image, a blackout-slate image, or a burn-in caption font. These all take a
337
+ `FileLocation`, created from an S3 bucket (which auto-grants the channel role read access) or a URL
338
+ (with optional SSM-backed credentials):
339
+
340
+ ```ts
341
+ import { StringParameter } from 'aws-cdk-lib/aws-ssm';
342
+
343
+ declare const bucket: s3.IBucket;
344
+ declare const passwordParam: StringParameter;
345
+
346
+ // From an S3 bucket — the channel role is granted read access automatically
347
+ const fromS3 = medialive.FileLocation.fromBucket(bucket, 'assets/slate.png');
348
+
349
+ // From a URL with optional credentials (SSM parameter read access auto-granted)
350
+ const fromUrl = medialive.FileLocation.url('https://origin.example.com/font.ttf', {
351
+ username: 'ingest-user',
352
+ password: passwordParam,
353
+ });
354
+ ```
355
+
356
+ ## Color correction
357
+
358
+ A channel can apply one or more color-space conversions to its video, optionally using a 3D LUT
359
+ to remap colors. Each `ColorCorrection` declares the `inputColorSpace` to match and the
360
+ `outputColorSpace` to convert to. MediaLive reads the LUT from S3 at runtime, so it must be an S3
361
+ location — provide it via `Lut.fromBucket()` (which uses the secure `s3ssl://` form and auto-grants
362
+ the channel role read access) or `Lut.url()` with an `s3://`/`s3ssl://` URL:
363
+
364
+ ```ts
365
+ declare const stack: Stack;
366
+ declare const bucket: s3.IBucket;
367
+ declare const input: medialive.IInput;
368
+ declare const video: medialive.EncodeConfiguration;
369
+ declare const destination: medialive.OutputDestination;
370
+
371
+ new medialive.Channel(stack, 'Channel', {
372
+ inputs: [{ input }],
373
+ colorCorrections: [{
374
+ inputColorSpace: medialive.ColorSpace.REC_601,
375
+ outputColorSpace: medialive.ColorSpace.REC_709,
376
+ lut: medialive.Lut.fromBucket(bucket, 'luts/rec601-to-rec709.cube'),
377
+ }],
378
+ outputGroups: [
379
+ medialive.OutputGroupConfiguration.hls({
380
+ name: 'hls',
381
+ destinations: [destination],
382
+ outputs: [{ encodes: [video], outputName: 'video' }],
383
+ }),
384
+ ],
385
+ });
386
+ ```
387
+
388
+ ## Encode Configuration
389
+
390
+ Use `EncodeConfiguration.video()`, `EncodeConfiguration.audio()`, and `EncodeConfiguration.caption()` to define encodes.
391
+
392
+ ### Video
393
+
394
+ ```ts
395
+ // H.264
396
+ const h264 = medialive.EncodeConfiguration.video({
397
+ name: 'h264_720p',
398
+ codec: medialive.VideoCodecSettings.h264({
399
+ rateControl: medialive.H264RateControl.cbr({ bitrate: Bitrate.mbps(3) }),
400
+ framerate: medialive.Framerate.FPS_30,
401
+ profile: medialive.H264Profile.HIGH,
402
+ }),
403
+ width: 1280,
404
+ height: 720,
405
+ });
406
+
407
+ // H.265
408
+ const h265 = medialive.EncodeConfiguration.video({
409
+ name: 'h265_1080p',
410
+ codec: medialive.VideoCodecSettings.h265({
411
+ rateControl: medialive.H265RateControl.qvbr({
412
+ maxBitrate: Bitrate.mbps(5),
413
+ qvbrQualityLevel: 7,
414
+ }),
415
+ framerate: medialive.Framerate.FPS_30,
416
+ profile: medialive.H265Profile.MAIN,
417
+ tier: medialive.H265Tier.HIGH,
418
+ }),
419
+ width: 1920,
420
+ height: 1080,
421
+ });
422
+ ```
423
+
424
+ Video codecs accept optional overrides for adaptive quantization, scene-change detection, color space, and more. See the props interfaces for the full list:
425
+
426
+ ```ts
427
+ const hdr = medialive.EncodeConfiguration.video({
428
+ name: 'h265_hdr',
429
+ codec: medialive.VideoCodecSettings.h265({
430
+ rateControl: medialive.H265RateControl.qvbr({ maxBitrate: Bitrate.mbps(8), qvbrQualityLevel: 8 }),
431
+ framerate: medialive.Framerate.FPS_30,
432
+ sceneChangeDetect: medialive.H265SceneChangeDetect.ENABLED,
433
+ colorSpaceSettings: medialive.H265ColorSpaceSettings.hlg2020(),
434
+ }),
435
+ width: 1920,
436
+ height: 1080,
437
+ });
438
+ ```
439
+
440
+ ### Audio
441
+
442
+ ```ts
443
+ // AAC stereo
444
+ const aac = medialive.EncodeConfiguration.audio({
445
+ name: 'aac_stereo',
446
+ codec: medialive.AudioCodecSettings.aac({
447
+ bitrate: Bitrate.kbps(192),
448
+ codingMode: medialive.AacCodingMode.CODING_MODE_2_0,
449
+ }),
450
+ });
451
+
452
+ // AC3 5.1
453
+ const ac3 = medialive.EncodeConfiguration.audio({
454
+ name: 'ac3_surround',
455
+ codec: medialive.AudioCodecSettings.ac3({
456
+ bitrate: Bitrate.kbps(384),
457
+ codingMode: medialive.Ac3CodingMode.CODING_MODE_3_2_LFE,
458
+ }),
459
+ });
460
+ ```
461
+
462
+ ### Caption
463
+
464
+ A caption encode converts a source caption track (referenced by `captionSelectorName`) to an
465
+ output format via the `CaptionDestination` factory. One selector can feed multiple encodes:
466
+
467
+ ```ts
468
+ // Define a caption selector on the input attachment (see Input Attachment Settings below)
469
+ const captionSelector = medialive.CaptionSelector.embedded('captions');
470
+
471
+ // WebVTT captions — packaged alongside the video encode in the same output
472
+ const webvtt = medialive.EncodeConfiguration.caption({
473
+ name: 'eng_webvtt',
474
+ captionSelectorName: captionSelector.name,
475
+ languageCode: 'eng',
476
+ languageDescription: 'English',
477
+ destination: medialive.CaptionDestination.webvtt(),
478
+ });
479
+
480
+ // Burned-in captions — rendered into the video, styled via the burn-in options
481
+ const burnIn = medialive.EncodeConfiguration.caption({
482
+ name: 'eng_burnin',
483
+ captionSelectorName: captionSelector.name,
484
+ destination: medialive.CaptionDestination.burnIn({
485
+ alignment: medialive.CaptionAlignment.CENTERED,
486
+ fontColor: medialive.CaptionFontColor.WHITE,
487
+ outlineColor: medialive.CaptionOutlineColor.BLACK,
488
+ fontSize: medialive.CaptionFontSize.AUTO,
489
+ }),
490
+ });
491
+ ```
492
+
493
+ ## Cross-service integrations
494
+
495
+ | Destination | MediaLive side | Other side | Package |
496
+ |---|---|---|---|
497
+ | MediaPackage V2 | `medialive.OutputGroupConfiguration.mediaPackageV2()` | `mediapackagev2.Channel` | `@aws-cdk/aws-mediapackagev2-alpha` |
498
+ | MediaConnect Router (output) | `medialive.OutputGroupConfiguration.mediaConnectRouter()` | `mediaconnect.RouterInputConfiguration.mediaLiveChannel()` | `@aws-cdk/aws-mediaconnect-alpha` |
499
+ | MediaConnect Router (input) | `medialive.InputConfiguration.mediaConnectRouter()` | `mediaconnect.RouterOutputConfiguration.mediaLiveInput()` | `@aws-cdk/aws-mediaconnect-alpha` |
500
+
501
+ ### AWS Elemental MediaPackage V2
502
+
503
+ Use `mediaPackageV2()` and pass a single `channel` — MediaLive maps each pipeline to a MediaPackage ingest endpoint automatically (one for `SINGLE_PIPELINE`, both for `STANDARD`). Each output contains a single encode (one track per output).
504
+
505
+ In-band captions (burn-in, embedded) ride alongside a video encode via the `captions` prop:
506
+
507
+ ```ts
508
+ declare const mpChannel: mediapackagev2.IChannel;
509
+ declare const hdVideo: medialive.EncodeConfiguration;
510
+ declare const sdVideo: medialive.EncodeConfiguration;
511
+ declare const audio: medialive.EncodeConfiguration;
512
+ declare const burnIn: medialive.EncodeConfiguration;
513
+
514
+ medialive.OutputGroupConfiguration.mediaPackageV2({
515
+ name: 'emp',
516
+ channel: mpChannel,
517
+ outputs: [
518
+ { encode: hdVideo, captions: [burnIn], outputName: 'hd' },
519
+ { encode: sdVideo, outputName: 'sd' },
520
+ { encode: audio, outputName: 'audio' },
521
+ ],
522
+ });
523
+ ```
524
+
525
+ For per-pipeline control — for example pinning pipeline 0 to a specific endpoint, or delivering each pipeline to a different (cross-region) channel — use `mediaPackageV2PerPipeline()` with explicit destinations:
526
+
527
+ ```ts
528
+ declare const primary: mediapackagev2.IChannel;
529
+ declare const hdVideo: medialive.EncodeConfiguration;
530
+
531
+ medialive.OutputGroupConfiguration.mediaPackageV2PerPipeline({
532
+ name: 'emp',
533
+ destinations: [
534
+ // destinations[0] → Pipeline 0, destinations[1] → Pipeline 1
535
+ medialive.MediaPackageV2Destination.channel(primary, medialive.MediaPackageV2EndpointId.ENDPOINT_2),
536
+ medialive.MediaPackageV2Destination.channel(primary, medialive.MediaPackageV2EndpointId.ENDPOINT_1),
537
+ ],
538
+ outputs: [
539
+ { encode: hdVideo, outputName: 'hd' },
540
+ ],
541
+ });
542
+ ```
543
+
544
+ ### HLS
545
+
546
+ Use `OutputDestination.url()` for HTTP origins or `OutputDestination.toBucket()` for S3:
547
+
548
+ ```ts
549
+ declare const bucket: s3.IBucket;
550
+ declare const video: medialive.EncodeConfiguration;
551
+ declare const audio: medialive.EncodeConfiguration;
552
+
553
+ // HLS to S3
554
+ medialive.OutputGroupConfiguration.hls({
555
+ name: 'hls_s3',
556
+ destinations: [medialive.OutputDestination.toBucket(bucket, 'live/stream')],
557
+ outputs: [{ encodes: [video, audio], outputName: 'hls_out' }],
558
+ });
559
+
560
+ // HLS to an HTTPS CDN origin.
561
+ medialive.OutputGroupConfiguration.hls({
562
+ name: 'hls-http',
563
+ destinations: [medialive.OutputDestination.url('https://203.0.113.10/ingest/stream')],
564
+ hlsCdnSettings: medialive.HlsCdnSettings.basicPut(),
565
+ outputs: [{ encodes: [video, audio], outputName: 'hls_out' }],
566
+ });
567
+ ```
568
+
569
+ ### Archive
570
+
571
+ Archive outputs write long-form recordings to S3:
572
+
573
+ ```ts
574
+ declare const bucket: s3.IBucket;
575
+ declare const video: medialive.EncodeConfiguration;
576
+ declare const audio: medialive.EncodeConfiguration;
577
+
578
+ medialive.OutputGroupConfiguration.archive({
579
+ name: 'archive',
580
+ destinations: [medialive.S3OutputDestination.toBucket(bucket, 'archive/recording')],
581
+ rolloverInterval: Duration.seconds(600),
582
+ outputs: [{ encodes: [video, audio], outputName: 'archive_out' }],
583
+ });
584
+ ```
585
+
586
+ ### RTMP
587
+
588
+ RTMP outputs support H.264 + AAC only. Each output takes one destination per channel pipeline (the console's "Destination A" / "Destination B") via `RtmpDestination.url()` — one for `SINGLE_PIPELINE`, two for `STANDARD`:
589
+
590
+ ```ts
591
+ declare const video: medialive.EncodeConfiguration;
592
+ declare const audio: medialive.EncodeConfiguration;
593
+
594
+ medialive.OutputGroupConfiguration.rtmp({
595
+ name: 'social',
596
+ outputs: [{
597
+ encodes: [video, audio],
598
+ outputName: 'live',
599
+ destinations: [
600
+ medialive.RtmpDestination.url('rtmp://rtmp.example.com/live', 'your-stream-key'),
601
+ ],
602
+ }],
603
+ });
604
+ ```
605
+
606
+ ### SRT
607
+
608
+ SRT outputs use `SrtDestination.caller()` for caller mode or `SrtDestination.listener()` for listener mode. When you already have a full SRT URL rather than a separate host and port, use `SrtDestination.callerUrl()`. SRT output is always encrypted, so every destination takes an `encryptionPassphraseSecret` (a Secrets Manager secret). Each output takes one destination per channel pipeline ("Destination A"/"Destination B") — one for `SINGLE_PIPELINE`, two for `STANDARD`:
609
+
610
+ ```ts
611
+ declare const video: medialive.EncodeConfiguration;
612
+ declare const audio: medialive.EncodeConfiguration;
613
+ declare const passphrase: secretsmanager.ISecret;
614
+
615
+ // SRT caller to a remote listener
616
+ medialive.OutputGroupConfiguration.srt({
617
+ name: 'srt_out',
618
+ outputs: [{
619
+ encodes: [video, audio],
620
+ outputName: 'srt_caller',
621
+ destinations: [medialive.SrtDestination.caller({
622
+ address: '203.0.113.20',
623
+ port: 5000,
624
+ encryptionPassphraseSecret: passphrase,
625
+ })],
626
+ }],
627
+ });
628
+
629
+ // SRT listener — MediaLive waits for the downstream system to connect
630
+ medialive.OutputGroupConfiguration.srt({
631
+ name: 'srt_listen',
632
+ outputs: [{
633
+ encodes: [video, audio],
634
+ outputName: 'srt_listener',
635
+ destinations: [medialive.SrtDestination.listener({
636
+ listenerPort: 5000,
637
+ encryptionPassphraseSecret: passphrase,
638
+ })],
639
+ }],
640
+ });
641
+ ```
642
+
643
+ ### AWS Elemental MediaConnect Router
644
+
645
+ `mediaConnectRouter()` delivers each channel pipeline to an AWS Elemental MediaConnect Router. Transit encryption defaults to AUTOMATIC; CDK derives one destination per pipeline from the channel class, so the common case needs no per-pipeline configuration. You must specify `availabilityZones` — exactly one for a `SINGLE_PIPELINE` channel, or two (one per pipeline) for `STANDARD`. The downstream wiring — which router input each pipeline feeds — is configured on the MediaConnect side, referencing this group's output by name and pipeline id.
646
+
647
+ ```ts
648
+ declare const video: medialive.EncodeConfiguration;
649
+ declare const audio: medialive.EncodeConfiguration;
650
+ declare const passphrase: secretsmanager.ISecret;
651
+ declare const passphrase1: secretsmanager.ISecret;
652
+
653
+ // AUTOMATIC encryption on every pipeline (MPEG-TS container, like UDP)
654
+ medialive.OutputGroupConfiguration.mediaConnectRouter({
655
+ name: 'router_out',
656
+ availabilityZones: ['us-east-1a'],
657
+ outputs: [{ encodes: [video, audio], outputName: 'router_ts' }],
658
+ });
659
+
660
+ // One shared Secrets Manager passphrase across all pipelines (SECRETS_MANAGER encryption)
661
+ medialive.OutputGroupConfiguration.mediaConnectRouter({
662
+ name: 'router_out',
663
+ availabilityZones: ['us-east-1a'],
664
+ routerSettings: medialive.MediaConnectRouterSettings.shared({ encryptionSecret: passphrase }),
665
+ outputs: [{ encodes: [video, audio], outputName: 'router_ts' }],
666
+ });
667
+
668
+ // Distinct encryption per pipeline — an omitted pipeline stays AUTOMATIC (STANDARD channels)
669
+ medialive.OutputGroupConfiguration.mediaConnectRouter({
670
+ name: 'router_out',
671
+ availabilityZones: ['us-east-1a', 'us-east-1b'],
672
+ routerSettings: medialive.MediaConnectRouterSettings.perPipeline({
673
+ pipeline1: { encryptionSecret: passphrase1 },
674
+ }),
675
+ outputs: [{ encodes: [video, audio], outputName: 'router_ts' }],
676
+ });
677
+ ```
678
+
679
+ When a passphrase secret is supplied, the channel's IAM role is automatically granted read access to it.
680
+
681
+ ### UDP
682
+
683
+ UDP outputs deliver MPEG-TS over UDP or RTP. Use `UdpOutputDestination.udp()` for plain UDP or `.rtp()` for RTP (required if using FEC):
684
+
685
+ ```ts
686
+ declare const video: medialive.EncodeConfiguration;
687
+ declare const audio: medialive.EncodeConfiguration;
688
+
689
+ medialive.OutputGroupConfiguration.udp({
690
+ name: 'udp_out',
691
+ destinations: [medialive.UdpOutputDestination.udp({ address: '203.0.113.5', port: 5000 })],
692
+ outputs: [{ encodes: [video, audio], outputName: 'ts_out' }],
693
+ });
694
+ ```
695
+
696
+ ### Frame Capture
697
+
698
+ Frame capture outputs write periodic JPEG snapshots to S3:
699
+
700
+ ```ts
701
+ declare const bucket: s3.IBucket;
702
+ declare const video: medialive.EncodeConfiguration;
703
+
704
+ medialive.OutputGroupConfiguration.frameCapture({
705
+ name: 'thumbnails',
706
+ destinations: [medialive.S3OutputDestination.toBucket(bucket, 'thumbnails/live')],
707
+ outputs: [{ encodes: [video], outputName: 'thumb' }],
708
+ });
709
+ ```
710
+
711
+ ### Microsoft Smooth Streaming
712
+
713
+ MS Smooth outputs push fragmented MP4 to an IIS Smooth Streaming endpoint:
714
+
715
+ ```ts
716
+ declare const video: medialive.EncodeConfiguration;
717
+ declare const audio: medialive.EncodeConfiguration;
718
+
719
+ medialive.OutputGroupConfiguration.msSmooth({
720
+ name: 'smooth',
721
+ destinations: [medialive.OutputDestination.url('https://smooth.example.com/live')],
722
+ outputs: [{ encodes: [video, audio], outputName: 'smooth_out' }],
723
+ });
724
+ ```
725
+
726
+ ### Per-output HLS settings
727
+
728
+ HLS outputs accept per-output `hlsSettings` via the `HlsSettings` factory — `standard()` for a video
729
+ rendition (with optional `M3u8Settings` for the transport stream), `audioOnly()` for an audio
730
+ rendition (with optional cover art as a [`FileLocation`](#file-locations)), `fmp4()`, or
731
+ `frameCapture()`.
732
+
733
+ ```ts
734
+ declare const bucket: s3.IBucket;
735
+ declare const video: medialive.EncodeConfiguration;
736
+ declare const audio: medialive.EncodeConfiguration;
737
+
738
+ medialive.OutputGroupConfiguration.hls({
739
+ name: 'hls',
740
+ destinations: [medialive.OutputDestination.toBucket(bucket, 'live/stream')],
741
+ outputs: [
742
+ {
743
+ encodes: [video],
744
+ outputName: 'video',
745
+ hlsSettings: medialive.HlsSettings.standard({
746
+ m3u8Settings: medialive.M3u8Settings.of({
747
+ scte35Behavior: medialive.M3u8Scte35Behavior.PASSTHROUGH,
748
+ programNum: 1,
749
+ }),
750
+ }),
751
+ },
752
+ {
753
+ encodes: [audio],
754
+ outputName: 'audio',
755
+ hlsSettings: medialive.HlsSettings.audioOnly({
756
+ audioGroupId: 'program',
757
+ audioOnlyImage: medialive.FileLocation.fromBucket(bucket, 'art/cover.png'),
758
+ }),
759
+ },
760
+ ],
761
+ });
762
+ ```
763
+
764
+ ### Forward Error Correction (UDP)
765
+
766
+ UDP outputs accept optional `fec` settings (SMPTE 2022-1) — column-only or column-and-row FEC.
767
+ FEC requires an `rtp://` destination:
768
+
769
+ ```ts
770
+ declare const video: medialive.EncodeConfiguration;
771
+
772
+ medialive.OutputGroupConfiguration.udp({
773
+ name: 'udp',
774
+ destinations: [medialive.UdpOutputDestination.rtp({ address: '203.0.113.5', port: 5000 })],
775
+ outputs: [{
776
+ encodes: [video],
777
+ outputName: 'ts',
778
+ fec: { mode: medialive.FecMode.COLUMN_AND_ROW, columnDepth: 10, rowLength: 10 },
779
+ }],
780
+ });
781
+ ```
782
+
783
+ ### MPEG-TS Container Settings
784
+
785
+ The MPEG-TS output groups — `udp()`, `archive()`, `srt()`, and `mediaConnectRouter()` — accept optional per-output `m2tsSettings` via `M2tsSettings.of()`. Omit it to use MediaLive's service defaults. Bitrates use `Bitrate`, intervals use `Duration`, and closed-value fields use enums (e.g. `M2tsRateMode`, `M2tsScte35Control`); PID fields are strings that accept decimal, hexadecimal, ranges, or comma-separated lists.
786
+
787
+ ```ts
788
+ declare const video: medialive.EncodeConfiguration;
789
+ declare const audio: medialive.EncodeConfiguration;
790
+
791
+ medialive.OutputGroupConfiguration.udp({
792
+ name: 'udp_out',
793
+ destinations: [medialive.UdpOutputDestination.udp({ address: '203.0.113.5', port: 5000 })],
794
+ outputs: [{
795
+ encodes: [video, audio],
796
+ outputName: 'ts',
797
+ m2tsSettings: medialive.M2tsSettings.of({
798
+ bitrate: Bitrate.mbps(8),
799
+ rateMode: medialive.M2tsRateMode.VBR,
800
+ programNum: 1,
801
+ patInterval: Duration.millis(100),
802
+ pmtInterval: Duration.millis(100),
803
+ scte35Control: medialive.M2tsScte35Control.PASSTHROUGH,
804
+ dvbSdtSettings: {
805
+ outputSdt: medialive.DvbSdtOutputMode.SDT_MANUAL,
806
+ serviceName: 'My Service',
807
+ repInterval: Duration.millis(2000),
808
+ },
809
+ }),
810
+ }],
811
+ });
812
+ ```
813
+
814
+ ## Destinations
815
+
816
+ Each output group type uses a specific destination class. Destinations are created via static factory methods:
817
+
818
+ | Destination class | Factory methods | Used by |
819
+ |---|---|---|
820
+ | `OutputDestination` | `url()`, `toBucket()` | HLS, MS Smooth, CMAF Ingest |
821
+ | `S3OutputDestination` | `url()`, `toBucket()` | Archive, Frame Capture |
822
+ | `UdpOutputDestination` | `udp()`, `rtp()`, `url()` | UDP |
823
+ | `MediaPackageV2Destination` | `channel()` | MediaPackage V2 |
824
+ | `RtmpDestination` | `url()` | RTMP |
825
+ | `SrtDestination` | `caller()`, `callerUrl()`, `listener()` | SRT |
826
+
827
+ `OutputDestination.toBucket()` (and `S3OutputDestination.toBucket()`) build canonical `s3ssl://` URLs and automatically grant the channel's IAM role the required S3 permissions; `InputSource.fromBucket()` does the same for input reads. `MediaPackageV2Destination.channel()` automatically grants ingest permissions on the MediaPackage V2 channel.
828
+
829
+ The MediaConnect Router output group has no destination class — its delivery is configured on the MediaConnect side. Per-pipeline transit encryption is set via the group's `routerSettings` prop using `MediaConnectRouterSettings.shared()` / `.perPipeline()` (see [MediaConnect Router](#mediaconnect-router) above).
830
+
831
+ ## Additional Destinations
832
+
833
+ MediaPackage V2 and CMAF Ingest output groups support `additionalDestinations` for cross-region delivery or backup packaging. These are separate from pipeline redundancy — they fan out the same content to extra endpoints.
834
+
835
+ The region for each destination is resolved automatically from the channel's stack. For cross-region imports, pass the region explicitly:
836
+
837
+ ```ts
838
+ declare const primaryChannel: mediapackagev2.IChannel;
839
+ declare const video: medialive.EncodeConfiguration;
840
+ declare const audio: medialive.EncodeConfiguration;
841
+
842
+ // Import a channel from another region — the region travels with the channel
843
+ const backupChannel = mediapackagev2.Channel.fromChannelAttributes(this, 'BackupChannel', {
844
+ channelName: 'backup-channel',
845
+ channelGroupName: 'backup-group',
846
+ region: 'us-west-2',
847
+ });
848
+
849
+ medialive.OutputGroupConfiguration.mediaPackageV2({
850
+ name: 'emp',
851
+ channel: primaryChannel,
852
+ additionalDestinations: [
853
+ // Cross-region: the destination picks up us-west-2 from the imported channel
854
+ medialive.MediaPackageV2Destination.channel(backupChannel, medialive.MediaPackageV2EndpointId.ENDPOINT_1),
855
+ ],
856
+ outputs: [
857
+ { encode: video, outputName: 'video' },
858
+ { encode: audio, outputName: 'audio' },
859
+ ],
860
+ });
861
+ ```
862
+
863
+ ## Pipeline Redundancy
864
+
865
+ Channels default to `SINGLE_PIPELINE`. Set `channelClass: ChannelClass.STANDARD` for two-pipeline redundancy.
866
+
867
+ When using STANDARD:
868
+
869
+ - Each output group's `destinations` array must have two entries — `destinations[0]` maps to Pipeline 0, `destinations[1]` maps to Pipeline 1.
870
+ - For MediaPackage V2, use `ENDPOINT_1` for Pipeline 0 and `ENDPOINT_2` for Pipeline 1.
871
+ - `additionalDestinations` are separate from pipeline redundancy — they fan out to extra endpoints.
872
+
873
+ ```ts
874
+ declare const stack: Stack;
875
+ declare const input: medialive.IInput;
876
+ declare const bucket: s3.IBucket;
877
+ declare const video: medialive.EncodeConfiguration;
878
+ declare const audio: medialive.EncodeConfiguration;
879
+
880
+ new medialive.Channel(stack, 'StandardChannel', {
881
+ channelClass: medialive.ChannelClass.STANDARD,
882
+ inputs: [{ input }],
883
+ outputGroups: [
884
+ medialive.OutputGroupConfiguration.hls({
885
+ name: 'hls',
886
+ destinations: [
887
+ medialive.OutputDestination.toBucket(bucket, 'live/pipeline0'),
888
+ medialive.OutputDestination.toBucket(bucket, 'live/pipeline1'),
889
+ ],
890
+ outputs: [{ encodes: [video, audio], outputName: 'hls_out' }],
891
+ }),
892
+ ],
893
+ });
894
+ ```
895
+
896
+ ## Input Attachment Settings
897
+
898
+ Each entry in `inputs` is an input attachment, which can carry per-input extraction and connection
899
+ settings beyond the input itself.
900
+
901
+ **Selectors** pick specific tracks out of the input. Use `AudioSelector` (`byLanguage()`, `byPid()`,
902
+ `byTrack()`, `hlsRendition()`, `default()`), `CaptionSelector` (`byLanguage()`, `embedded()`,
903
+ `ancillary()`, `dvbSub()`, `scte27()`, `teletext()`, `arib()`), and `videoSelector` (color space,
904
+ HDR10 metadata, and program/PID selection via `VideoSelection`). A caption encode then references a
905
+ caption selector by name.
906
+
907
+ ```ts
908
+ declare const stack: Stack;
909
+ declare const input: medialive.IInput;
910
+ declare const bucket: s3.IBucket;
911
+ declare const video: medialive.EncodeConfiguration;
912
+
913
+ new medialive.Channel(stack, 'Channel', {
914
+ inputs: [{
915
+ input,
916
+ audioSelectors: [
917
+ medialive.AudioSelector.byLanguage('eng', 'eng', medialive.AudioLanguageSelectionPolicy.STRICT),
918
+ ],
919
+ captionSelectors: [
920
+ medialive.CaptionSelector.embedded('embedded'),
921
+ ],
922
+ videoSelector: {
923
+ colorSpace: medialive.VideoColorSpace.HDR10,
924
+ colorSpaceUsage: medialive.VideoColorSpaceUsage.FORCE,
925
+ selectBy: medialive.VideoSelection.byProgramId(1),
926
+ },
927
+ }],
928
+ outputGroups: [
929
+ medialive.OutputGroupConfiguration.hls({
930
+ name: 'hls',
931
+ destinations: [medialive.OutputDestination.toBucket(bucket, 'live/stream')],
932
+ outputs: [{ encodes: [video], outputName: 'hls_out' }],
933
+ }),
934
+ ],
935
+ });
936
+ ```
937
+
938
+ **Network input settings** apply to URL-pull and multicast inputs — HLS bandwidth/buffer/retry
939
+ behaviour, the SCTE-35 source (`HlsScte35Source.SEGMENTS` or `MANIFEST`), HTTPS server validation,
940
+ and a multicast source IP for source-specific multicast. `logicalInterfaceNames` maps the input to
941
+ network interfaces on MediaLive Anywhere nodes.
942
+
943
+ ```ts
944
+ declare const stack: Stack;
945
+ declare const input: medialive.IInput;
946
+ declare const bucket: s3.IBucket;
947
+ declare const video: medialive.EncodeConfiguration;
948
+
949
+ new medialive.Channel(stack, 'Channel', {
950
+ inputs: [{
951
+ input,
952
+ networkInputSettings: {
953
+ serverValidation: medialive.ServerValidation.CHECK_CRYPTOGRAPHY_AND_VALIDATE_NAME,
954
+ hlsInputSettings: {
955
+ bandwidth: Bitrate.mbps(5),
956
+ scte35Source: medialive.HlsScte35Source.MANIFEST,
957
+ },
958
+ },
959
+ logicalInterfaceNames: ['eth0', 'eth1'],
960
+ }],
961
+ outputGroups: [
962
+ medialive.OutputGroupConfiguration.hls({
963
+ name: 'hls',
964
+ destinations: [medialive.OutputDestination.toBucket(bucket, 'live/stream')],
965
+ outputs: [{ encodes: [video], outputName: 'hls_out' }],
966
+ }),
967
+ ],
968
+ });
969
+ ```
970
+
971
+ ## Automatic Input Failover
972
+
973
+ Automatic input failover gives you input-*source* redundancy: attach a secondary input, and
974
+ MediaLive switches to it without restarting the channel when the active input meets a failover
975
+ condition. This is separate from the pipeline redundancy of `ChannelClass.STANDARD` (which
976
+ duplicates a single source across two pipelines).
977
+
978
+ Provide `automaticInputFailover` on the input attachment. If you don't specify conditions, a
979
+ single input-loss condition is used:
980
+
981
+ ```ts
982
+ declare const stack: Stack;
983
+ declare const primaryInput: medialive.IInput;
984
+ declare const secondaryInput: medialive.IInput;
985
+ declare const audioSelector: medialive.AudioSelector;
986
+ declare const video: medialive.EncodeConfiguration;
987
+ declare const audio: medialive.EncodeConfiguration;
988
+ declare const bucket: s3.IBucket;
989
+
990
+ new medialive.Channel(stack, 'Channel', {
991
+ inputs: [{
992
+ input: primaryInput,
993
+ automaticInputFailover: {
994
+ secondaryInput,
995
+ inputPreference: medialive.InputPreference.PRIMARY_INPUT_PREFERRED,
996
+ errorClearTime: Duration.seconds(3),
997
+ failoverConditions: [
998
+ medialive.FailoverCondition.inputLoss({ threshold: Duration.millis(1500) }),
999
+ medialive.FailoverCondition.audioSilence({ audioSelector, threshold: Duration.seconds(2) }),
1000
+ medialive.FailoverCondition.videoBlack({ blackDetectThreshold: 0.1, threshold: Duration.seconds(1) }),
1001
+ ],
1002
+ },
1003
+ }, {
1004
+ // The secondary input must also be attached to the channel as its own input.
1005
+ input: secondaryInput,
1006
+ }],
1007
+ outputGroups: [
1008
+ medialive.OutputGroupConfiguration.hls({
1009
+ name: 'hls',
1010
+ destinations: [medialive.OutputDestination.toBucket(bucket, 'live/stream')],
1011
+ outputs: [{ encodes: [video, audio], outputName: 'hls_out' }],
1012
+ }),
1013
+ ],
1014
+ });
1015
+ ```
1016
+
1017
+ The primary and secondary inputs must have the same input class. The channel's IAM role is
1018
+ granted read access to the secondary input's sources automatically, just like the primary.
1019
+
1020
+ ## Ad Avail Handling
1021
+
1022
+ MediaLive can blank content during ad avails, insert blackout slates, and signal SCTE-35 ad avails
1023
+ to downstream systems. These are all channel-level props.
1024
+
1025
+ `availBlanking` replaces video/audio/captions with black (or an image) during an ad avail, and
1026
+ `blackoutSlate` shows a slate when a SCTE-35 blackout is signalled. Both image fields take a
1027
+ [`FileLocation`](#file-locations).
1028
+
1029
+ ```ts
1030
+ declare const stack: Stack;
1031
+ declare const input: medialive.IInput;
1032
+ declare const bucket: s3.IBucket;
1033
+ declare const video: medialive.EncodeConfiguration;
1034
+
1035
+ new medialive.Channel(stack, 'Channel', {
1036
+ inputs: [{ input }],
1037
+ availBlanking: {
1038
+ state: medialive.AvailBlankingState.ENABLED,
1039
+ image: medialive.FileLocation.fromBucket(bucket, 'slates/avail.png'),
1040
+ },
1041
+ blackoutSlate: {
1042
+ state: medialive.BlackoutSlateState.ENABLED,
1043
+ image: medialive.FileLocation.fromBucket(bucket, 'slates/blackout.png'),
1044
+ },
1045
+ outputGroups: [
1046
+ medialive.OutputGroupConfiguration.hls({
1047
+ name: 'hls',
1048
+ destinations: [medialive.OutputDestination.toBucket(bucket, 'live/stream')],
1049
+ outputs: [{ encodes: [video], outputName: 'hls_out' }],
1050
+ }),
1051
+ ],
1052
+ });
1053
+ ```
1054
+
1055
+ `availSettings` selects how SCTE-35 ad avails are handled — `AvailSettings.spliceInsert()`,
1056
+ `AvailSettings.timeSignalApos()`, or `AvailSettings.esam()` for Event Signaling and Management
1057
+ against an external POIS endpoint. `scte35SegmentationScope` controls which output groups receive
1058
+ the segmentation cues. The ESAM POIS password is supplied as an SSM parameter, and the channel role
1059
+ is granted read access to it automatically.
1060
+
1061
+ ```ts
1062
+ import { StringParameter } from 'aws-cdk-lib/aws-ssm';
1063
+
1064
+ declare const stack: Stack;
1065
+ declare const input: medialive.IInput;
1066
+ declare const bucket: s3.IBucket;
1067
+ declare const video: medialive.EncodeConfiguration;
1068
+ declare const poisPassword: StringParameter;
1069
+
1070
+ new medialive.Channel(stack, 'Channel', {
1071
+ inputs: [{ input }],
1072
+ availSettings: medialive.AvailSettings.esam({
1073
+ pois: {
1074
+ url: 'https://pois.example.com/esam',
1075
+ username: 'pois-user',
1076
+ password: poisPassword,
1077
+ },
1078
+ acquisitionPointId: 'acquisition-point-1',
1079
+ adAvailOffset: Duration.millis(200),
1080
+ }),
1081
+ scte35SegmentationScope: medialive.Scte35SegmentationScope.SCTE35_ENABLED_OUTPUT_GROUPS,
1082
+ outputGroups: [
1083
+ medialive.OutputGroupConfiguration.hls({
1084
+ name: 'hls',
1085
+ destinations: [medialive.OutputDestination.toBucket(bucket, 'live/stream')],
1086
+ outputs: [{ encodes: [video], outputName: 'hls_out' }],
1087
+ }),
1088
+ ],
1089
+ });
1090
+ ```
1091
+
1092
+ ## Auto-Created Role and Grants
1093
+
1094
+ When no `role` is provided, the channel auto-creates an IAM role with the `medialive.amazonaws.com` service principal and grants it only the permissions your configuration actually needs. These automatic grants apply **only** to the channel-managed role; if you bring your own `role`, none are added.
1095
+
1096
+ **Channel role grants** — wired based on what you configure (channel-managed role only):
1097
+
1098
+ | Configuration | Grant | Scope |
1099
+ |---|---|---|
1100
+ | `OutputDestination.toBucket()` | S3 read/write | The destination bucket/prefix |
1101
+ | `InputSource.fromBucket()` | S3 read | The input source bucket/prefix |
1102
+ | `MediaPackageV2Destination.channel()` | `mediapackagev2:PutObject` | The MediaPackage V2 channel |
1103
+ | `SrtDestination` with an encryption secret | Secrets Manager read | The secret |
1104
+ | URL pull input with a password parameter | SSM parameter read | The parameter |
1105
+ | Thumbnails (on by default) | `s3:PutObject` | `*` — uploads to an AWS service-owned bucket |
1106
+ | Channel logging (`logLevel` set) | CloudWatch Logs write | The `ElementalMediaLive` log group in your account/region |
1107
+ | VPC output (`vpc` set) | EC2 ENI create/delete + describe | Scoped to your subnets/SGs; `Describe*` requires `*` |
1108
+
1109
+ **Input role grants** — separate from the channel role, used at input create/delete time. Like the channel role, these are added only when the input auto-creates its role; pass a `role` to `mediaConnect()` or `cdi()` and no grants are added:
1110
+
1111
+ | Input type | Grant | Scope |
1112
+ |---|---|---|
1113
+ | `InputConfiguration.mediaConnect()` | `mediaconnect:ManagedDescribeFlow`, `ManagedAddOutput`, `ManagedRemoveOutput` | `*` — service rejects flow-scoped grants |
1114
+ | `InputConfiguration.cdi()` | EC2 ENI create/delete + describe | Scoped to your subnets/SGs; `Describe*` requires `*` |
1115
+
1116
+ Both channel and input auto-created roles include confused-deputy prevention (`aws:SourceAccount` + `aws:SourceArn` conditions). For the full list of trusted-entity requirements, see [the documentation](https://docs.aws.amazon.com/medialive/latest/ug/trusted-entity-requirements.html).
1117
+
1118
+ The auto-created role is available on `channel.role` if you need to add further permissions.
1119
+
1120
+ ### Bringing your pre-defined role
1121
+
1122
+ When you pass a `role`, the channel makes **no** automatic grants — you will need to add the permissions that role needs. That covers both the principal policy and any referenced resource policies: S3 output destinations and input sources, Secrets Manager and SSM reads, MediaPackage V2 ingest, CloudWatch Logs, and VPC output ENI management. See the [trusted-entity requirements](https://docs.aws.amazon.com/medialive/latest/ug/trusted-entity-requirements.html), or pass the account's `MediaLiveAccessRole` — an IAM role that MediaLive can assume.
1123
+
1124
+ ## CloudWatch Metrics
1125
+
1126
+ Channels expose CloudWatch metric helpers in the `AWS/MediaLive` namespace, dimensioned by `ChannelId` and `Pipeline`. Use the named helpers below for the most common metrics, or `metric(metricName, pipeline)` to access any metric documented by the [MediaLive metrics reference](https://docs.aws.amazon.com/medialive/latest/ug/monitoring-eml-metrics.html).
1127
+
1128
+ MediaLive publishes metrics per pipeline. Every helper takes a `Pipeline` argument so you make an explicit decision about which pipeline you're monitoring. `STANDARD` channels run two redundant pipelines (`PIPELINE_0`, `PIPELINE_1`) — alarm on both to cover the full channel. `SINGLE_PIPELINE` channels only publish on `PIPELINE_0`; passing `PIPELINE_1` throws at synth time.
1129
+
1130
+ ```ts
1131
+ declare const channel: medialive.Channel;
1132
+ declare const stack: Stack;
1133
+
1134
+ channel.metricDroppedFrames(medialive.Pipeline.PIPELINE_0).createAlarm(stack, 'DroppedFrames', {
1135
+ threshold: 1,
1136
+ evaluationPeriods: 2,
1137
+ });
1138
+
1139
+ channel.metricSvqTime(medialive.Pipeline.PIPELINE_0).createAlarm(stack, 'SvqTime', {
1140
+ threshold: 0,
1141
+ evaluationPeriods: 1,
1142
+ });
1143
+
1144
+ // Custom metric by name with sum statistic
1145
+ channel.metric('Output4xxErrors', medialive.Pipeline.PIPELINE_0, { statistic: 'sum' });
1146
+ ```
1147
+
1148
+ For STANDARD channels, alarm on both pipelines:
1149
+
1150
+ ```ts
1151
+ declare const standardChannel: medialive.Channel;
1152
+ declare const stack: Stack;
1153
+
1154
+ standardChannel.metricDroppedFrames(medialive.Pipeline.PIPELINE_0).createAlarm(stack, 'Drops0', {
1155
+ threshold: 1,
1156
+ evaluationPeriods: 2,
1157
+ });
1158
+ standardChannel.metricDroppedFrames(medialive.Pipeline.PIPELINE_1).createAlarm(stack, 'Drops1', {
1159
+ threshold: 1,
1160
+ evaluationPeriods: 2,
1161
+ });
1162
+ ```
1163
+
1164
+ ### Channel metrics
1165
+
1166
+ | Helper | Metric name | Default statistic | Notes |
1167
+ |---|---|---|---|
1168
+ | `metricActiveAlerts(pipeline)` | `ActiveAlerts` | Max | Total active alerts on the channel |
1169
+ | `metricNetworkIn(pipeline)` | `NetworkIn` | Avg | Inbound traffic in Mbps |
1170
+ | `metricNetworkOut(pipeline)` | `NetworkOut` | Avg | Outbound traffic in Mbps |
1171
+ | `metricInputVideoFrameRate(pipeline)` | `InputVideoFrameRate` | Max | Source video frame rate |
1172
+ | `metricFillMsec(pipeline)` | `FillMsec` | Max | Time filled with fill frames — non-zero indicates input loss |
1173
+ | `metricInputLossSeconds(pipeline)` | `InputLossSeconds` | Sum | Seconds without packets (RTP / MediaConnect inputs) |
1174
+ | `metricDroppedFrames(pipeline)` | `DroppedFrames` | Sum | Frames dropped because the encoder fell behind |
1175
+ | `metricSvqTime(pipeline)` | `SvqTime` | Max | Percent of time MediaLive reduced quality to keep up |
1176
+ | `metric(name, pipeline, props?)` | (custom) | (caller-provided) | Build any metric in `AWS/MediaLive` |
1177
+
1178
+ The defaults match the AWS-recommended statistic for each metric. Pass `props` to override statistic, period, dimensions, or any other `MetricOptions` field.
1179
+
1180
+ ## MediaLive Anywhere
1181
+
1182
+ MediaLive Anywhere lets you run MediaLive channels on your own on-premises hardware.
1183
+
1184
+ Certain input types are only available with Anywhere channels (channels configured with `anywhereSettings`):
1185
+ SDI, SMPTE 2110 Receiver Group, and Multicast. Attempting to use these input types on a cloud channel will throw a validation error at synth time.
1186
+
1187
+ ### Network
1188
+
1189
+ A network defines IP address pools and routes for Anywhere resources:
1190
+
1191
+ ```ts
1192
+ declare const stack: Stack;
1193
+ const network = new medialive.Network(stack, 'Network', {
1194
+ networkName: 'on-prem-network',
1195
+ ipPools: ['10.0.0.0/24'],
1196
+ routes: [{ cidr: '0.0.0.0/0', gateway: '10.0.0.1' }],
1197
+ });
1198
+ ```
1199
+
1200
+ ### Cluster
1201
+
1202
+ A cluster represents a group of on-premises hardware nodes:
1203
+
1204
+ ```ts
1205
+ declare const stack: Stack;
1206
+ declare const instanceRole: iam.IRole;
1207
+
1208
+ const cluster = new medialive.Cluster(stack, 'Cluster', {
1209
+ clusterName: 'on-prem-cluster',
1210
+ clusterType: medialive.ClusterType.ON_PREMISES,
1211
+ instanceRole,
1212
+ });
1213
+ ```
1214
+
1215
+ ### Channel Placement Group
1216
+
1217
+ A channel placement group assigns channels to specific nodes within a cluster. Associate it with a channel via `anywhereSettings`:
1218
+
1219
+ ```ts
1220
+ declare const stack: Stack;
1221
+ declare const cluster: medialive.ICluster;
1222
+ declare const input: medialive.IInput;
1223
+ declare const video: medialive.EncodeConfiguration;
1224
+ declare const bucket: s3.IBucket;
1225
+
1226
+ const cpg = new medialive.ChannelPlacementGroup(stack, 'CPG', {
1227
+ channelPlacementGroupName: 'my-cpg',
1228
+ cluster,
1229
+ });
1230
+
1231
+ new medialive.Channel(stack, 'AnywhereChannel', {
1232
+ inputs: [{ input }],
1233
+ anywhereSettings: { cluster, channelPlacementGroup: cpg },
1234
+ outputGroups: [
1235
+ medialive.OutputGroupConfiguration.hls({
1236
+ name: 'hls',
1237
+ destinations: [medialive.OutputDestination.toBucket(bucket, 'live/stream')],
1238
+ outputs: [{ encodes: [video], outputName: 'hls_out' }],
1239
+ }),
1240
+ ],
1241
+ });
1242
+ ```
1243
+
1244
+ ### SDI Source
1245
+
1246
+ An SDI source represents a physical SDI input on Anywhere hardware:
1247
+
1248
+ ```ts
1249
+ declare const stack: Stack;
1250
+ const sdi = new medialive.SdiSource(stack, 'Sdi', {
1251
+ sdiSourceName: 'camera-1',
1252
+ type: medialive.SdiType.SINGLE,
1253
+ });
1254
+ ```
1255
+
1256
+ ### On-premises input networking
1257
+
1258
+ For inputs that live in an on-premises network, set `inputNetworkLocation` to
1259
+ `InputNetworkLocation.ON_PREMISES`. On-premises inputs do not use input security groups. Push
1260
+ inputs (RTMP/RTP/UDP) can pin their destination to a `Network`, declare the `networkRoutes` to
1261
+ reach it on the local network, and request a `staticIpAddress`:
1262
+
1263
+ ```ts
1264
+ declare const stack: Stack;
1265
+
1266
+ const network = new medialive.Network(stack, 'Network', {
1267
+ networkName: 'on-prem-network',
1268
+ ipPools: ['192.168.1.0/24'],
1269
+ });
1270
+
1271
+ new medialive.Input(stack, 'OnPremInput', {
1272
+ inputName: 'on-prem-rtp',
1273
+ inputNetworkLocation: medialive.InputNetworkLocation.ON_PREMISES,
1274
+ input: medialive.InputConfiguration.rtpPush({
1275
+ destinations: [{
1276
+ network,
1277
+ networkRoutes: [{ cidr: '10.0.0.0/24', gateway: '10.0.0.1' }],
1278
+ staticIpAddress: '192.168.1.50',
1279
+ }],
1280
+ }),
1281
+ });
1282
+ ```
1283
+
1284
+ SRT listener inputs accept a `streamId` that the upstream system uses when connecting:
1285
+
1286
+ ```ts
1287
+ declare const stack: Stack;
1288
+ declare const sg: medialive.IInputSecurityGroup;
1289
+
1290
+ new medialive.Input(stack, 'SrtListener', {
1291
+ inputName: 'srt-listener',
1292
+ input: medialive.InputConfiguration.srtListener({
1293
+ inputSecurityGroups: [sg],
1294
+ streamId: 'my-stream-id',
1295
+ }),
1296
+ });
1297
+ ```