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

Properties for H.264 codec settings.

Used as argument in: [VideoCodecSettings.h264](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-medialive-alpha.VideoCodecSettings.html#h264)

- Stability: [Experimental](https://docs.aws.amazon.com/cdk/api/stability.html)
- Source: [`lib/video-codec-settings.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/@aws-cdk/aws-medialive-alpha/lib/video-codec-settings.ts#L1471)

## Example

TypeScript:

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

const video = medialive.EncodeConfiguration.video({
  name: 'video_720p',
  codec: medialive.VideoCodecSettings.h264({
    rateControl: medialive.H264RateControl.cbr({ bitrate: Bitrate.mbps(3) }),
    framerate: medialive.Framerate.FPS_30,
  }),
  width: 1280,
  height: 720,
});

const audio = medialive.EncodeConfiguration.audio({
  name: 'audio_aac',
  codec: medialive.AudioCodecSettings.aac({ bitrate: Bitrate.kbps(192) }),
});

new medialive.Channel(stack, 'Channel', {
  inputs: [{ input }],
  outputGroups: [
    medialive.OutputGroupConfiguration.hls({
      name: 'hls',
      destinations: [medialive.OutputDestination.toBucket(bucket, 'live/stream')],
      outputs: [{ encodes: [video, audio], outputName: 'hls_out' }],
    }),
  ],
});
```

Python:

```python
# stack: Stack
# input: medialive.IInput
# bucket: s3.IBucket

video = medialive.EncodeConfiguration.video(
    name="video_720p",
    codec=medialive.VideoCodecSettings.h264(
        rate_control=medialive.H264RateControl.cbr(bitrate=Bitrate.mbps(3)),
        framerate=medialive.Framerate.FPS_30
    ),
    width=1280,
    height=720
)

audio = medialive.EncodeConfiguration.audio(
    name="audio_aac",
    codec=medialive.AudioCodecSettings.aac(bitrate=Bitrate.kbps(192))
)

medialive.Channel(stack, "Channel",
    inputs=[medialive.InputAttachment(input=input)],
    output_groups=[
        medialive.OutputGroupConfiguration.hls(
            name="hls",
            destinations=[medialive.OutputDestination.to_bucket(bucket, "live/stream")],
            outputs=[medialive.HlsOutputDefinition(encodes=[video, audio], output_name="hls_out")]
        )
    ]
)
```

Java:

```java
Stack stack;
IInput input;
IBucket bucket;

EncodeConfiguration video = EncodeConfiguration.video(VideoEncodeProps.builder()
        .name("video_720p")
        .codec(VideoCodecSettings.h264(H264SettingsProps.builder()
                .rateControl(H264RateControl.cbr(CbrRateControlProps.builder().bitrate(Bitrate.mbps(3)).build()))
                .framerate(Framerate.FPS_30)
                .build()))
        .width(1280)
        .height(720)
        .build());

EncodeConfiguration audio = EncodeConfiguration.audio(AudioEncodeProps.builder()
        .name("audio_aac")
        .codec(AudioCodecSettings.aac(AacSettingsProps.builder().bitrate(Bitrate.kbps(192)).build()))
        .build());

Channel.Builder.create(stack, "Channel")
        .inputs(List.of(InputAttachment.builder().input(input).build()))
        .outputGroups(List.of(OutputGroupConfiguration.hls(HlsOutputGroupProps.builder()
                .name("hls")
                .destinations(List.of(OutputDestination.toBucket(bucket, "live/stream")))
                .outputs(List.of(HlsOutputDefinition.builder().encodes(List.of(video, audio)).outputName("hls_out").build()))
                .build())))
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.AWS.MediaLive.Alpha
Stack stack;
IInput input;
IBucket bucket;

var video = EncodeConfiguration.Video(new VideoEncodeProps {
    Name = "video_720p",
    Codec = VideoCodecSettings.H264(new H264SettingsProps {
        RateControl = H264RateControl.Cbr(new CbrRateControlProps { Bitrate = Bitrate.Mbps(3) }),
        Framerate = Framerate.FPS_30
    }),
    Width = 1280,
    Height = 720
});

var audio = EncodeConfiguration.Audio(new AudioEncodeProps {
    Name = "audio_aac",
    Codec = AudioCodecSettings.Aac(new AacSettingsProps { Bitrate = Bitrate.Kbps(192) })
});

new Channel(stack, "Channel", new ChannelProps {
    Inputs = new [] { new InputAttachment { Input = input } },
    OutputGroups = new [] { OutputGroupConfiguration.Hls(new HlsOutputGroupProps {
        Name = "hls",
        Destinations = new [] { OutputDestination.ToBucket(bucket, "live/stream") },
        Outputs = new [] { new HlsOutputDefinition { Encodes = new [] { video, audio }, OutputName = "hls_out" } }
    }) }
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awsmedialivealpha/v2
var stack Stack
var input IInput
var bucket IBucket

video := medialive.EncodeConfiguration_Video(&VideoEncodeProps{
	Name: jsii.String("video_720p"),
	Codec: medialive.VideoCodecSettings_H264(&H264SettingsProps{
		RateControl: medialive.H264RateControl_Cbr(&CbrRateControlProps{
			Bitrate: awscdk.Bitrate_Mbps(jsii.Number(3)),
		}),
		Framerate: medialive.Framerate_FPS_30(),
	}),
	Width: jsii.Number(1280),
	Height: jsii.Number(720),
})

audio := medialive.EncodeConfiguration_Audio(&AudioEncodeProps{
	Name: jsii.String("audio_aac"),
	Codec: medialive.AudioCodecSettings_Aac(&AacSettingsProps{
		Bitrate: awscdk.Bitrate_Kbps(jsii.Number(192)),
	}),
})

medialive.NewChannel(stack, jsii.String("Channel"), &ChannelProps{
	Inputs: []InputAttachment{
		&InputAttachment{
			Input: *Input,
		},
	},
	OutputGroups: []OutputGroupConfiguration{
		medialive.OutputGroupConfiguration_Hls(&HlsOutputGroupProps{
			Name: jsii.String("hls"),
			Destinations: []OutputDestination{
				medialive.OutputDestination_ToBucket(bucket, jsii.String("live/stream")),
			},
			Outputs: []HlsOutputDefinition{
				&HlsOutputDefinition{
					Encodes: []EncodeConfiguration{
						video,
						audio,
					},
					OutputName: jsii.String("hls_out"),
				},
			},
		}),
	},
})
```

## Properties

- `adaptiveQuantization`: [H264AdaptiveQuantization](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-medialive-alpha.H264AdaptiveQuantization.html) = H264AdaptiveQuantization.AUTO — The adaptive quantization.

  This allows intra-frame quantizers to vary to improve visual quality.

- `afdSignaling`: [AfdSignaling](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-medialive-alpha.AfdSignaling.html) = AfdSignaling.NONE — Indicates that AFD values will be written into the output stream.

  If afdSignaling is auto, the
  system tries to preserve the input AFD value (in cases where multiple AFD values are valid). If
  set to fixed, the AFD value is the value configured in the fixedAfd parameter.

- `bufFillPct`: number — Percentage of the buffer that should initially be filled (HRD buffer model).

  **Default:** service default

- `bufSize`: number — Size of the buffer (HRD buffer model) in bits/second.

  **Default:** service default

- `colorMetadata`: [ColorMetadata](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-medialive-alpha.ColorMetadata.html) — Whether to include color space metadata in the output.

  **Default:** service default

- `colorSpaceSettings`: [H264ColorSpaceSettings](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-medialive-alpha.H264ColorSpaceSettings.html) — Color space settings for the video.

  **Default:** service default

- `entropyEncoding`: [H264EntropyEncoding](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-medialive-alpha.H264EntropyEncoding.html) — The entropy encoding mode.

  **Default:** service default

  CABAC requires Main or High profile.

- `filterSettings`: [H264FilterSettings](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-medialive-alpha.H264FilterSettings.html) — Optional video filter settings.

  **Default:** service default

- `fixedAfd`: string — Four-bit AFD value to write on all frames. Only valid when afdSignaling is FIXED.

  **Default:** service default

  Valid values: FIXED_0000, FIXED_0010, FIXED_0011, FIXED_0100, FIXED_1000,
  FIXED_1001, FIXED_1010, FIXED_1011, FIXED_1100, FIXED_1101, FIXED_1110, FIXED_1111.

- `flickerAq`: [FlickerAq](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-medialive-alpha.FlickerAq.html) = FlickerAq.ENABLED — If enabled, adjusts quantization within each frame to reduce flicker on I-frames.

- `forceFieldPictures`: [H264ForceFieldPictures](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-medialive-alpha.H264ForceFieldPictures.html) — Controls whether coding is on a field basis or frame basis when scan type is interlaced.

  **Default:** service default

- `framerate`: [Framerate](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-medialive-alpha.Framerate.html) — The video frame rate.

  **Default:** follow source

- `gopBReference`: [GopBReference](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-medialive-alpha.GopBReference.html) — If enabled, uses reference B frames for GOP structures that have B frames > 1.

  **Default:** service default

- `gopClosedCadence`: number — Frequency of closed GOPs.

  **Default:** service default

  Set to 1 for streaming so decoders joining mid-stream get an IDR frame quickly.

- `gopNumBFrames`: number — The number of B-frames between reference frames.

  **Default:** service default

- `gopSize`: [GopSize](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-medialive-alpha.GopSize.html) = GopSize.seconds(1) — The GOP size (keyframe interval).

- `level`: [H264Level](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-medialive-alpha.H264Level.html) = H264Level.H264_LEVEL_AUTO — The H.264 level.

  Valid values: H264_LEVEL_1, H264_LEVEL_1_1, H264_LEVEL_1_2, H264_LEVEL_1_3,
  H264_LEVEL_2, H264_LEVEL_2_1, H264_LEVEL_2_2, H264_LEVEL_3, H264_LEVEL_3_1,
  H264_LEVEL_3_2, H264_LEVEL_4, H264_LEVEL_4_1, H264_LEVEL_4_2, H264_LEVEL_5,
  H264_LEVEL_5_1, H264_LEVEL_5_2, H264_LEVEL_AUTO.

- `lookAheadRateControl`: [LookAheadRateControl](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-medialive-alpha.LookAheadRateControl.html) = LookAheadRateControl.HIGH — Amount of lookahead.

  Low decreases latency/memory; high can produce better quality.

- `minBitrate`: number — Minimum bitrate in bits/second.

  **Default:** service default

- `minIInterval`: number — Only meaningful if sceneChangeDetect is enabled.

  **Default:** service default

  Enforces separation between
  repeated (cadence) I-frames and I-frames inserted by scene change detection.

- `minQp`: number — Minimum QP value.

  **Default:** service default

  Sets a floor on the quantization parameter.

- `numRefFrames`: number — The number of reference frames to use.

  **Default:** service default

  The encoder might use more if B-frames or interlaced encoding is used.

- `pixelAspectRatio`: [PixelAspectRatio](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-medialive-alpha.PixelAspectRatio.html) — The pixel aspect ratio (PAR) of the video.

  **Default:** follow source (or square pixels when framerate is specified)

- `profile`: [H264Profile](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-medialive-alpha.H264Profile.html) = H264Profile.MAIN — The H.264 profile.

- `qualityLevel`: [H264QualityLevel](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-medialive-alpha.H264QualityLevel.html) — Quality level.

  **Default:** service default

  ENHANCED_QUALITY produces slightly better video without increasing bitrate.

- `rateControl`: [H264RateControl](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-medialive-alpha.H264RateControl.html) — The rate control configuration.

  **Default:** CBR with no bitrate (service default)

- `scanType`: [ScanType](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-medialive-alpha.ScanType.html) = ScanType.PROGRESSIVE — Sets the scan type of the output.

- `sceneChangeDetect`: [H264SceneChangeDetect](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-medialive-alpha.H264SceneChangeDetect.html) = H264SceneChangeDetect.ENABLED — Whether scene change detection inserts I-frames on scene changes.

- `slices`: number — Number of slices per picture.

  **Default:** encoder chooses based on resolution

  Must be <= macroblock rows (progressive) or half (interlaced).

- `softness`: number — Softness.

  **Default:** service default

  Selects a quantizer matrix; larger values reduce high-frequency content.

- `spatialAq`: [H264SpatialAq](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-medialive-alpha.H264SpatialAq.html) = H264SpatialAq.ENABLED — Whether spatial adaptive quantization adjusts quantization within each frame based on spatial variation.

- `subgopLength`: [SubgopLength](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-medialive-alpha.SubgopLength.html) — Sub-GOP length mode.

  **Default:** service default

- `syntax`: [H264Syntax](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-medialive-alpha.H264Syntax.html) = H264Syntax.DEFAULT — Produces a bitstream compliant with SMPTE RP-2027.

- `temporalAq`: [H264TemporalAq](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-medialive-alpha.H264TemporalAq.html) = H264TemporalAq.ENABLED — Whether temporal adaptive quantization adjusts quantization based on temporal variation between frames.

- `timecodeBurnin`: [TimecodeBurninSettings](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-medialive-alpha.TimecodeBurninSettings.html) — Timecode burn-in settings to overlay timecode on the video.

  **Default:** no timecode burn-in

- `timecodeInsertion`: [TimecodeInsertion](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-medialive-alpha.TimecodeInsertion.html) — Determines how timecodes are inserted into the video elementary stream.

  **Default:** service default

  This controls insertion into the output elementary stream. The channel's `timecodeConfig` controls the
  source of the timecode used for output.
