There are now new Rate control modes on the encoder. It would be great to have a sample showing how to set the CRF mode on the encoder - since that is a common ask. The CBR mode is less commonly asked for, but we have had a few customers that need it to hit a target bitrate.
CRF mode is similar to constrained VBR.
(RateControlMode setting is highlighted and its default value is H264RateControlMode.ABR)
CBR mode:
var preset = new StandardEncoderPreset
{
Codecs =
{
new AacAudio(),
new H264Video()
{
RateControlMode = H264RateControlMode.CBR,
Layers =
{
new H264Layer
{
Bitrate = 2000000,
Width = "1280",
Height = "720"
}
}
}
},
There are now new Rate control modes on the encoder. It would be great to have a sample showing how to set the CRF mode on the encoder - since that is a common ask. The CBR mode is less commonly asked for, but we have had a few customers that need it to hit a target bitrate.
CRF mode is similar to constrained VBR.
(RateControlMode setting is highlighted and its default value is H264RateControlMode.ABR)
CBR mode: var preset = new StandardEncoderPreset { Codecs = { new AacAudio(), new H264Video() { RateControlMode = H264RateControlMode.CBR, Layers = { new H264Layer { Bitrate = 2000000, Width = "1280", Height = "720" } } } },
CRF mode: var preset = new StandardEncoderPreset { Codecs = { new AacAudio(), new H264Video() { RateControlMode = H264RateControlMode.CRF, Layers = { new H264Layer { Crf = 28, Bitrate = 2000000, Width = "1280", Height = "720" } } } },
Formats = { new Mp4Format { FilenamePattern = "{Basename}_{Bitrate}{Extension}" } } }