> **Experimental**
>
> `@aws-cdk/aws-medialive-alpha` is an [**experimental**](/stability) (alpha) package: its API may change in any release, without a major version bump.
# VideoSelection

Selects the specific video to extract from the input — by PID or by program.

Create with
the static factory methods; exactly one selection applies, enforced by the type.

- Stability: [Experimental](/cdk/api/stability.html)
- Source: [`lib/video-selection.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0-alpha.0/packages/@aws-cdk/aws-medialive-alpha/lib/video-selection.ts#L78)

## Example

```ts
declare const stack: Stack;
declare const input: medialive.IInput;
declare const bucket: s3.IBucket;
declare const video: medialive.EncodeConfiguration;

new medialive.Channel(stack, 'Channel', {
  inputs: [{
    input,
    audioSelectors: [
      medialive.AudioSelector.byLanguage('eng', 'eng', medialive.AudioLanguageSelectionPolicy.STRICT),
    ],
    captionSelectors: [
      medialive.CaptionSelector.embedded('embedded'),
    ],
    videoSelector: {
      colorSpace: medialive.VideoColorSpace.HDR10,
      colorSpaceUsage: medialive.VideoColorSpaceUsage.FORCE,
      selectBy: medialive.VideoSelection.byProgramId(1),
    },
  }],
  outputGroups: [
    medialive.OutputGroupConfiguration.hls({
      name: 'hls',
      destinations: [medialive.OutputDestination.toBucket(bucket, 'live/stream')],
      outputs: [{ encodes: [video], outputName: 'hls_out' }],
    }),
  ],
});
```

## Initializer

```ts
new VideoSelection()
```

## Methods

- `byPid(pid: number): VideoSelection // chainable` (static) — Extract the video with this PID.

- `byProgramId(programId: number): VideoSelection // chainable` (static) — Extract the video from this program within a multi-program transport stream.

  If the
  program doesn't exist, MediaLive selects the first program in the stream.
