Skip to content
v2.278.0

Experimental

@aws-cdk/aws-medialive-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

H264SettingsProps Struct ​

Properties for H.264 codec settings.

Example ​

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
# 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
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();
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" } }
    }) }
});
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 ​

adaptiveQuantizationoptionalH264AdaptiveQuantizationadaptive_quantizationoptionalH264AdaptiveQuantizationadaptiveQuantizationoptionalH264AdaptiveQuantizationAdaptiveQuantizationoptionalH264AdaptiveQuantizationAdaptiveQuantizationoptionalH264AdaptiveQuantization = H264AdaptiveQuantization.AUTO #
The adaptive quantization.

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

afdSignalingoptionalAfdSignalingafd_signalingoptionalAfdSignalingafdSignalingoptionalAfdSignalingAfdSignalingoptionalAfdSignalingAfdSignalingoptionalAfdSignaling = 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.

bufFillPctoptionalnumberbuf_fill_pctoptionalint | floatbufFillPctoptionalNumberBufFillPctoptionaldoubleBufFillPctoptional*float64 #
Percentage of the buffer that should initially be filled (HRD buffer model).

Default: service default

bufSizeoptionalnumberbuf_sizeoptionalint | floatbufSizeoptionalNumberBufSizeoptionaldoubleBufSizeoptional*float64 #
Size of the buffer (HRD buffer model) in bits/second.

Default: service default

colorMetadataoptionalColorMetadatacolor_metadataoptionalColorMetadatacolorMetadataoptionalColorMetadataColorMetadataoptionalColorMetadataColorMetadataoptionalColorMetadata #
Whether to include color space metadata in the output.

Default: service default

colorSpaceSettingsoptionalH264ColorSpaceSettingscolor_space_settingsoptionalH264ColorSpaceSettingscolorSpaceSettingsoptionalH264ColorSpaceSettingsColorSpaceSettingsoptionalH264ColorSpaceSettingsColorSpaceSettingsoptionalH264ColorSpaceSettings #
Color space settings for the video.

Default: service default

entropyEncodingoptionalH264EntropyEncodingentropy_encodingoptionalH264EntropyEncodingentropyEncodingoptionalH264EntropyEncodingEntropyEncodingoptionalH264EntropyEncodingEntropyEncodingoptionalH264EntropyEncoding #
The entropy encoding mode.

Default: service default

CABAC requires Main or High profile.

filterSettingsoptionalH264FilterSettingsfilter_settingsoptionalH264FilterSettingsfilterSettingsoptionalH264FilterSettingsFilterSettingsoptionalH264FilterSettingsFilterSettingsoptionalH264FilterSettings #
Optional video filter settings.

Default: service default

fixedAfdoptionalstringfixed_afdoptionalstrfixedAfdoptionalStringFixedAfdoptionalstringFixedAfdoptional*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.

flickerAqoptionalFlickerAqflicker_aqoptionalFlickerAqflickerAqoptionalFlickerAqFlickerAqoptionalFlickerAqFlickerAqoptionalFlickerAq = FlickerAq.ENABLED #
If enabled, adjusts quantization within each frame to reduce flicker on I-frames.
forceFieldPicturesoptionalH264ForceFieldPicturesforce_field_picturesoptionalH264ForceFieldPicturesforceFieldPicturesoptionalH264ForceFieldPicturesForceFieldPicturesoptionalH264ForceFieldPicturesForceFieldPicturesoptionalH264ForceFieldPictures #
Controls whether coding is on a field basis or frame basis when scan type is interlaced.

Default: service default

framerateoptionalFramerateframerateoptionalFramerateframerateoptionalFramerateFramerateoptionalFramerateFramerateoptionalFramerate #
The video frame rate.

Default: follow source

gopBReferenceoptionalGopBReferencegop_b_referenceoptionalGopBReferencegopBReferenceoptionalGopBReferenceGopBReferenceoptionalGopBReferenceGopBReferenceoptionalGopBReference #
If enabled, uses reference B frames for GOP structures that have B frames > 1.

Default: service default

gopClosedCadenceoptionalnumbergop_closed_cadenceoptionalint | floatgopClosedCadenceoptionalNumberGopClosedCadenceoptionaldoubleGopClosedCadenceoptional*float64 #
Frequency of closed GOPs.

Default: service default

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

gopNumBFramesoptionalnumbergop_num_b_framesoptionalint | floatgopNumBFramesoptionalNumberGopNumBFramesoptionaldoubleGopNumBFramesoptional*float64 #
The number of B-frames between reference frames.

Default: service default

gopSizeoptionalGopSizegop_sizeoptionalGopSizegopSizeoptionalGopSizeGopSizeoptionalGopSizeGopSizeoptionalGopSize = GopSize.seconds(1) #
The GOP size (keyframe interval).
leveloptionalH264LevelleveloptionalH264LevelleveloptionalH264LevelLeveloptionalH264LevelLeveloptionalH264Level = H264Level.H264_LEVEL_AUTO #
The H.264 level.
notes

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.

lookAheadRateControloptionalLookAheadRateControllook_ahead_rate_controloptionalLookAheadRateControllookAheadRateControloptionalLookAheadRateControlLookAheadRateControloptionalLookAheadRateControlLookAheadRateControloptionalLookAheadRateControl = LookAheadRateControl.HIGH #
Amount of lookahead.

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

minBitrateoptionalnumbermin_bitrateoptionalint | floatminBitrateoptionalNumberMinBitrateoptionaldoubleMinBitrateoptional*float64 #
Minimum bitrate in bits/second.

Default: service default

minIIntervaloptionalnumbermin_i_intervaloptionalint | floatminIIntervaloptionalNumberMinIIntervaloptionaldoubleMinIIntervaloptional*float64 #
Only meaningful if sceneChangeDetect is enabled.

Default: service default

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

minQpoptionalnumbermin_qpoptionalint | floatminQpoptionalNumberMinQpoptionaldoubleMinQpoptional*float64 #
Minimum QP value.

Default: service default

Sets a floor on the quantization parameter.

numRefFramesoptionalnumbernum_ref_framesoptionalint | floatnumRefFramesoptionalNumberNumRefFramesoptionaldoubleNumRefFramesoptional*float64 #
The number of reference frames to use.

Default: service default

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

pixelAspectRatiooptionalPixelAspectRatiopixel_aspect_ratiooptionalPixelAspectRatiopixelAspectRatiooptionalPixelAspectRatioPixelAspectRatiooptionalPixelAspectRatioPixelAspectRatiooptionalPixelAspectRatio #
The pixel aspect ratio (PAR) of the video.

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

profileoptionalH264ProfileprofileoptionalH264ProfileprofileoptionalH264ProfileProfileoptionalH264ProfileProfileoptionalH264Profile = H264Profile.MAIN #
The H.264 profile.
qualityLeveloptionalH264QualityLevelquality_leveloptionalH264QualityLevelqualityLeveloptionalH264QualityLevelQualityLeveloptionalH264QualityLevelQualityLeveloptionalH264QualityLevel #
Quality level.

Default: service default

ENHANCED_QUALITY produces slightly better video without increasing bitrate.

rateControloptionalH264RateControlrate_controloptionalH264RateControlrateControloptionalH264RateControlRateControloptionalH264RateControlRateControloptionalH264RateControl #
The rate control configuration.

Default: CBR with no bitrate (service default)

scanTypeoptionalScanTypescan_typeoptionalScanTypescanTypeoptionalScanTypeScanTypeoptionalScanTypeScanTypeoptionalScanType = ScanType.PROGRESSIVE #
Sets the scan type of the output.
sceneChangeDetectoptionalH264SceneChangeDetectscene_change_detectoptionalH264SceneChangeDetectsceneChangeDetectoptionalH264SceneChangeDetectSceneChangeDetectoptionalH264SceneChangeDetectSceneChangeDetectoptionalH264SceneChangeDetect = H264SceneChangeDetect.ENABLED #
Whether scene change detection inserts I-frames on scene changes.
slicesoptionalnumberslicesoptionalint | floatslicesoptionalNumberSlicesoptionaldoubleSlicesoptional*float64 #
Number of slices per picture.

Default: encoder chooses based on resolution

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

softnessoptionalnumbersoftnessoptionalint | floatsoftnessoptionalNumberSoftnessoptionaldoubleSoftnessoptional*float64 #
Softness.

Default: service default

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

spatialAqoptionalH264SpatialAqspatial_aqoptionalH264SpatialAqspatialAqoptionalH264SpatialAqSpatialAqoptionalH264SpatialAqSpatialAqoptionalH264SpatialAq = H264SpatialAq.ENABLED #
Whether spatial adaptive quantization adjusts quantization within each frame based on spatial variation.
subgopLengthoptionalSubgopLengthsubgop_lengthoptionalSubgopLengthsubgopLengthoptionalSubgopLengthSubgopLengthoptionalSubgopLengthSubgopLengthoptionalSubgopLength #
Sub-GOP length mode.

Default: service default

syntaxoptionalH264SyntaxsyntaxoptionalH264SyntaxsyntaxoptionalH264SyntaxSyntaxoptionalH264SyntaxSyntaxoptionalH264Syntax = H264Syntax.DEFAULT #
Produces a bitstream compliant with SMPTE RP-2027.
temporalAqoptionalH264TemporalAqtemporal_aqoptionalH264TemporalAqtemporalAqoptionalH264TemporalAqTemporalAqoptionalH264TemporalAqTemporalAqoptionalH264TemporalAq = H264TemporalAq.ENABLED #
Whether temporal adaptive quantization adjusts quantization based on temporal variation between frames.
timecodeBurninoptionalTimecodeBurninSettingstimecode_burninoptionalTimecodeBurninSettingstimecodeBurninoptionalTimecodeBurninSettingsTimecodeBurninoptionalTimecodeBurninSettingsTimecodeBurninoptionalTimecodeBurninSettings #
Timecode burn-in settings to overlay timecode on the video.

Default: no timecode burn-in

timecodeInsertionoptionalTimecodeInsertiontimecode_insertionoptionalTimecodeInsertiontimecodeInsertionoptionalTimecodeInsertionTimecodeInsertionoptionalTimecodeInsertionTimecodeInsertionoptionalTimecodeInsertion #
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.