Encoding Parameters
level
Sets the level for encoding. If level=0 the encoder will automatically determine the level based on picture size, frame rate and bitrate. If specified, the level will be used.
When a non-zero level is specified, the encoder will use it regardless of the encoder parameters.
| Not Applicable | JPEG |
| Supported Values | Decimal values from 0 to 9.9 in 0.1 increments H.264 levels: - 1, 1.1, 1.2, 1.3, - 2, 2.1, 2.2, - 3, 3.1, 3.2, - 4, 4.1, 4.2, - 5, 5.1, 5.2, - 6, 6.1, 6.2 H.265 levels: - 1, 2, 2.1, - 3, 3.1, - 4, 4.1, - 5, 5.1, 5.2, - 6, 6.1, 6.2 AV1 levels: - 2.0, 2.1, - 3.0, 3.1, - 4.0, 4.1, - 5.0, 5.1, 5.2, 5.3 - 6.0, 6.1, 6.2, 6.3 |
| Default | 0 |
profile
Sets the profile for encoding. The valid profiles for H.264 and H.265 are shown below.
Any profile can be used for 8 bit encoding, but only the 10 bit profiles (main10 for H.265 and high10 for h.264) may be used for 10 bit encoding.
For the H.264 baseline, the GOP must not contain any B frames, therefore the only supported values for gopPresetIdx are 1, 9, 10 or 0 (custom GOP with picType != 3)
| Not Applicable | JPEG |
| Supported Values | H.265: - 1=main (8 bit default) - 2= main10 (10 bit default) H.264: - 1=baseline (not compatible with B frames) - 2=main - 4=high (8 bit default) - 5= high10 (10 bit default) AV1: - 1=main (8 bit and 10 bit default) |
| Default | H.265: - 1=main (8 bit default) - 2= main10 (10 bit default) H.264: - 4=high (8 bit default) - 5= high10 (10 bit default) AV1: - 1=main (8 bit and 10 bit default) |
high-tier
Sets the tier for AV1 and H.265 encoding.
High tier only takes effect if the current level supports it.
| Not Applicable | - JPEG - H.264 - Rejected when high-tier=1, ignored otherwise |
| Supported Values | - 0: Main tier - 1: High tier |
| Default | - 0 for H.265 - 1 for AV1 |
av1OpLevel
Specifies level for each AV1 operating point. This parameter takes up to 4 integer (E.g. 51 for level 5.1) or decimal values separated by commas, each value indicating the level for an operating point, starting from operating 0 to the highest. When this parameter is not specified or set to 0, firmware will automatically determine the level for each AV1 operating point.
This parameter is generally used only for AV1 spatial layers encoding. When this parameter is specified, the number of comma separated values must match with the number of spatial layers specified by spatialLayers parameter. A sample ffmpeg command is as follows:
ffmpeg -loglevel info -vsync 0 -i base_layer.mp4 -i enhancement_layer.mp4 -filter_complex "[0:v][1:v]interleave=2" -r 50 -c:v av1_ni_quadra_enc -xcoder-params "spatialLayers=2:spatialLayersRefBaseLayer=1:RcEnable=1:spatialLayerBitrate=10000000,1000000:av1OpLevel=5.0,5.1:intraPeriod=120" -y out.mp4
this parameter cannot be used in conjunction with level
| Not Applicable | H.264, H.265, JPEG |
| Supported Values | AV1 levels: - 2.0, 2.1, - 3.0, 3.1, - 4.0, 4.1, - 5.0, 5.1, 5.2, 5.3 - 6.0, 6.1, 6.2, 6.3 |
| Default | 0: Encoder automatically determines the level |
hrdEnable
Enable hypothetical reference decoder (HRD) compliance.
When enabled this parameter will:
- Update the HRD parameters in the VUI
- Send the pic timing sei messages in the bitstream
- Send the buffering period sei messages in the bitstream
- Automatically set RcEnable = 1 if RcEnable is not already enabled
hrdEnable is automatically enabled when dolbyVisionProfile = 5
Please note that encoder cannot guarantee HRD conformance when multicoreJointMode is set to 1, so it is recommended not to enable multicoreJointMode when strict adherence to HRD conformance is required
Please note that currently Quadra does not support HRD conformance for multi layered encoding. Therefore, it is not allowed to set temporalLayersEnable to 1 when HRD conformance is enabled
| Not Applicable | JPEG and AV1 |
| Supported Values | - 0: Disable - 1: Enable |
| Default | 0: Disable |
enableAUD
Specifies whether to include Access Unit Delimiters (AUD) or not.
Required For:
AUDs are required for DolbyVision compatibility, or when placing bitstreams in transport streams.
| Not Applicable | JPEG and AV1 |
| Supported Values | - 0: Disable - 1: Enable |
| Default | 0: Disable |
dolbyVisionProfile
Configures the Netint encoder as a 3rd party encoder with the Dolby Encoding Engine. Overrides VUI colour parameters as per DolbyVision profile 5 requirements (video_format=1 (full-range), colour_primaries=transfer_characteristics=matrix_coeffs=2 (unspecified), chroma_loc_info_present_flag=0) and enables AUD and HRD.
When dolbyVisionProfile is enabled:
- Automatically set RcEnable = 1
- Automatically set hrdEnable = 1
- Automatically set default vbvBufferSize = 3000
- Automatically set enableAUD = 1
| Applicable | - H.265 only - FFmpeg version 4.3.1 and above |
| Not Applicable | - JPEG, AV1 and H.264 - FFmpeg version 4.2.1 and earlier |
| Supported Values | - 0 - 5 |
| Default | 0: Disabled |
maxCLL
Specifies parameters for HDR Content Light Level Info as per CEA 861.3. Specified as a string with format “%hu,%hu” where %hu are unsigned 16 bit integers. The first value is the maximum content light level (or 0 if no maximum is indicated), the second value is the maximum picture average light level (or 0). For example, for MaxCLL=1000 nits, MaxFALL=400 nits: max-cll =“1000,400”. Note that this string value will need to be escaped or quoted to protect against shell expansion on many platforms. When this parameter is specified, it will be used in preference to content light level info side data of FFmpeg AVFrame.
| Not Applicable | JPEG and AV1 |
| Default: | None – Use side data values if present |
masterDisplay
Specifies parameters for the HDR Mastering Display Colour Volume SEI as per SMPTE ST 2086. Specified as a string with format: “G(%hu,%hu)B(%hu,%hu)R(%hu,%hu)WP(%hu,%hu)L(%u,%u)” where %hu are unsigned 16bit integers and %u are unsigned 32bit integers. The SEI includes X,Y display primaries for RGB channels and white point (WP) in units of 0.00002 and max,min luminance (L) values in units of 0.0001 nits
For example for a P3D65 1000-nits monitor, where
G(x=0.265, y=0.690), B(x=0.150, y=0.060), R(x=0.680, y=0.320), WP(x=0.3127, y=0.3290), L(max=1000, min=0.0001): “G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,1)”
Note that this string value will need to be escaped or quoted to protect against shell expansion on many platforms. When this parameter is specified, it will be used in preference to mastering display info side data of FFmpeg AVFrame.
| Not Applicable | JPEG and AV1 |
| Default | None – Use side data values if present |
enableAllSeiPassthru
All custom SEI types will be passed through if this is enabled. Also, when enabled, the firmware SEI will be disabled.
If the enableAllSeiPassthru parameter is enabled (set to 1) for decoding, then the enableAllSeiPassthru parameter for encoding must also be enabled (set to 1).
| Supported Values | - 0: Disable - 1: Enable |
| Default | 0 |
useLowDelayPocType
When enabled, the encoder will use picture_order_count_type=2 in the H.264 SPS, this tells the decoders all frames are in sequence, this typically results in a lower decoding delay. This feature is only supported for H.264 when all frames are reference frames, i.e, when using gop presets gopPresetIdx=1, 3, 7, and 9. For custom gop (gopPresetIdx 0), this feature is only supported for custom gop size 1. By default, this feature is disabled, and the encoder uses picture_order_count_type=0, which is compatible with all gops.
| Not Applicable | JPEG, H265, and AV1 |
| Supported Values | - 0: Disable - 1: Enable |
| Default | 0: Disabled |
confWinTop
Conformance top window size. This is the number of pixel rows at the top of the picture that should not be displayed when decoding. This is in addition to any cropping info that may already be included on the AVFrame to be encoded.
| Not Applicable | AV1 and JPEG |
| Supported Values | 0 to 8192 |
| Default | 0 |
confWinBot
Conformance bottom window size. This is the number of pixel rows at the bottom of the picture that should not be displayed when decoding. This is in addition to any cropping info that may already be included on the AVFrame to be encoded.
| Not Applicable | AV1 and JPEG |
| Supported Values | 0 to 8192 |
| Default | 0 |
confWinLeft
Conformance left window size. This is the number of pixel columns at the left side of the picture that should not be displayed when decoding. This is in addition to any cropping info that may already be included on the AVFrame to be encoded
| Not Applicable | AV1 and JPEG |
| Supported Values | 0 to 8192 |
| Default | 0 |
confWinRight
Conformance right window size. This is the number of pixel columns at the right side of the picture that should not be displayed when decoding. This is in addition to any cropping info that may already be included on the AVFrame to be encoded
| Not Applicable | AV1 and JPEG |
| Supported Values | 0 to 8192 |
| Default | 0 |
repeatHeaders
Specifies whether the encoder repeats the VPS/SPS/PPS headers on all I frames. Or if intra refresh is enabled, headers are repeated on P frames at IntraRefreshMinPeriod.
For HDR/HDR10+ streams, the static HDR SEIs (content light level info, mastering display colour volume, and alternative transfer characterics) if present are also repeated. Repeated headers permit a bitstream to be decoded mid-stream. It also provides error resilience, in case packets were lost during transmission.
| Not Applicable | AV1 and JPEG |
| Supported Values | - 0: disable - 1: enable |
| Default | 1: enable |
prefTRC
Specifies the HLG preferred transfer characteristics value. If this parameter is present, the encoder will include an alternative transfer characteristics metadata in the bitstream with the preferred transfer characteristics field set to the value of this parameter. If the parameter is not present, the SEI will not be present. The alternative transfer characteristics metadata is required by ETSI for HLG and specifies an alternative transfer characteristic from that provided in the VUI.
| Not Applicable | JPEG |
| Supported Values | 0 to 255 |
| Default | Alternative Transfer Characteristics metadata is not present |
sliceMode
Enable multi-slice encoding. Must be used in conjunction with parameter sliceArg.
| Not Applicable | JPEG and AV1 |
| Supported Values | - 0: single slice per frame - 1: multiple slices per frame |
| Default | 0 |
sliceArg
If sliceMode is enabled, this represents the number of CTU/MB rows in each slice. Value must be between 1 and number of CTU/MB rows in the picture. The number of rows is calculated by height/64 (H.265) or by height/16 (H.264).
sliceNum is number of slices in one frame.
sliceNum = (ctbPerCol + sliceArg - 1) / sliceArg.
need to keep sliceNum < = 256, if sliceNum > 256, sliceArg will increase one automatically until sliceNum < = 256
| Not Applicable | JPEG and AV1 |
| Supported Values | 1 to minimum value between number of CTU/MB rows and 127 |
| Default | 0 (invalid) |
entropyCodingMode
Selects the entropy coding mode used in the encoding process. Note that CABAC is only compatible with H.264 Main, High, and High10 profiles and is disabled for other profiles.
| Not Applicable | JPEG, AV1, and H.265 |
| Supported Values | - 0: CAVLC - 1: CABAC |
| Default | 1 |
framerate
The numerator of the frame rate. This works in conjunction with frameRateDenom to support fractional framerates. The frameRate is used by the encoder for rate control (when enabled) and to set the VUI timing information. If not specified, the frameRate passed in from FFmpeg (or 3rd party application) is used. This parameter is intended for integrating directly with libxcoder.
| Supported Values | 1 to 216-1 |
| Default | FFmpeg Value |
frameRateDenom
The encoder frame rate denominator that supports fraction frame rate together with frameRate. The frame rate would then be frameRate / frameRateDenom, e.g. frameRate=30000 and frameRateDenom=1001 represents frame rate of 30000/1001=29.97. This parameter is intended for integrating directly with libxcoder.
| Supported Values | 1 to 216-1 |
| Default | FFmpeg Value |
colorPri
Specifies one of the VUI color description parameters: color_primaries. The supported values are defined as AVColorPrimaries in FFmpeg, and ni_color_primaries_t in libxcoder. If colorPri, colorTrc, or colorSpc is not equal to 2 (unspecified), the relevant VUI parameters are added to the sequence header.
| Not Applicable | JPEG |
| Supported Values | 0-12, 22 |
| Default | FFmpeg value |
colorTrc
Specifies one of the VUI color description parameters: transfer_characteristics. The supported values are defined as AVColorTransferCharacteristic in FFmpeg, and ni_color_transfer_characteristic_t in libxcoder. If colorPri, colorTrc, or colorSpc is not equal to 2 (unspecified), the relevant VUI parameters are added to the sequence header.
| Not Applicable | JPEG |
| Supported Values | 0-18 |
| Default | FFmpeg value |
colorSpc
Specifies one of the VUI color description parameters: matrix_coeffs. The supported values are defined as AVColorSpace in FFmpeg, and ni_color_space_t in libxcoder. If colorPri, colorTrc, or colorSpc is not equal to 2 (unspecified), the relevant VUI parameters are added to the sequence header.
| Not Applicable | JPEG |
| Supported Values | 0-14 |
| Default | FFmpeg value |
sarNum, sarDenom
Specifies the VUI sample aspect ratio aspect_ratio_idc, as sarNum : sarDenom. When sarNum is 0, aspect_ratio_idc is not included in VUI. When sarNum is greater than 0, the aspect_ratio_idc is included in VUI. This parameter is intended for integrating directly with libxcoder.
A user must use the matching sarNum and sarDenom to the actual picture. Otherwise, there will be a discrepancy between the value in the VUI and the actual.
| Not Applicable | JPEG,AV1 |
| Supported Values | 0-65535 |
| Default | FFmpeg value |
videoFullRangeFlag
Specifies the VUI video_full_range_flag parameter value. When it is 1, the relevant VUI parameters are added to the sequence header.
A user must use the matching value to the actual picture. Otherwise, there will be a discrepancy between the value in the VUI and the actual.
| Not Applicable | JPEG |
| Supported Values | 0 or 1 |
| Default | FFmpeg value |
av1ErrorResilientMode
Specifies whether AV1 error resilient mode is enabled. AV1 error resilient mode allows the syntax of a frame to be parsed independently of previously decoded frames. Note that enabling AV1 error resilient mode may reduce compression efficiency. Also note that error resilient mode is only applicable to AV1, enabling this mode has no effect on other codecs.
Please note that enabling AV1 error resilient mode may reduce compression efficiency. Our test results showed that enabling AV1 error resilient mode can cause up to more than 5% of BD rate loss, and the average BD rate loss is around ~2.42%
| Not Applicable | JPEG, H.264, and H.265 |
| Supported Values | - 0: Disable - 1: Enable |
| Default | 0: Disabled |
disableAv1TimingInfo
By default, Quadra AV1 encoder signals timing info (refer to AV1 spec 5.5.3 Timing info syntax) in sequence header. When timing info is present, AV1 decoder model will assume default parameters (refer to AV1 spec E.3.1 Resource availability mode). This may cause decoders or video analyzing tools to report decoder model conformance issues, if the encoder rate control mode is not CBR mode, or if the rate control bitrate and buffer size settings are not confined to match with decoder model default parameters.
To avoid decoder model conformance issues, the user may set disableAv1TimingInfo to 1 to disable timing info. The downside of disabling timing info is that framerate information will not be available in the sequence header. However, this typically causes no harm since AV1's minimum viable format—the IVF container—provides framerate signaling, as do all multimedia containers like MP4 and AVI.
| Not Applicable | JPEG, H.264, and H.265 |
| Supported Values | - 0: Enable AV1 timing info - 1: Disable AV1 timing info |
| Default | 0: Enable AV1 timing info |
temporalLayersEnable
Enables temporal scalability with SVC (Scalable Video Coding). When enabled, temporal layers related syntax is added to bitstream. For temporal IDs assignments for each preset gop pattern, please refer to section 8.4.3.2 - Pre-defined GOP Structure.
For custom gop pattern (gopPresetIdx 0), SVC temproal layers syntax is added to bitstream when temporal IDs specified in Custom Gop Parameters (xcoder-gop) are greater than 0, regardless of temporalLayersEnable. Please refer to section 8.4.3.1 - Custom Gop Structure for information regarding Custom Gop Parameters
Please note that currently Quadra does not support HRD conformance for multi layered encoding. Therefore, it is not allowed to set temporalLayersEnable to 1 when HRD conformance is enabled by hrdEnable parameter
| Not Applicable | JPEG |
| Supported Values | - 0: Disabled - 1: Enabled |
| Default | 0: Disabled |
ppsInitQp
Specifies h.264 pic_init_qp_minus26 or h.265 init_qp_minus26 in Picture Parameter Sets. When specified, every Picture Parameter Set in the h.264 or h.265 bitstream will signal the specified ppsInitQp value for init_qp_minus26 syntax - instead of setting init_qp_minus26 according to the initial QP value decided by firmware, which is the default behavior when user does not specify ppsInitQP.
When ppsInitQp parameter is not specified, firmware sets PPS init_qp_minus26 according to the initial QP, which is automatically decided by the firmware
ppsInitQp parameter is not applicable to AV1 and JPEG
| Not Applicable | AV1 and JPEG |
| Supported Values | 0 to 51 |
| Default | FW automatically decided initial QP value |
spatialLayers
Specifies the number of spatial layers in AV1 encoding. Setting spatialLayers > 1 enables AV1 spatial scalability with multiple spatial layers. Quadra supports up to 4 spatial layers.
Please note that Quadra does not support spatial layers with different resolutions, all spatial layers must have the same resolution. Also, Quadra expects input frames to be in spatial layers order. For example, first input frame is in Base Layer, second input frame is in Enhancement Layer 1, third input frame is in Enhancement Layer 2, and so on
Please note that resolution change is not supported when encoding multiple spatial layers. For example, transitioning from 1080p to 720p is not allowed in multi-spatial-layer encode.
When AV1 spatial scalability is enabled (by setting spatialLayers > 1), cross layers referencing is enabled, and the reference hierarchy or gop pattern is no longer decided by gopPresetIdx; therefore, specifying gopPresetIdx with multiple spatialLayers is prohibited. By default, each EL (Enhancement Layer) frame refers to the frame one layer lower. If spatialLayersRefBaseLayer is set to 1, each EL frame will refer to the BL (Base Layer) frame instead of the lower layer frame. Please refer to section “8.4.3.4 - AV1 Spatial Layers Gop Patterns” for illustrations of cross layer reference hierarchies when AV1 spatial scalability is enabled.
There are 2 rate control methods available to spatial layers – (1) The first method is to configure the combined bitrate of all layers by bitrate parameter. For example, bitrate=5000000 allows all layers to produce up to 5Mbps (2) The second method is to configure the bitrate of each layer separately by spatialLayerBitrate parameter, please refer to spatialLayerBitrate parameter descriptions for more details as well as a sample command string
When spatialLayers \ > 1, intraPeriod represents number of temporal units count instead of number of frames. For example, when encoding with 4 spatial layers, each temporal unit includes 4 frames. Assuming framerate is 60, there will be 60 temporal units or 240 frames per second. In this case, setting intraPeriod 60 will cause a key frame to be inserted every second in the base layer. Also, same as in single layer encoding, intraPeriod is 120 by default. If no key frame interval is required, intraPeriod must be specified to 0.
Encoding with multiple spatial layers causes higher VPU load due the increased number of frames to be encoded per second. To improve performance and reduce latency, it is recommended to enable multicoreJointMode in multi-spatial layers encoding to utilize all VPU cores simultaneously
Lookahead is supported when encoding with multiple spatial layers. Please refer to lookaheadDepth parameter descriptions for more information
| Not Applicable | H.264, H.265, JPEG |
| Supported Values | 1 ~ 4: Support up 4 spatial layers. Set 1 to disable AV1 spatial scalability, \ > 1 to enable AV1 spatial scalability |
| Default | 1: AV1 spatial scalability disabled |
spatialLayersRefBaseLayer
When spatialLayersRefBaseLayer is enabled, each EL (Enhancement Layer) frame will refer to the BL (Base Layer) frame instead of the lower layer frame. Please refer to section “8.4.3.4 - AV1 Spatial Layers Gop Patterns” for illustrations of cross layer reference hierarchies when spatialLayersRefBaseLayer is enabled.
spatialLayersRefBaseLayer only takes effects when spatialLayers is greater than 2
| Not Applicable | H.264, H.265, JPEG |
| Supported Values | 0: Disable. When disabled, each Enhancement Layer frame references the lower layer frame 1: Enable. When enabled, each Enhancement Layer frame references the Base layer frame |
| Default | 0: Disabled |
spatialLayerBitrate
Specifies the target bitrate of each AV1 spatial layer. This parameter takes up to 4 integer values separated by commas. When this parameter is specified, the rate control of each AV1 spatial layer is separated from each other and each conforms to its own target bitrate as specified with this parameter. This can guarantee that the base layer always remains the same when it’s encoded with different enhancement layers, as long as the encoding parameters are the same. This parameter can also be used in conjunction with spatialLayers=1 (single layer encoding), which alters single layer rate control and gop structure to match with the base layer of a multi-layers bitstream. When this parameter is specified, the number of comma separated values must match with the number of spatial layers. Also note that when this parameter is specified, the bitrate parameter will not take effects. A sample FFmpeg command is as follows:
ffmpeg -vsync 0 -i base_layer.mp4 -i enhancement_layer_1.mp4 -i enhancement_layer_2.mp4 -i enhancement_layer_3.mp4 -filter_complex "[0:v][1:v][2:v][3:v]interleave=4" -r 60 -c:v av1_ni_quadra_enc -xcoder-params rcEnable=1:bitrateMode=1:vbvBufferSize=2000:cuLevelRCEnable=1:intraPeriod=60:spatialLayers=4:spatialLayersRefBaseLayer=1:spatialLayerBitrate=5000000,2000000,1500000,1000000 out.mp4
As shown in the example command above, the first value (5000000) is the target bitrate for base layer, the second value (2000000) is the target bitrate for the first enhancement layer, and so on for the second and third enhancement layers.
spatialLayerBitrate supports CBR, ABR, CRF and Capped CRF rate control modes
The following features are not supported when this parameter is used:
- dynamic encoder parameter reconfiguration (e.g. reconfDemoMode) NOTE – when spatialLayerBitrate is used in conjunction with spatialLayers=1 (single layer encoding) to produce output matching with the base layer of a multi spatial layer bitstream
- the single layer encoding gop pattern is no longer decided by gopPresetIdx; therefore, specifying gopPresetIdx is prohibited
- in case the multi spatial layer bitstream to match with was encoded with multicoreJointMode, the single layer encoding must additionally set av1ErrorResilientMode to produce output matching with the base layer of the multi spatial layer bitstream
| Not Applicable | H.264, H.265, JPEG |
| Supported Values | The range of valid bitrate value for each spatial layer is 10000 to 800000000 |
| Default | 0 for all spatial layers, meaning that the rate control of spatial layers is not separated |
enableTimecode
When enabled, set the pic_struct_present flag in VUI to 1. This is needed for properly inserting timecode data into the picture timing SEI in H264. See section 6.6.7.6 in the libxcoder API integration guide for more details on how to insert timecode data into SEI.
This option should only be enabled when the ni_enc_insert_timecode function (from ni_av_codec.h in libxcoder) is called to insert timecode data in SEI for each frame. If only enabling this option, the pic_struct_present flag in VUI will be set to 1 but there won’t be any pic_timing SEI added. On the other hand, if only ni_enc_insert_timecode function is called, pic_timing SEI will be added but the pic_struct_present flag in VUI will remain 0, which will cause the timecode data in pic_timing SEI to be ignored.
This option is only valid for H264. It does not have any effect when using other codecs.
| Not Applicable | H265, AV1 and JPEG |
| Supported Values | - 0: Disable - 1: Enable |
| Default | 0: Disable |
avccHvcc
When this flag is disabled, the encoder produces a byte stream where NALUs are sent sequentially, as specified by Annex B. Each NALU is preceded by a Start Code Prefix, which is not allowed to appear within the NALU itself.
When it is enabled, the firmware encoder generates the bitstream in AVCC/HVCC. The encoder generates [Codec]DecoderConfigurationBox followed by NALUs, where [Codec] can be either ‘AVC’ or ‘HEVC’. Refer to the table below for the syntax details. Each NALU, following this configuration box, is preceded by its length rather than a Start Code Prefix.
| Field of Box | Description | Length |
|---|---|---|
| size | Length of the whole box including ‘size’ field | 4 bytes |
| type | ‘avcC’ or ‘hvcC’ | 4 bytes |
| [Codec]DecoderConfigurationRecord | Refer to ISO 14496-15 | variable |
The primary purpose of this option is to facilitate the construction of bitstream within a container, such as MP4, without the need to convert from AnnexB to AVCC/HVCC. It is important to note that the generated bitstream is not final and requires further processing into a container.
This option is applicable only for generating elementary stream formats of H.264 and H.265. When using an FFMPEG command-line operation, it is essential to use 'h264' or 'h265' and avoid using container file extensions in the output file name.
This option is not supported on FFmpeg 7.1, FFmpeg 7.1.3, FFmpeg 8.0.1 and FFmpeg-n8.1.
| Not Applicable | AV1 and JPEG |
| Supported Values | - 0: Disable - 1: Enable |
| Default | 0: Disabled |
clearRefListModification
Clears ref_pic_list_modification_flag_l0 in H.264 P-slice headers and removes the associated reference-picture-list reordering commands. Only the slice header is rewritten; the coded slice data is left unchanged. This produces P slices that use the default reference-picture-list ordering.
This option modifies only H.264 P slices; B slices and all other slice types are left untouched. It is safe to use when each P slice uses a single reference picture, so that the reordering commands are redundant (they reproduce the default reference-picture list) and clearing them does not change how the stream decodes. Do not enable it for streams that use P slices with multiple reference pictures or long-term references, as removing the reordering may change which reference each P-slice macroblock predicts from and corrupt the decoded output.
When entropyCodingMode is 0 (CAVLC), the slice data is bit-shifted to close the gap left by the removed commands; when it is 1 (CABAC), the byte-aligned slice data is copied unchanged.
| Not Applicable | H265, AV1 and JPEG |
| Supported Values | - 0: Disable - 1: Enable (clear ref_pic_list_modification_flag_l0 in P slices) |
| Default | 0: Disabled |
Libxcoder Application Features
lowDelay
Specifies whether or not to enable the low latency mode in encoding. When enabled, libxcoder increases its rate of polling the encoder and only permits buffering of a single frame to minimize the delay.
That when enabled, the gopPresetIdx must be 1, 3, 7, 9, 10, or 0 with a consecutive order gop pattern, lookaheadDepth must be 0, and multicoreJointMode must be 0.
That in libxcoder encoder send/receive multi-thread mode, when enabled, its value can be a positive integer value in milliseconds for threads synchronization. It represents the time the sending thread waits before deciding it’s in a deadlock and has to continue without waiting for receiving thread to signal.
| Not Applicable | JPEG |
| Supported Values | - 0: disable - Positive integer: enable |
| Default | 0: disable |
minFramesDelay
Specifies whether to enable the minimum encoding delay frames feature. When enabled, libxcoder increases its rate of polling the encoder and only permits buffering of the minimum frames to minimize the delay.
The minimum encoding delay frames feature supports all gopPresetIdx values and is compatible with lookaheadDepth.
The minimum encoding delay depends on both the GOP size and the lookahead depth.
For example, when gopPresetIdx = 5 and lookaheadDepth = 4, the minimum encoding delay is 3 frames, meaning that the application must submit 4 input frames before the encoder produces the first output packet.
For minFramesDelay = 5, it will try to flush when get I frame, it can reduce the latency when meet irregular gop
| Not Applicable | JPEG |
| Supported Values | - 0: disable - 1: enable - 2: enable, keep output fps stable - 5: enable, flush before I frame to reduce delay - 6: enable, keep output fps stable and flush before I frame to reduce delay |
| Default | 0 |
keepAliveTimeout
Specifies a session keep alive timeout value. This is a periodic request/response between libxcoder and XCoder firmware that when timed out, the session instance will be terminated by XCoder firmware*.* If this option is used in conjunction with FFmpeg command line option keep_alive_timeout then keepAliveTimeout overrides keep_alive_timeout.
| Supported Values | Integer in the range 1 to 100 |
| Default | 3 |
zeroCopyMode
Enable or disable libxcoder zero copy feature. When zero copy is disabled, libxcoder copies YUV data from input frame buffer(s) to consecutive internal buffer before transferring data to device. This reduces overhead by triggering data transfer only once.
When zero copy is enabled, libxcoder transfers data directly from input frame buffer(s) (luma / chroma buffers can be inconsecutive) to device, which improves performance when encoding high resolution / large frames.
The default setting is auto mode, in which libxcoder decides whether to enable or disable zero copy based on input resolution – zero copy is enabled if input resolution > = 1080p, and disabled if input resolution < 1080p. Auto mode's zero copy enable / disable is based on performance test results, and therefore is the suggested setting.
For applications based on libxcoder instead of calling FFMpeg libavcodec functions, please refer to libxcoder_API_IntegrationGuide section 6.6.2 - “Input YUV Frame Preparation” regarding the libxcoder APIs required to use the zero copy feature. Otherwise zero copy will not take effect regardless of the zeroCopyMode setting.
Zero copy only applies to input frames which meet the following requirements
- YUV420 8 or 10 bit planar/semi-planar pixel format, or RGBA / BGRA / ABGR / ARGB
- Input frame width and height are 2-pixels aligned
- Input frame linesizes (aka strides) of luma / chroma buffers are 2-bytes aligned
- Input frame resolution > = 144x128
- Each input frame’s linesize shall be the same throughout the entire encoding session
| Supported Values | - 0: Disable zero copy (For any input resolution) - 1: Enable zero copy (For any input resolution) - -1: Auto mode (Enable zero copy if input resolution > = 1080p, disable zero copy if input resolution < 1080p) |
| 1 (Enable zero copy for all input resolutions) |
ddrPriorityMode
Specifies the DDR memory priority mode. Only need set once at beginning, and it will reset to default automatic after current process finish.
This is a global setting, it will influence all running processes. It is best to only use it when there is only one process. If there are multiple processes, other processes fps performance may influence by this parameter.
| Supported Values | - 0: set default ddr mode - 1:increase ddr priority for decoder and encoder - 2:increase ddr priority for scaler - 3:increase ddr priority for ai |
| Default | -1 |
statisticOutputLevel
Specify the information output for each frame, statisticOutputLevel = 1 will including the maximum and minimum MV of the macroblocks in the current frame, as well as the number of inter/intra macroblocks in the current frame and the frame size of the current frame. statisticOutputLevel = 6 will include 1-pass satd cost
This feature will decrease the performance because collecting this information is time-consuming.
| Supported Values | - 0: disable - 1: detail info for 1-pass - 6: 1-pass satd cost |
| Default | 0 |
disableAdaptiveBuffers
Specifies whether to disable adaptive buffers when bitstream sequence is changed. When disableAdaptiveBuffers=1 and width/height of pictures is different from previous width/height in sequence change, it will take a little time to re-configure encoder with new width/height.
If this option is used and the output type of decoder is hw in transcoding, the disableAdaptiveBuffers parameter of quadra decoder should be used at same time. If there are many sequence changes in customer’s bitstream, suggest to enable this parameter.
| Not Applicable | JPEG and VP9 |
| Supported Values | - 0: Disable - 1: enable |
| Default | 0: Disable |
Encode Algorithm and Features
preset
Selects a predefined set of encoding parameters to balance encoding speed and compression efficiency. Presets provide a convenient way to configure the encoder with optimized settings for specific use cases, prioritizing either speed or quality. When a preset is used, any additional encoding parameters specified will override the corresponding preset values except RcEnable. RcEnable is always set to 1 and crf to –1 (disabled) since preset is only supported in the CBR mode. If no preset is selected, the encoder applies no predefined parameter set.
The following are example ffmpeg commands:
ffmpeg -vsync 0 -i input.h264 -c:v h265_ni_quadra_enc -xcoder-params preset=medium output.mp4
ffmpeg -vsync 0 -i input.h264 -c:v h265_ni_quadra_enc -preset medium output.mp4
If the predefined parameter values fall outside the supported range for the selected codec or resolution, they will be automatically adjusted to fit within the valid range.
For H.264, the veryfast, faster, and fast presets produce identical results. Similarly, the medium, slow, and slower presets give the same results.
| Not Applicable | JPEG |
| Supported Values | The below lists the predefined encoding parameters for each preset, in the format (RcEnable, EnableRdoQuant, rdoLevel, lookAheadDepth, gopPresetIdx, bitrate, vbvBufferSize, cuLevelRCEnable, tolCtbRcInter, tolCtbRcIntra): - veryfast : (1, 1, 1, 0, 9, 1000000, 1000, 1, 0, -1) - faster: (1, 1, 2, 0, 9, 1000000, 1000, 1, 0, -1) - fast: (1, 1, 3, 0, 9, 1000000, 1000, 1, 0, -1) - medium: (1, 1, 1, 16, -1, 1000000, 3000, 0, 0, 0) - slow: (1, 1, 2, 16, -1, 1000000, 3000, 0, 0, 0) - slower: (1, 1, 3, 16, -1, 1000000, 3000, 0, 0, 0) - veryslow: (1, 1, 3, 40, -1, 1000000, 3000, 0, 0, 0) |
| Default | None – not assigned and all parameters use default values: (0, 0, 1, 0, -1, 200000, 3000, 0, 0, 0) |
rdoLevel
Specifies the number of candidates to use for Rate Distortion Optimization. RDO is a method for improving video quality during compression. Lower values mean a lower quality but better performance, higher values mean more quality but less performance
| Not Applicable | JPEG |
| Supported Values | - H.264: 1 - H.265: 1 to 3 - AV1: 1 to 3 |
| Default | 1 |
EnableRdoQuant
Specifies whether to enable or disable RDO Quantization. RDOQ provides optimized quantization to further improve video quality, with the cost of lower performance
| Not Applicable | AV1 and JPEG |
| Applicable | H.264 and H.265 |
| Supported Values | - 0: Disable - 1: Enable |
| Default | 0 |
tuneBframeVisual
Specifies whether to enable or disable B-frame visual tuning. B-frame visual tuning helps mitigate subjective quality fluctuation, at the cost of lowered compression efficiency. When enabled, there are 2 modes available – setting tuneBframeVisual to 1 enables MEDIUM tuning mode, in which encoder tunes B-frame visual quality with minor loss in compression efficiency, and setting tuneBframeVisual to 2 enables HIGH tuning mode, in which encoder applies stronger tuning to B-frame visual quality with more compression efficiency loss
Please also note that MEDIUM tuning mode is only applicable to H.264 and H.265, and is only available when lookahead (enabled by lookaheadDepth) or CRF (enabled by crf) encode is enabled
| Not Applicable | JPEG (MEDIUM tuning mode is not applicable to AV1) |
| Supported Values | - 0: Disable - 1: MEDIUM (tune B-frame visual quality with minor loss in compression efficiency) - 2: HIGH (stronger B-frame quality tuning with more compression efficiency loss) |
| Default | 0 |
enable2PassGop
This parameter will affect the group of picture pattern for 2-pass encoding.
By default, it is disabled. Encoder has its own GOP for 2-pass mode when lookahead > 0. GOP will be different from what is described in gopPresetIdx.
When it is enabled, the 2-pass encoding’s GOP is consistent with GOP specified by gopPresetIdx.
For more details, please refer to Section 8.4.3.2 Pre-defined GOP Structure.
| Not Applicable | JPEG |
| Supported Values | - 0: Disable - 1: Enable |
| Default | 0 |
lookAheadDepth
Number of frames to lookahead while encoding. Lookahead can increase encoder quality at the expense of performance (approximately 25%) and delay. Note that the input video pixel width must be at least 144 pixels wide.
Enabling CU level RC with lookahead (E.g. cuLevelRc=1 and lookaheadDepth > 0) is generally not recommended, because CU level RC may cause quality degradation to lookahead encode. The only scenario CU level RC should be enabled together in lookahead encode would be when instantaneous bitrate constraint or HRD conformance must be strictly followed – in which case CU level RC would be needed to constraint the bitrate
Due to resource constraints, when transcoding a 8k(7680x4320) 10 bitstream, the maximum value of lookahead is 16.
| Not Applicable | JPEG |
| Supported Values | 0: Disable lookahead 4 to 40: Enable lookahead with lookahead depth in frames (4 to 40 frames). |
| Default | 0 |
noMbTree
When lookahead is enabled, MB Tree / CU Tree is enabled by default. Use the noMbTree parameter to disable MB Tree / CU Tree feature. Because disabling MB Tree / CU Tree can reduce quality and compression efficiency, this setting is not recommended in most cases.
noMbTree only takes effect when lookahead is enabled (lookaheadDepth > 0)
| Not Applicable | JPEG |
| Supported Values | - 0: Do not disable MB Tree / CU Tree feature when lookahead is enabled - 1: Disable MB Tree / CU Tree feature when lookahead is enabled |
| Default | 0 |
totalCuTreeDepth
In live streaming, cloud gaming, or other low delay scenarios, a high lookahead depth setting may not be acceptable due to the extended delay caused by lookahead. In scenarios where increasing lookahead depth is not an option, the user may set totalCuTreeDepth to a number greater than lookahead depth to improve quality. Currently this feature is only supported for gopPresetIdx 5, and the suggested value is lookahead depth + ½ gop size, E.g. for lookaheadDepth=4 and gopPresetIdx=5 (which has gop size 4), the suggested setting for totalCuTreeDepth is 4+(4/2)=6. Please also note enabling this feature will cause up to 9 ~ 10% performance degradation.
To enable this feature, set totalCuTreeDepth to a value larger than lookaheadDepth. Setting totalCuTreeDepth < = lookaheadDepth will not bring any quality enhancement
This feature is only available when lookahead is enabled, E.g. setting totalCuTreeDepth > 0 is not allowed when lookaheadDepth = 0
This feature is only supported for gopPresetIdx = 5, E.g. setting totalCuTreeDepth > lookaheadDepth is only allowed when gopPresetSetIdx = 5
This feature is incompatible to mulitcoreJointMode, E.g. setting totalCuTreeDepth > lookaheadDepth is not allowed when multicoreJointMode = 1
Enabling his feature will cause up to 9 to 10% performance degradation
| Not Applicable | JPEG |
| Supported Values | - 0: Disabled - 4 to 40: Set totalCuTreeDepth to value greater than lookaheadDepth to improve quality. The suggested value is lookahead depth + ½ gop size. |
| Default | 0 |
gopPresetIdx
Defines the Group Of Picture pattern.
By default, encoder uses Adaptive Gop, for which the encoder dynamically adjusts gop pattern while encoding based on statistics collected from previous frames (1-pass) or lookahead (2-pass).
If both coding parameters gopPresetIdx and lookaheadDepth are set, then the gop pattern is different from setting only the coding parameter gopPresetIdx. For details, please refer to Section 8.4.3 Custom Gop Structure.
For 2-pass encoding, the GOP is not only affected by this parameter, but also affected by parameter enable2PassGop. Please refer to it for more details.
| Not Applicable | JPEG |
| Supported Values | - -1: Adaptive Gop (default) - 0 : Custom Gop - 1 : I-I-I-I,..I (all intra, gop_size=1) - 3 : I-B-B-B,…B (consecutive B, gop_size=1) - 4 : I-B-P-B-P,… (gop_size=2) - 5 : I-B-B-B-P,… (gop_size=4) - 7 : I-B-B-B-B,… (consecutive B, gop_size=4) - 8 : I-B-B-B-B-B-B-B-B,… (random access, gop_size=8) - 9 : I-P-P-P,… P (consecutive P, gop_size=1) - 10 : I-P-P-P-P,… (hierarchical P, gop_size=4) |
| Default | -1 |
intraPeriod
Key frame / IDR frame interval.
Please note when spatialLayers \ > 1 (multiple spatial layers), intraPeriod represents number of temporal units count instead of number of frames. For example, when encoding with 4 spatial layers, each temporal unit includes 4 frames. Assuming framerate is 60, there will be 60 temporal units or 240 frames per second. In this case, setting intraPeriod 60 will cause a key frame to be inserted every second in the base layer.
| Supported Values | - 0 to 1024 - 0 implies an infinite period (disables periodic IDR frames) |
| Default | 120 |
intraQP
Specifies intra frame quantization parameter.
The intraQP only takes effect when rate control is disabled e.g. rcEnable = 0
When used for JPEG, the encoder scales the quantization table in the JPEG standard to produce bitstreams of different video quality.
| Supported Values | 0 to 51 |
| Default | 22 |
intraQPDelta
Delta value added to the Intra frame QP. Can be used to lower the Intra Picture encoded size (higher QP) or to increase Intra quality relative to the Inter Pictures (lower QP) to get rid of intra flashing. Recommended value range is –12 to 12.
The intraQpDelta only takes effect when rate control is enabled, eg. rcEnable = 1
After intraQpDelta is applied, the intra frame QP is further adjusted by rate control, which means that the encoded bitstream may not contain the exact value of the user-defined delta depending on the source.
| Supported Values | -51 to 51 |
| Default | -2 |
qLevel
JPEG only. Specifies the quantization scale to produce the different video qualities by scaling the quantization table. Higher values produce better quality.
| Not Applicable | H264, H265, and AV1 |
| Supported Values | 0 to 9 |
minQP
Min QP for rate control.
| Supported Values | 0 to 51 |
| Default | 8 |
maxQP
Max QP for rate control.
| Not Applicable | |
| Supported Values | 0 to 51 |
| Default | 51 |
roiEnable
ROI (Region of interest), is a feature of the encoder that permits the quality of some regions to be improved at the expense of other regions. If rate control is disabled, the QPs are used directly for encoding, if rate control is enabled, the encoder scales the QPs as necessary to meet the bitrate target. When ROI is enabled, the ROI map can be updated, enabled, or disabled on a frame by frame basis.
For ROI map configuration, please refer to ni_quadra_roi in section 10 – Filters.
The ROI has no effect for 2-pass (lookaheadDepth > 0) encode
Currently roiEnable is not supported when cropWidth and cropHeight are set.
| Not Applicable | JPEG |
| Supported Values | - 0: disable - 1: enable |
| Default | 0 |
RoiDemoMode
Enables the ROI demo mode. When ROI is enabled (roiEnable=1), ROIDemoMode permits the ROI feature to be demonstrated using the standard FFmpeg command line, without additional application development. ROI demo mode is currently only supported on FFmpeg 3.4.2 and above. Demo mode 1 has QP=40 for the center 1/3, and QP=10 for outer 2/3. Demo mode 2 has opposite QP. In both cases ROI is enabled at frame 90 and disabled at frame 300.
ROI takes no effects for 2-pass (lookaheadDepth > 0) encode
| Not Applicable | JPEG |
| Applicable | FFmpeg 3.4.2 and above |
| Supported Values | 0 to 2 |
| Default | 0: Disabled |
cacheRoi
Enables caching of an ROI map. When ROI is enabled, the ROI map can be changed on a frame by frame basis. When cacheRoi is enabled at the same time, the currently available ROI map is cached and applied to the subsequent frames until a new map is supplied. It is only valid if ROI is enabled.
ROI takes no effects for 2-pass (lookaheadDepth > 0) encode
| Not Applicable | JPEG |
| Supported Values | - 0: disable - 1: enable |
| Default | 0 |
intraRefreshMode
Selects intra refresh macroblock update method. This method is not supported for 2-pass encode and the command will be rejected.
| Not Applicable | JPEG |
| Supported Values | - 0: no intra refresh - 1: row – works in conjunction with next parameter |
| Default | 0 |
intraRefreshArg
Specifies the number of consecutive CTB or MB rows refreshed (to be encoded as Intra) per frame
Only takes effects if intraRefreshMode = 1
- For h.264, each MB row is 16 pixels or more in height
- For h.265 / AV1, each CTU row is 64 pixels or more in height
If intra refresh cycle is 1 (meaning intra refresh must be completed in 1 frame), this defeats the purpose of intra refresh and therefore the encode command will be rejected. Intra refresh cycle can be calculated by
Intra refresh cycle = input picture height / (intraRefreshArg * 16 for h.264, or * 64 for h.265 and AV1)
For example, if h.265 input resolution is 640x480 and intraRefreshArg is 8, intra refresh cycle = ceil(480 / (64 * 8)) = 1, which is invalid setting and will be rejected
| Not Applicable | JPEG |
| Supported Values | - 0: intra refresh is disabled - Nonzero: number of consecutive CTB / MB rows to be encoded as Intra |
| Default | 0 |
IntraRefreshMinPeriod
Intra refresh cycle starts at intra period, which is specified by intraPeriod or intraRefreshMinPeriod. If both intraRefreshMinPeriod and intraPeriod are specified, whichever comes later in the parameter string has higher priority.
| Not Applicable | JPEG |
| Supported Values | N/A |
| Default | 120 |
IntraRefreshResetOnForceIDR
Intra refresh cycle will reset to restart on force IDR frame
This only takes effects if intraRefreshMode = 1
| Not Applicable | JPEG |
| Supported Values | - 0: intra refresh on force IDR frame is disabled - 1: intra refresh on force IDR frame is enabled |
| Default | 0 |
longTermReferenceEnable
Enables the long term reference (LTR) feature. With long term reference enabled, an application can
- Set LTR interval by longTermReferenceInterval, and/or
- Set any frame as LTR on a frame by frame basis. For more detail refer to QUADRA libxcoder API Guide
- Set number of LTRs (1 or 2) by longTermReferenceCount
LTR is only supported by low delay gop (i.e. all frames in sequence), namely gopPresetIdx=1, 3, 7, 9, or 0 (if custom gop has consecutive order frames). Also, LTR is not supported for 2-pass encode and the command will be rejected.
Inter-frames use LTRs for prediction when the application invalidates short-term references (STRs) or when useLTRsOnly=1. For details on setting LTR frames and invalidating reference frames, refer to Section 8.4.1 Long-Term Reference, Section 8.4.2 Reference Invalidation, and the libxcoder API Guide.
When the longTermReferenceEnable is enabled Quadra preserves up to 2 LTRs. The number of LTRs (1 or 2) can be configured by longTermReferenceCount. The application does not need to specify the LTR index as Quadra maintains the LTR index internally.
The occurrence of an IDR frame will clear any existing LTRs (referencing frames prior to an IDR is not allowed in the standards).
LookAhead and crf will be disable when longTermReferenceEnable
| Not Applicable | JPEG |
| Supported Values | - 0: disable - 1: enable |
| Default | 0 |
longTermReferenceInterval
When longTermReferenceEnable is enabled, assign longTermReferenceInterval > 0 will set frames as LTR periodically upon specified frame interval. If longTermReferenceInterval = 0, only IDR frames will be set as LTR
the longTermReferenceInterval only takes effect if longTermReferenceEnable = 1
| Not Applicable | JPEG |
| Supported Values | N/A |
| Default | 0 |
longTermReferenceCount
When longTermReferenceEnable is enabled, the number of LTRs (1 or 2) can be configured by longTermReferenceCount.
By default, Quadra preserves up to 2 LTRs. However, due to Quadra h.264 encoder limitation, some decoders may not be able to decode h.264 bitstream Quadra encoded with 2 LTRs, in which case longTermReferenceInterCount should be set to 1
| Not Applicable | JPEG |
| Supported Values | 1 to 2 |
| Default | 2 |
longTermReferenceOldest
Specifies which long-term reference (LTR) frame takes priority when inter-frames use LTRs for prediction and two LTR frames are available.
Inter-frames use LTRs for prediction when the application invalidates short-term references (STRs) or when useLTRsOnly=1.
For details on setting LTR frames and invalidating reference frames, refer to Section 8.4.1 Long-Term Reference, Section 8.4.2 Reference Invalidation, and the libxcoder API Guide.
Priority is determined by display order:
Newest LTR: The most recent LTR in display order.
Oldest LTR: The earliest LTR in display order.
This parameter takes effect only when longTermReferenceEnable=1 and longTermReferenceCount=2.
| Not Applicable | JPEG |
| Supported Values | 0: Give the newest LTR higher priority when replacing invalidated reference frames. 1: Give the oldest LTR higher priority when replacing invalidated reference frames. |
| Default | 0 (newest LTR has higher priority) |
useLTRsOnly
Restricts every inter-frame prediction to the available long-term reference(s) (one or two LTRs). If insufficient LTRs are available, short-term references (STRs) are used as a fallback. When two LTRs are available, longTermReferenceOldest determines which LTR takes priority.
This parameter takes effect only when longTermReferenceEnable=1
| Not Applicable | JPEG |
| Supported Values | 0: Disabled 1: Enabled |
| Default | 0 |
multicoreJointMode
Enables encoder multi-core mode where all 4 cores work together in parallel (a.k.a. joint mode). When disabled (default) the encoder instances use a single video core to encode. When enabled, encoder instances use all 4 video encoding cores in parallel. Recommended only for high resolution encoding with less than 4 instances e.g. 8K encode. When more than 4 encoding instances are used enabling this feature will lower performance due to extra synchronization overhead.
When multicoreJointMode is enabled, lowDelay and picSkip must be 0.
Please note that encoder cannot guarantee HRD conformance when multicoreJointMode is set to 1, so it is recommended not to enable multicoreJointMode when strict adherence to HRD conformance is required.
| Not Applicable | JPEG |
| Supported Values | - 0: Disable - 1: Enable |
| Default | 0: Disable |
enableSSIM
When enabled, XCoder firmware will return SSIM values for Y, U, and V of each encoded frame in the ni_metadata_enc_bstream_t structure. The SSIM values are 4 decimal places multiplied by 10000. Divide by 10000 to get the original value.
SSIM measures video quality by calculating Structural Similarity. Range 0 to 1.
By default, SSIM values are logged in debug mode. To change this to info level at compile time use -m, --with-info-level-ssim-log when compiling libxcoder with libxcoder/build.sh script.
| Not Applicable | JPEG and AV1 |
| Supported Values | - 0: Disable - 1: Enable |
| Default | 0: Disable |
getPsnrMode
Specify whether to output PSNR. Hardware only support output psnr on y component for HEVC codec. For other codec or for UV component, the psnr should calculate on the SW. Enable this feature will reduce performance.
Currently PSNR is supported for 8-bit YUV420p only, except for h.265’s PSNR of Y component (getPsnrMode=2) which is supported for 8-bit YUV420p planar, semi-planar, and 10-bit YUV420p planar, semi-planar pixel formats. Also note that getPsnrMode is implicitly disabled (getPsnrMode=3) when user enables PSNR with unsupported codec and/or pixel format
Currently PSNR is not supported when Width and cropHeight are set. getPsnrMode is implicitly disabled (getPsnrMode=3) when user enables PSNR along with cropWidth and cropHeight parameters
| Not Applicable | JPEG |
| Supported Values | - 0 – acquire psnr for both Y and UV component - 1 – acquire psnr for UV component only - 2 – acquire psnr for Y component only - 3 – do not acquire psnr |
| Default | 3 |
intervalOfPsnr
Specify the interval frame numbers for outputting PSNR. Its function is to reduce performance consumption, and this params affects the input frames. Therefore, if it is a non continuous frame output, the output interval may be slightly different from the value of intervalOfPsnr, depending on the gop size in the encoding.
| Not Applicable | JPEG |
| Supported Values | - \ > 0 |
| Default | 1 |
getReconstructedMode
Specify whether to get reconstructed frame from Hardware. Currently get reconstructed frame is supported for 8-bit YUV420p only. The workflow is like getPsnrMode.
Currently PSNR is not supported when cropWidth and cropHeight are set.
| Not Applicable | JPEG |
| Supported Values | - 0 – do not acquire reconstructed frame - 1 – acquire reconstructed frame for 8-bit YUV component |
| Default | 0 |
ReconfDemoMode
Specifies demo mode. When enabled the specified demo mode reconfigures the encoding parameters while encoding is in progress. Must be used with ReconfFile. For example, “ReconfDemoMode=1:ReconfFile=reconf.txt”. The types of parameters that can be reconfigured by the demo mode are listed in Supported Values. The example command below shows how to enable the bitrate reconfiguration demo:
ffmpeg -vsync 0 -c:v h264_ni_quadra_dec -dec 0 -y -i Dinner_1920x1080p30_300.h264 -c:v h264_ni_quadra_enc -xcoder-params "bitrate=1000000:RcEnable=1:ReconfDemoMode=1:ReconfFile=reconf.txt" -enc 0 out.h264
The Long Term Reference (LTR) and the reference invalidation features are explained in detail in sections 8.4.1 Long Term Reference and 8.4.2 Reference Invalidation, respectively.
| Not Applicable | JPEG |
| Supported Values | - 1: Bitrate - 2: Intra Period - 3: VUI - 4: Long Term Reference (LTR) frame setting - 6: Max & Min qp setting - 7: Long Term Reference (LTR) interval setting - 8: Frame reference invalidation - 9: Framerate - 10: maxFrameSize_Bytes - 14: CRF - 15: CRF (floating point value) - 16: VBV value - 17: maxFrameSize_Byte by ratio - 18: sliceArg - 19: Set long term reference (LTR) + reference invalidation - 20: Set long term reference (LTR) + reference invalidation + use LTR prediction |
| Default | 0 - Disabled |
ReconfFile
Specifies the name of the reconf file from which the reconfiguration demo mode will read key and value information. Must be used with ReconfDemoMode. For example, ReconfDemoMode=1:ReconfFile=reconf.txt. The reconf file must be created in the same directory where the command is running. The file contains one line or multiple lines of key:value pairs.
The ReconfFile command only supports using the MaxFrameSize_Bytes.
The content of the reconf file for the different demo mode is shown in the examples below:
Bitrate (ReconfDemoMode 1)
At frame number 100, bitrate changes to 1000000 bps. Add multiple lines of key:value to change the bitrate over multiple frames.
| Key | frame number to change bitrate |
| Value | bitrate |
| File content example | 100:1000000 |
Intra Period (ReconfDemoMode 2)
At frame number 100, force IDR frame (aka key frame) and changes intra period to 30. Add multiple lines of key:value pairs to change intra period over multiple frames.
reconfigure intra period is not allowed if intraRefreshMode is enabled or if gopPresetIdx is 1
| Key | frame number to change intra period |
| Value | intra period |
| File content example | 100:30 |
VUI (ReconfDemoMode 3)
A VUI containing the 7 listed parameter changes at frame number 100.
| Key | frame number to change VUI |
| Value | - colorDescPresent - colorPrimaries - colorTrc - colorSpace - aspectRatioWidth - aspectRatioHeight - videoFullRange |
| File content example | 100:1,255,255,255,16,11,1 |
Long Term Reference (LTR) frame setting (ReconfDemoMode 4)
Refer to the description of longTermReferenceEnable
| Key | frame number to be set as LTR |
| Value | 1 (set as LTR) |
| File content example | 10:1 frame 10 is set to LTR |
Max & Min qp setting (ReconfDemoMode 6)
| Key | frame number to change qp |
| Value | - minQpI - maxQpI - maxDeltaQp - minQpPB - maxQpPB Note that maxDeltaQp is currently ignored |
| File content example | 100:8,51,51,8,51 At frame 100, change max & min qp |
Long Term Reference (LTR) interval setting (ReconfDemoMode 7)
Refer to the description of longTermReferenceInterval
| Key | frame number |
| Value | LTR interval |
| File content example | 25:5 At frame 25, change LTR interval to 5 |
Frame reference invalidation (ReconfDemoMode 8)
| Key | frame number |
| Value | reference frame to invalidate |
| File content example | 24:21 At frame 24, invalidate all references with frame number > = 21 |
Framerate (ReconfDemoMode 9)
| Key | frame number to change framerate |
| Value | framerate numerator, denominator |
| File content example | 100:25,1 At frame 100, change framerate to 25 |
MaxFrameSize parameter setting (ReconfDemoMode 10)
The MaxFrameSize parameter has been deprecated and should NOT be used. Instead, use the more explicit MaxFrameSize_Bytes parameter (see below), which is equivalent of MaxFrameSize. Using the new MaxFrameSize_Bytes parameter will also make the Quadra application code easier to understand.
Refer to the description of MaxFrameSize for required settings
| Key | frame number to change MaxFrameSize |
| Value | maximum frame size in bytes |
| File content example | 100:200000 At frame 100, change MaxFrameSize to 200000 bytes |
CRF (ReconfDemoMode 14)
| Key | frame number to change crf setting |
| Value | crf value (ranging from 0 – 51) |
| File content example | 100:27 At frame 100, change crf value to 27 |
Reconfigure CRF parameter is valid only when CRF mode is enabled (CRF mode enabled by setting crf parameter when encoding session started)
Run-time disabling CRF (reconfigure crf to -1) is not allowed
| Not Applicable | JPEG |
| Supported Values | name string that has length < 10 excluding file extension |
| Default | Null |
VBV (ReconfDemoMode 16)
| Key | frame number to change vbv buffer size and vbv max rate setting |
| Value | vbvBufferSize vbvMaxRate(0 (disable), or any value > = bitrate) |
| File content example | 100:2000000,2500 At frame 100, change vbvBufferSize to 2500, vbvMaxRate to 2000000 |
| Not Applicable | JPEG |
| Supported Values | for vbvBufferSize(–1, 0 or [min_vbv_size ~ 3000].), The min_vbv_size is defined as 1000/framerate (one frame time) but not less than 10ms for vbvMaxRate 0 (disable), or any value > = bitrate |
| Default | null |
MaxFrameSizeRatio (ReconfDemoMode 17)
Reconfigure MaxFrameSizeRatio parameter is valid only when low_delay_mode is enabled, MaxFrameSizeRatio need to > 0, and the final MaxFrameSize will < NI_MAX_FRAME_SIZE
| Key | frame number to change MaxFrameSizeRatio |
| Value | maximum frame size in ratio |
| File content example | 100:200 At frame 100, change MaxFrameSizeRatio to 200 |
SliceArg (ReconfDemoMode 18)
| Key | frame number to change sliceArg setting |
| Value | sliceArg value |
| File content example | 100:20 At frame 100, change sliceArg value to 20 |
| Not Applicable | JPEG, AV1, VP9 |
| Supported Values | The minimum value is 1, The maximum value is (height+ ctu_mb_size-1)/ctu_mb_size, height is video height, ctu_mb_size is 16 for h264, 64 for h265 |
| Default | null |
Set Long-Term Reference (LTR) and Invalidate Reference Frames (ReconfDemoMode 19)
Marks the current frame as an LTR and/or invalidates reference frames according to entries in a configuration file.
Prerequisite: This mode takes effect only when longTermReferenceEnable=1
| Key | Frame number at which to apply the specified actions |
| Value #1 | Whether to mark the current frame as an LTR |
| Value #2 | Frame-number threshold for reference invalidation |
| File content example | 45:1,-1 135:0,105 285:1,255 · At frame 45: Mark frame 45 as an LTR without invalidating any reference frames. · At frame 135: Do not mark frame 135 as an LTR. Invalidate all reference frames with frame numbers greater than or equal to 105. · At frame 285: Mark frame 285 as an LTR and invalidate all reference frames with frame numbers greater than or equal to 255. |
| Not Applicable | JPEG |
| Supported Values | Value #1: 0 = Do not mark the current frame as an LTR. 1 = Mark the current frame as an LTR. Value #2: -1 = Do not invalidate any reference frames. Otherwise, the value must be nonnegative and less than the current frame number. All reference frames with frame numbers greater than or equal to this value are invalidated. |
| Default | null |
Set Long-Term Reference (LTR) and Invalidate Reference Frames and configure the current frame to use LTR prediction (ReconfDemoMode 20)
Marks the current frame as an LTR, and/or invalidates reference frames, and/or configure the current frame to use LTR prediction, according to entries in a configuration file.
Prerequisite: This mode takes effect only when longTermReferenceEnable=1
| Key | Frame number at which to apply the specified actions |
| Value #1 | Whether to mark the current frame as an LTR |
| Value #2 | Frame-number threshold for reference invalidation |
| Value #3 | Whether to configure the current frame to use LTR prediction |
| File content example | 45:1,-1,0 135:0,105,1 285:1,255,0 · At frame 45: Mark frame 45 as an LTR without invalidating any reference frames, and do not use LTR prediction. · At frame 135: Do not mark frame 135 as an LTR. Invalidate all reference frames with frame numbers greater than or equal to 105, and use LTR prediction. · At frame 285: Mark frame 285 as an LTR and invalidate all reference frames with frame numbers greater than or equal to 255, and do not use LTR prediction. |
| Not Applicable | JPEG |
| Supported Values | Value #1: 0 = Do not mark the current frame as an LTR. 1 = Mark the current frame as an LTR. Value #2: -1 = Do not invalidate any reference frames. Otherwise, the value must be nonnegative and less than the current frame number. All reference frames with frame numbers greater than or equal to this value are invalidated. Value #3: 0 = Do not configure the current frame to use LTR prediction. 1 = Configure the current frame to use LTR prediction. |
| Default | null |
enableAIEnhance
Embedded image enhancement models are utilized to improve the visual quality of videos during the transcoding process. Upon decoding the YUV hardware frames, they are transmitted to the Quadra AI Inference Engine, which generates enhanced frames of identical size and format, before passing them on to the encoder. Generally, this approach results in videos with superior visual quality.
Specify AIEnhanceLevel when enabling this parameter.
This feature only support 8bit with following resolution:
- 1280x720
- 1920x1080
- 3840x2160
- 720x1280
- 1080x1920
- 2496x1080
| Not Applicable | JPEG |
| Supported Values | - 0: disable the feature. - 1: enable the feature. |
| Default | 0 |
AIEnhanceLevel
Specifies the adjust level of AI engine to AI enhance optimization. The higher means the AI engine would change more about the original picture and the PSNR may be lower.
This feature is only effective when enableAIEnhance=1.
| Not Applicable | JPEG |
| Supported Values | - 1 : Lowest - 2: Medium - 3: Highest |
| Default | 3 |
enableHVSPlus
HVS+ utilizes Quadra's internal AI engine to enhance video quality during encoding by mimicking the human visual system. It optimizes video content through perceptual optimization, achieving a balanced performance between PSNR (Peak Signal-to-Noise Ratio) and VMAF (Video Multi-Method Assessment Fusion). This ensures that both objective and subjective quality metrics are met. HVS+ offers two preconfigured settings tailored to different types of video content, providing optimal enhancement for various genres.
This feature only support 8bit with following resolution:
- 1280x720
- 1920x1080
- 3840x2160
Specify HVSPlusLevel when enabling this parameter. And this parameter cannot work with enableAIEnhance at same time.
| Not Applicable | JPEG |
| Supported Values | - 0: disable the feature. - 1: enable the feature. |
| Default | 0 |
HVSPlusLevel
Level 1 preserves the PSNR better in general. Level 2 is more towards improving the subject quality.
This feature is only effective when enableHVSPlus=1.
| Not Applicable | JPEG |
| Supported Values | - 1: Better PSNR - 2: Better subject quality |
| Default | 1 |
cropWidth
Specifies cropping width, must be even.
When specified, cropWidth + horOffset must be less than input picture width
When specified, cropHeight must also be specified a valid value
| Not Applicable | JPEG |
| Supported Values | 144 pixels to input picture width |
| Default | 0 |
cropHeight
Specifies cropping height, must be even.
When specified, cropHeight + verOffset must be less than input picture height
When specified, cropWidth must also be specified a valid value
| Not Applicable | JPEG |
| Supported Values | 128 pixels to input picture height |
| Default | 0 |
horOffset
Specifies horizontal cropping offset, must be even.
horOffset is only effective when cropWidth and cropHeight are specified
When specified, cropWidth + horOffset must be less than input picture width
| Not Applicable | JPEG |
| Supported Values | 0 to input picture width |
| Default | 0 |
verOffset
Specifies vertical cropping offset, must be even.
verOffset is only effective when cropWidth and cropHeight are specified
When specified, cropHeight + verOffset must be less than input picture height
| Not Applicable | JPEG |
| Supported Values | 0 to input picture height |
| Default | 0 |
motionContrainedMode
Enables Motion Constrained mode 1 (Performance mode), mode 2 (Quality mode), or mode 3 (Advanced Quality mode). When Motion Constrained mode is enabled, the encoder forces specific blocks to be encoded in intra mode to prevent motion vectors from crossing picture boundaries. This allows the encoded frame to be converted into HEVC or AV1 tiles and stitched together with other tiles to form a multi-tile bitstream without introducing visible decoding artifacts.
A common use case for this feature is multiview applications, where multiple video streams are displayed simultaneously on a single display device.
Please note that enabling Motion Constrained mode may negatively impact encoding performance and/or compression efficiency due to the additional motion estimation constraints:
- Mode 1 (Performance mode): No performance impact, but lower compression efficiency and quality.
- Mode 2 (Quality mode): Reduced encoding performance, but significantly better visual quality than mode 1 at the same bitrate.
- Mode 3 (Advanced Quality mode): Provides further quality optimization over mode 2, with a slight additional encoding performance cost.
The following requirements apply whenever motionConstrainedMode is enabled Requirements for All Enabled Modes (1, 2, and 3): · H.264, H.265, and AV1: Set roiEnable=0 and customizeRoiQpLevel=0 (default values). · AV1: Also set hvsQPEnable=0 and cuLevelRCEnable=0 (default values). Additional Requirements for Quality Mode (2) and Advanced Quality Mode (3): · H.264: Input width and height—or cropWidth and cropHeight when cropping is enabled—must each be a multiple of 16. · H.265 and AV1: Input width and height—or cropWidth and cropHeight when cropping is enabled—must each be a multiple of 64. · H.264, H.265, and AV1: Set multicoreJointMode=0 and rdoLevel=1 (default values).
| Not Applicable | JPEG |
| Supported Values | - 0 (disabled) - 1 (Performance mode) - 2 (Quality mode) - 3 (Advanced Quality mode) |
| Default | 0 |
Rate Control
RcEnable
Enables or disables rate control.
| Not Applicable | NA |
| Supported Values | - 0: Disable - 1: Enable |
| Default | 0 |
bitrate
Used when RcEnable is enabled (set to 1) or crf value is specified (crf value > = 0), otherwise it is ignored. The encoding bitrate is in bps.
Please also refer to bitrateMode parameter, which is used to control whether rate control handles user specified bitrate as the maximum bitrate or the average bitrate RcEnable is 1 (ABR or CBR mode), cuLevelRCEnable is 1 (enable block level rate control), and lookaheadDepth is 0 (no lookahead.
| Not Applicable | NA |
| Supported Values | The range is 10000 to 800000000. As an example, set 3000000 for 3 Mbps. |
| Default | 200000 |
bitrateMode
Decides rate control behavior when RcEnable is 1, cuLevelRCEnable is 1, and lookaheadDepth is 0 (NOTE - lookaheadDepth default value is 0).
When bitrateMode is 0 (default), encoder perceives bitrate as the maximum bitrate allowed, and therefore may produce bitrate lower than bitrate to achieve higher compression efficiency. When bitrateMode is 1, encoder perceives bitrate as the average bitrate target, and shall produce bitrate close to the target.
bitrateMode mainly affects low delay gop patterns, including gopPresetIdx 3, 7, 9. For other gop presets, the effects of bitrateMode may not be noticeable.
Setting bitrateMode=1 may cause more instantaneous bitrate fluctuations and/or bitrate spikes compared to bitrateMode 0. Therefore, it is recommended to use bitrateMode 0 for applications which need to prevent bitrate spike.
| Applicable | This parameter is valid when RcEnable is 1, cuLevelRCEnable is 1 (enable block level rate control), and lookaheadDepth is 0 (no lookahead). Please also note this parameter does not affect CRF or Capped CRF mode (refer to crf parameter). |
| Not Applicable | JPEG |
| Supported Values | - 0: Maximum bitrate - 1: Average bitrate |
| Default | 0 (Maximum bitrate) |
enableVFR
Specifies the variable framerate(VFR) encoding is support or not.
The VFR feature is disabled by default and the encoder rate control assumes that the framerate is constant. When enabled, the VFR feature uses the video timestamps to calculate the average framerate every second. Encoding a VFR stream without VFR enabled will likely result in the encoded bitrate being wrong.
For example, the framerate reported in a video container may be 25 fps, while the average framerate from the timestamps could be 20fps. Without VFR enabled, the average encoded bitrate in this case would be only 80% of the target.
Enabling the VFR feature also causes h.264 fixed_frame_rate_flag syntax to be set to 0.
| Not Applicable | NA |
| Supported Values | - 0: Disable - 1: Enable |
| Default | 0 |
vbvBufferSize
Specifies the size of the VBV buffer (Coded Picture Buffer or CPB) in milliseconds. This parameter determines if HRD (Hypothetical Reference Decoder) compliance is followed when RcEnable is 1, or if peak bitrate is constrained when crf \ > = 0. Setting vbvBufferSize to 0 disables HRD compliance or peak bitrate constraint.
The CPB receives compressed NAL units from the bitstream, stores them temporarily, and removes them at the appropriate decoding time as defined by the HRD parameters.
When vbvBufferSize is not specified (or when vbvBufferSize is set to -1), the default setting varies depending on the rate control mode. For CBR mode (RcEnable = 1), the default vbvBufferSize is 3000. For CRF mode (crf > = 0), the default vbvBufferSize is 0, meaning peak bitrate is not constrained.
Please also note that bitrate must also be specified along with vbvBufferSize, including Capped CRF mode and Constrained VBR mode in which the vbvMaxRate might have already been specified. This is because both bitrate and vbvBufferSize parameters are required to calculate the actual buffer size, and vbvMaxRate does not serve as a replacement in the aforementioned calculation. Please refer to Section “8.3.4 CRF & Capped CRF Descriptions and Examples” for more details.
| Applicable | This value is valid if RcEnable = 1 or crf > = 0 |
| Not Applicable | JPEG |
| Supported Values | - The value of vbvBufferSize is in unit of millisecond; for example, vbvBufferSize 3000 sets the buffer size to (bitrate * 3 seconds). - The range of supported values is –1, 0 or [min_vbv_size ~ 3000]. - min_vbv_size is 1000/framerate (one frame time) but not less than 10ms - Value 0 disables HRD compliance and peak bitrate constraint. - Value –1 (default) is the auto mode in which the default VBV buffer size is determined by rate control mode (3000 in CBR mode, 0 (no VBV buffer constraint) in CRF mode). |
| Default | - 3000 in CBR mode (RcEnable = 1) - 0 in CRF mode (crf > = 0) |
vbvBufferReencode
When vbvBufferReencode is set to 1, the encoder will re-encode frame(s) if their encoded bit count exceeds the VBV buffer limit, ensuring compliance with VBV (also known as HRD) constraints. Please note that re-encoding increases latency, so it is recommended only when strict adherence to VBV (HRD) conformance is required.
Please note that encoder cannot guarantee HRD conformance when multicoreJointMode is set to 1, so it is recommended not enable vbvBufferReencode in multicoreJointMode.
For AV1 encoding, if multicoreJointMode is set to 1, vbvBufferReencode is not supported.
| Not Applicable | JPEG |
| Supported Values | - 0: Disable - 1: Enable |
| Default | 0 |
vbvMaxRate
The vbvMaxRate parameter sets the maximum bitrate limit during encoding in Constrained VBR mode and Capped CRF mode. Compared to ABR mode, in which vbvBufferSize and vbvMaxRate are both set to 0, and CBR mode, in which vbvBufferSize is set to valid non-zero values and vbvMaxRate is set to 0, Constrained VBR mode requires vbvBufferSize and vbvMaxRate both set to valid non-zero values. In Capped CRF mode, encoder implicitly takes bitrate as the maximum bitrate limit if vbvMaxRate is not set; otherwise, encoder will take vbvMaxRate as the maximum bitrate limit when it is set. Please refer to Section “8.3.4 CRF & Capped CRF Descriptions and Examples” for more details.
In Constrained VBR mode, bitrate parameter specifies the average bitrate, while vbvMaxRate sets the maximum bitrate limit. The instantaneous (per frame) bitrate fluctuation, however, is constrained by vbvBufferSize – larger VBV buffer may result in higher instantaneous bitrate fluctuation.
Constrained VBR mode sample FFmpeg command –
ffmpeg -c:v h264_ni_quadra_dec -i crowdrun_1920x1080.264 -c:v h264_ni_quadra_enc -xcoder-params "RcEnable=1:bitrate=3000000:vbvMaxRate=6000000:vbvBufferSize=1000" quadra.h264
In Constrained VBR mode, bitrate parameter specifies the average bitrate, while vbvMaxRate sets the maximum bitrate limit. The instantaneous (per frame) bitrate fluctuation, however, is constrained by vbvBufferSize – larger VBV buffer may result in higher instantaneous bitrate fluctuation.
In Constrained VBR mode, vbvBufferSize must be > = average bits per frame, which can be calculated by 1000 / framerate (in unit of ms). Also note that encoder will reject configuration if vbvBufferSize < (1000 / framerate)
In Constrained VBR mode, vbvMaxRate must be > = bitrate. Also note that encoder will reject configuration if vbvMaxRate < bitrate
Please also note that bitrate must also be specified along with vbvBufferSize, including Capped CRF mode and Constrained VBR mode in which the vbvMaxRate might have already been specified. This is because both bitrate and vbvBufferSize parameters are required to calculate the actual buffer size, and vbvMaxRate does not serve as replacement in the aforementioned calculation.
| Not Applicable | JPEG |
| Supported Values | - 0 (disable), or any value > = bitrate. - Encoder will reject configuration if vbvMaxRate < bitrate. |
| Default | 0 |
The following table provides a brief overview of min, max, average runtime bitrate as handled and reported by various supported bitrate controls
| Types of bitrate control | Brief Definition | vbvBufferSize | vbvMaxRate | Runtime bitrate variation compared to bitrate setting |
|---|---|---|---|---|
| ABR (Average Bit Rate) | In ABR mode, rate control maintains average bitrate to match target bitrate, but is not constrained by VBV buffer, and therefore instant bitrate can fluctuate more compared to CBR. On the other hand, in ABR mode, the average bitrate will be more closely matching the target bitrate. | 0 | 0 | Average bitrate ~= bitrate parameter value |
| CBR (Constant Bit Rate) | In CBR mode, rate control is bound by the VBV buffer constraint, and therefore the instant bitrate will be limited and more stable. | 10-3000 | 0 | Instant bitrate (per second) is constrained by bitrate parameter value Average bitrate < = bitrate parameter value (NOTE – bitrate can be lower than target due to bits saving when bitrateMode = 0, please refer to bitrateMode parameter description for more details) |
| Constrained VBR (Constrained Variable Bit Rate) | Compared to CBR mode, Constrained VBR mode allows higher instant bitrate, and therefore may produce higher quality at the cost of higher peak rate | 10-3000 | value > = bitrate setting | Instant bitrate (per second) is constrained by vbvMaxRate parameter value Average bitrate < = bitrate parameter value (NOTE – bitrate can be lower than target due to bits saving when bitrateMode = 0, please refer to bitrateMode parameter description for more details) |
| Capped CRF (Capped Constant Rate Factor) | In Capped CRF mode, the encoder attempts to maintain constant subjective quality, while bitrate is capped by a maximum bitrate limit. (The user may also add a minimum bitrate limit if needed) | 10-3000 | value > = bitrate setting (NOTE – if vbvMaxRate is not set, maximum bitrate limit is implicitly set to be equal to `bitrate` parameter) | Instant bitrate (per second) is constrained by bitrate parameter value Average bitrate < = bitrate parameter value |
fillerEnable
When enabled, the HRD compliance algorithm may insert filler NAL units to prevent VBV (CPB) buffer underflow. Filler insertion is supported in the following rate control modes:
- CBR mode
- Capped CRF mode (when vbvMinRate is specified)
If neither rcEnable nor crf is specified, setting fillerEnable=1 implicitly enables CBR rate control with HRD conformance. In this case:
- rcEnable is automatically set to 1
- vbvBufferSize is set to the default value of 3000
If bitrate is not specified, libxcoder uses a default bitrate of 200 kbps.
In Capped CRF mode, vbvMinRate must be specified to enable filler insertion. When enabled, the encoder inserts filler NAL units as needed to prevent CPB buffer underflow at the user-specified minimum bitrate.
Enabling fillerEnable can slow down the encoder depending on the amount of filler data added.
| Not Applicable | AV1 and JPEG |
| Supported Values | - 0: Disable - 1: Enable |
| Default |
picSkip
When enabled, the HRD algorithm can skip pictures when the VBV (CPB) buffer overflows. HRD rate control is enabled when rcEnable is 1 and vbvBufferSize > 0.
If picSkip is enabled, and the maximum output size has been specified with either MaxFrameSize(Deprecated), MaxFrameSize_Bits or MaxFrameSize_Bytes, then the encoder will discard any frames whose output size exceeds the specified size.
When enabled, the gopPresetIdx must be 1, 3, 7, 9, 10 (or 0 if the custom gop encodes in consecutive order), lookaheadDepth and multicoreJointMode must be 0
picSkip can cause loss of SEI packets, do not enable picSkip if the application requires SEI in the bitstream
| Not Applicable | JPEG |
| Supported Values | - 0: Disable - 1: Enable |
| Default | 0 |
skipFrameEnable
When enabled, the encoded frame will be forced to be a skip frame, meaning that all macroblocks are encoded as skip mode macroblocks when VBV buffer overflows.
When enabled, the gopPresetIdx must be 1, 3, 7, 9, 10(or 0 if the customer gop encodes in consecutive order). Otherwise, the video will have ghosting visual effects.
This parameter can be used with maxConsecutiveSkipFrameNum, which can be used to limit the maximum number of consecutive skip frames. This parameter can be used with skipFrameInterVal, which can be used to force the insertion of a skip frame every skipFrameInterVal frames.
Although it can limit the bit rate, there may be additional unknown issues. Please use this parameter when you are clear about what you are doing.
| Not Applicable | JPEG |
| Supported Values | - 0: Disable - 1: Enable |
| Default | 0 |
maxConsecutiveSkipFrameNum
Specify the maximum number of consecutive skip frames. This parameter only takes effect when the skipFrameEnable is enabled.
A value that is too large may cause the video to appear sluggish. It is recommended that the value be less than 5.
| Not Applicable | JPEG |
| Supported Values | Values greater than or equal to 0 |
| Default | 1 |
skipFrameInterVal
Specify the insertion of a skip frame every skipFrameInterVal frame interval. This parameter only takes effect when the skipFrameEnable is enabled.
This parameter may improve the image quality of certain videos, but it may not have a significant effect on optimizing the quality of certain videos. Also, if the encoding frame rate is low or if the skipFrameInterVal is too small, there may be lag phenomenon. It is recommended that the value in the range of 7 to 10 for 30fps encoding.
| Not Applicable | JPEG |
| Supported Values | 0 - 255 |
| Default | 0 |
stillImageDetectLevel
Specify the level of detection for static frames. Setting different levels is because the definition of static is sometimes very subjective, and different scenarios have slightly different requirements for static.
The levels are divided into two categories: 1-3 and 4-6. Levels 1-3 do not require additional resources and do not reduce performance, but their accuracy is not as high as levels 4-6.
The larger the value of level, the stricter the judgment of whether it is a static frame. When the level value is large, only when the image is completely still, it is judged as a static frame. When the level value is small, if there are very small changes in the image (such as a change area that may only be 1%-3% of the entire image), it will also be considered a still image.
The detection of still Image is after encoding one frame. Currently the param is only supported with gopPresetIdx=9.
| Not Applicable | JPEG |
| Supported Values | 0 - 6 |
| Default | 0 |
sceneChangeDetectLevel
Specify the level of detection for scene change. Setting different levels is because the definition of static is sometimes very subjective, and different scenarios have slightly different requirements for scene change.
The levels are divided into two categories:1-5 and 6-10. Levels 1-5 do not require additional resources and do not reduce performance, but their accuracy is not as high as Levels 6-10.
The same as the above stillImageDetectLevel, the larger the value of level, the stricter the judgment of whether it is a scene change. When the level value is large, only the current frame is completely different from the before frame, will be considered a scene change. When the level is small, there is a significant difference between the current frame and the previous frame, it may be considered a scene change.
The detection of scene Change is after encoding one frame. Currently the param is only supported with gopPresetIdx=9
| Not Applicable | JPEG |
| Supported Values | 0 - 10 |
| Default | 0 |
maxFrameSize -- DEPRECATED
The maxFrameSize parameter has been deprecated and should NOT be used. Use the more explicit maxFrameSize_Bytes parameter instead (see below), which is equivalent of the maxFrameSize. Using the new maxFrameSize_Bytes parameter will also make the Quadra application code easier to understand.
Specifies the maximum allowable output byte count for any frame (please note the unit of maxFrameSize is in bytes). While encoding, the encoder will re-encode the frame with higher QP if the output byte count exceeds the maxFrameSize. This process will continue until the output byte count becomes less than maxFrameSize. If the QP has been increased to the maxQP but the output byte count still exceeds maxFrameSize, the encoder will either produce the output, or if picSkip is enabled, it will discard the output (see the picSkip parameter description).
Note that maxFrameSize is only valid if lowDelay is enabled. If lowDelay is disabled, maxFrameSize parameter will be rejected. If lowDelay is enabled, but maxFrameSize is not specified in the command line, libxcoder will set maxFrameSize to the default value, which is ½ of the input frame size.
This feature can also be used to limit the maximum frame size to a multiple of the average frame size, using the ratio keyword. For example, maxFrameSize=ratio[8] will limit the maximum frame size to be no more than 8 times the average frame size calculated by the libxcoder.
If the bitrate or framerate is reconfigured via the libxcoder API, the encoder will automatically adjust the maxFrameSize to adapt to the new bitrate or framerate. User applications may also reconfigure the maxFrameSize via the libxcoder API to override the encoder auto adjusted maxFrameSize value (see Libxcoder API Integration Guide).
Quadra only supports using one of the 3 maxFrameSize parameters at a time. For example, only use either the maxFrameSize (Deprecated), or the maxFrameSize_Bits or the maxFrameSize_Bytes within the same command. It is recommended to use the maxFrameSize_Bytes only.
| Not Applicable | JPEG |
| Supported Values | Acceptable values range from the minimum of bitrate divided by framerate, to the maximum of the input frame size |
| Default | ½ of input frame size |
maxFrameSize_Bytes
The maxFrameSize_Bytes parameter is equivalent of maxFrameSize which has been deprecated. The user should use this more explicit maxFrameSize_Bytes parameter rather than maxFrameSize to make the Quadra application code more readable.
Specifies the maximum allowable output byte count for any frame. The size specified with maxFrameSize_Bytes is bytes. While encoding, the encoder will re-encode the frame with higher QP if the output byte count exceeds maxFrameSize_Bytes. This process will continue until the output byte count becomes less than maxFrameSize_Bytes. If the QP has been increased to the maxQP but the output byte count still exceeds maxFrameSize_Bytes, the encoder will either produce the output, or if picSkip is enabled, it will discard the output (see the picSkip parameter description).
Note that maxFrameSize_Bytes is only valid if lowDelay is enabled. If lowDelay is disabled, the maxFrameSize_Bytes parameter will be rejected. If lowDelay is enabled, but maxFrameSize_Bytes is not specified in the command line, the libxcoder will set maxFrameSize_Bytes to the default value, which is ½ the input frame size.
This feature can also be used to limit the maximum frame size to a multiple of the average frame size, using the ratio keyword. For example, maxFrameSize_Bytes =ratio[8] will limit the maximum frame size to be no more than 8 times the average frame size calculated by the libxcoder.
If specified maxFrameSize_bytes is less than (bitrate/framerate), libxcoder will adjust maxFrameSize_bytes to (bitrate/framerate).
If the bitrate or framerate is reconfigured via the libxcoder API (see the Libxcoder API Integration Guide), then the encoder will automatically adjust the maxFrameSize_Bytes to adapt to the new bitrate or framerate. User applications may also reconfigure the maxFrameSize_Bytes via the libxcoder API to override the encoder auto adjusted maxFrameSize_Bytes (again refer to the Libxcoder API Integration Guide).
Quadra only supports using one of the 3 maxFrameSize parameters at a time. For example, only use either the maxFrameSize (Deprecated), or the maxFrameSize _Bits or the maxFrameSize_Bytes within the same command. It is recommended to use maxFrameSize_Bytes only.
| Not Applicable | JPEG |
| Supported Values | Acceptable values range from max((bitrate / 8 / framerate), 2000) and input_frame_size bytes |
| Default | ½ of input frame size in bytes |
maxFrameSize_Bits
Specifies the maximum allowable output bit count for any frame (please note the unit of maxFrameSize_Bits is in bits). While encoding, the encoder will re-encode the frame with a higher QP if the output bit count exceeds the maxFrameSize_Bits. This process will continue until the output bit count becomes less than the maxFrameSize_Bits. If the QP has been increased to the maxQP but the output bit count still exceeds maxFrameSize_Bits, the encoder will either produce the output, or if picSkip is enabled it will discard the output (see the picSkip parameter description).
Note that maxFrameSize_Bits is only valid if lowDelay is enabled. If lowDelay is disabled, maxFrameSize_Bits parameter will be rejected. If lowDelay is enabled, but maxFrameSize_Bits is not specified in the command line, libxcoder will set maxFrameSize_Bits to the default value, which is ½ of the input frame size.
This feature can also be used to limit the maximum frame size to a multiple of the average frame size, using the ratio keyword. For example, maxFrameSize_Bits =ratio[8] will limit the maximum frame size to be no more than 8 times the average frame size calculated by the libxcoder.
If the bitrate or framerate is reconfigured via the libxcoder API (please refer to the Libxcoder API Integration Guide), then the encoder will automatically adjust the maxFrameSize_Bits to adapt to the new bitrate or framerate. User applications may also reconfigure the maxFrameSize_Bits via the libxcoder API to override the encoder auto adjusted maxFrameSize_Bits (refer to Libxcoder API Integration Guide).
Quadra only supports using one of the 3 maxFrameSize parameters at a time. For example, only use either the maxFrameSize (Deprecated), or the maxFrameSize _Bits or the maxFrameSize_Bytes within the same command.
It is recommended to use maxFrameSize_Bytes only.
| Not Applicable | JPEG |
| Supported Values | Acceptable values range from bitrate divided by framerate (min) to input frame size (max) |
| Default | ½ of input frame size in bits |
crf
This parameter enables Constant Rate Factor mode. CRF is a constant subjective quality mode as opposed to normal rate control which adjusts quality to maintain constant bitrate (CBR). On the other hand, it is not possible to predict the bitrate a CRF encode will come out to. CRF values range from 0 to 51, lower value indicates higher quality and higher value indicates lower quality. The recommended CRF value is 23.
CRF can also be used together with bitrate, vbvBufferSize, vbvMaxRate, vbvMinRate parameters to maintain a consistent quality level, while the maximum (and minimum) bitrate cap prevents the bitrate from exceeding a certain threshold – this mode is referred to as Capped CRF mode. For more details and examples of Capped CRF encode parameters, please refer to Section 8.3.4 “CRF & Capped CRF Examples”.
When CRF mode is enabled, rcEnable must be 0
CRF mode can be enabled with lookahead (lookaheadDepth 4~40) or without lookahead (lookaheadDepth 0), the supported GOP patterns in each mode are described below
- CRF with lookaheadDepth 0 – supports gopPresetIdx -1 (adaptive gop), 0 (custom gop), 1, 4, 5, 8, 9
- CRF with lookaheadDepth > 0 – supports gopPresetIdx -1 (adaptive gop), 0 (custom gop), 4, 5, 8, 9
| Not Applicable | JPEG |
| Supported Values | 0-51 |
| Default | -1 (disabled) |
crfFloat
This parameter enables Constant Rate Factor mode. Supports floating-point numbers with 2 decimal places. CRF is a constant subjective quality mode as opposed to normal rate control which adjusts quality to maintain constant bitrate (CBR). On the other hand, it is not possible to predict the bitrate a CRF encode will come out to. CRF values range from 0.00 to 51.00, lower value indicates higher quality and higher value indicates lower quality. The recommended CRF value is 23.00.
CRF can also be used together with bitrate, vbvBufferSize, vbvMaxRate, vbvMinRate parameters to maintain a consistent quality level, while the maximum (and minimum) bitrate cap prevents the bitrate from exceeding a certain threshold – this mode is referred to as Capped CRF mode. For more details and examples of Capped CRF encode parameters, please refer to Section 8.3.4 “CRF & Capped CRF Examples”.
When CRF mode is enabled, rcEnable must be 0
CRF mode can be enabled with lookahead (lookaheadDepth 4~40) or without lookahead (lookaheadDepth 0), the supported GOP patterns in each mode are described below
- CRF with lookaheadDepth 0 – supports gopPresetIdx -1 (adaptive gop), 0 (custom gop), 1, 4, 5, 8, 9
- CRF with lookaheadDepth > 0 – supports gopPresetIdx -1 (adaptive gop), 0 (custom gop), 4, 5, 8, 9
| Not Applicable | JPEG |
| Supported Values | 0.00-51.00 |
| Default | -1.00 (disabled) |
qpScaleEnable
The qpScaleEnable parameter enables the QP scaling algorithm in CRF mode, improving compression efficiency under limited lookahead conditions, such as in live-streaming scenarios.
The qpScaleEnable parameter is supported only in CRF and Capped CRF modes, and only when lookahead is enabled.
The adaptiveCrfMode parameter is not supported when qpScaleEnable is set.
The enableSmoothCrf parameter is not required when qpScaleEnable is enabled, because the QP scaling algorithm honors the fractional value of crfFloat.
| Not Applicable | JPEG |
| Supported Values | - 0 (disable) - 1 (enabled) |
| Default | 0 |
crfMaxIframeEnable
The crfMaxIframeEnable parameter allows encoder to produce higher quality I-frames in Capped CRF mode (with lookahead enabled) to improve quality. The side effect is that I-frame bit count will be increased, which may not be ideal in scenarios where bitrate spike is unacceptable. When enabled, the user can select from mode 1 (MEDIUM, legacy) mode 2 (HIGH, legacy) mode 5 (MEDIUM) and mode 6 (HIGH) which offer different I-frame bits allocation policies, as described below –
| I-frame bits allocation policy | Pros & Cons | |
|---|---|---|
| Mode 1 (MEDIUM, legacy) | I-frame is allowed to use all remaining bits in the VBV buffer | Mode 1 is the predecessor of Mode 5, user is recommended to use Mode 5 instead of Mode 1 |
| Mode 2 (HIGH, legacy) | I-frame is allowed to use as many bits as it needs for quality, without being constrained by VBV buffer | Mode 2 is the predecessor of Mode 6, user is recommended to use Mode 6 instead of Mode 2 |
| Mode 5 (MEDIUM) | I-frame is allowed to use all remaining bits in the VBV buffer | MEDIUM mode improves I-frame quality. Instant bitrate fluctuation is still confined by VBV buffer constraint |
| Mode 6 (HIGH) | I-frame is allowed to use as many bits as it needs for quality, without being constrained by VBV buffer | HIGH mode ensures I-frame quality, at the cost of higher instant bitrate fluctuation / bitrate spike |
| Mode 7 (OPTIMAL) | I-frame bit budget is based on prediction of future frames complexity | OPTIMAL mode is recommended only for encoding under limited lookahead conditions, such as in live-streaming scenarios |
The crfMaxIframeEnable parameter is only supported in Capped CRF mode with lookahead enabled
| Not Applicable | JPEG |
| Supported Values | - 0: Disable - 1: (MEDIUM, legacy) - 2: (HIGH, legacy) - 5: (MEDIUM) I-frame utilize all remaining VBV buffer - 6: (HIGH) I-frame is not constrained by VBV buffer - 7: (OPTIMAL) I-frame bit budget is based on prediction of future frames complexity |
| Default | 0 |
enableSmoothCrf
The enableSmoothCrf parameter determines whether the size curve of the encoded stream will be smoothed when different crfFloat values are set to foloating-point type. Without enabling this parameter, the size of the encoded stream size may increase as the crfFloat value increases. If this parameter is enabled, the size of the encoded stream decreases as the crfFloat value increases.
This parameter will only take effect when crfFloat is set.
The enableSmoothCrf parameter is not required when qpScaleEnable is enabled.
| Not Applicable | JPEG |
| Supported Values | - 0 (disable) - 1 (enabled) |
| Default | 0 |
vbvMinRate
The vbvMinRate parameter sets the minimum bitrate limit during encoding in Capped CRF mode. (NOTE – unlike vbvMaxRate parameter which takes effect in both Constrained VBR mode and Capped CRF mode, vbvMinRate only takes effect in Capped CRF mode.)
In Capped CRF mode, if vbvMinRate is not set, the encoder will not constrain bitrate by a minimum bitrate limit (only limit maximum bitrate). If vbvMinRate is set, the encoder will produce more bits to meet the minimum bitrate, which may also raise quality to be higher than the specified consistent quality level (which depends on crf parameter value) when bits required at specified quality level is lower than the minimum bitrate. Please refer to Section “8.3.4 CRF & Capped CRF Descriptions and Examples” for more details.
Capped CRF mode sample FFmpeg command with vbvMinRate –
ffmpeg -f rawvideo -pix_fmt yuv420p -s 1920x1080 -r 30.0 -i input1920x1080.yuv -c:v h265_ni_quadra_enc -xcoder-params "gopPresetIdx=5:RcEnable=0:crf=23:lookAheadDepth=10:vbvBufferSize=1000:bitrate= 3200000:vbvMinRate=1000000" output1920x1080.h265
vbvMinRate must be < = bitrate. Also note that encoder will reject configuration if vbvMinRate > bitrate
| Not Applicable | JPEG |
| Supported Values | 0 (disable), or any value < = bitrate. Encoder will reject configuration if vbvMaxRate > bitrate. |
| Default | 0 |
qcomp
This parameter affects how much bitrate is given to important scenes as opposed to unimportant scenes for subjective quality. Only effective in CRF mode.
qcomp takes effects only if crf is set
| Not Applicable | JPEG |
| Supported Values | 0.0 to 1.0 |
| Default | 0.6 |
ipRatio
Modifies average I-frames bit count increase as compared to P-frames. Higher values increase the quality of I-frames generated. Only effective in CRF mode.
ipRatio takes effects only if crf is set. If want to enable ipRatio in CBR or VBR mode, should set enableipRatio to 1.
| Not Applicable | JPEG |
| Supported Values | 0.01 to 10.0 |
| Default | 1.40 |
enableipRatio
Enable or disable the ipRatio when in CBR and VBR mode. This parameter only affect ipRatio in CBR and VBR mode. If crf is set, ipRatio always works, regardless of whether enableipRatio is enabled or not.
If you don’t want to using ipRatio in CBR or VBR, please also not setting enableipRatio either.
| Not Applicable | JPEG |
| Supported Values | 0 to 1 |
| Default | 0 |
iFrameSizeRatio
Specifies the ratio of I frame size to default I frame size. The ratio of the frame size is not exactly the same as the specified ratio, they are just approximate. This is influenced by different bitrate control algorithms.
Please do not use ipRatio and iFrameSizeratio together.
| Not Applicable | JPEG |
| Supported Values | integer 1 to 300 |
| Default | 100 |
pbRatio
Modifies average B-frames bit count decrease as compared to P-frames. Higher values decrease the quality of B-frames generated. Only effective in CRF mode.
pbRatio takes effects only if crf is set
| Not Applicable | JPEG |
| Supported Values | 0.01 to 10.0 |
| Default | 1.30 |
cplxDecay
This parameter affects how fast the past frames complexity decays when encoder decides current frame quantization based on complexity. Only effective in CRF mode.
cplxDecay takes effects only if crf is set
| Not Applicable | JPEG |
| Supported Values | 0.1 to 1.0 |
| Default | 0.5 |
chromaQpOffset
Offset of Cb/Cr chroma quantization from the luma quantization selected by rate control. This is a general way to specify encoder spending more or less bits on the chroma channel.
| Not Applicable | JPEG |
| Supported Values | **-**12 to 12 |
| Default | 0 |
hvsQPEnable
Enable or disable block level QP adjustment for subjective quality enhancement.
| Not Applicable | JPEG |
| Supported Values | - 0: Disable - 1: Enable |
| Default | 0 |
hvsBaseMbComplexity
Base complexity of block level QP adjustment for subjective quality. A higher base complexity value will result in higher subjective quality, at the cost of increased bit count. In low target bitrate use case, increasing base complexity value may cause actual bitrate to be higher than the target bitrate. Default base complexity value is 15.
hvsBaseMbComplexity only takes effects if hvsQPEnable is set to 1
| Not Applicable | JPEG |
| Supported Values | 0 to 31 |
| Default | 15 |
CuLevelRCEnable
Enable or disable coding unit level rate control.
Enabling CU level RC with lookahead (E.g. cuLevelRc=1 and lookaheadDepth > 0) is generally not recommended, because CU level RC may cause quality degradation to lookahead encode. The only scenario CU level RC should be enabled together in lookahead encode would be when instantaneous bitrate constraint or HRD conformance must be strictly followed – in which case CU level RC would be needed to constraint the bitrate
If this flag is 1 and intraPeriod is small (i.e. < 30), I frame flickering for static scene can be observed. If this happens, either set tolCtbRcIntra=-1 to disable CU level rate control of I-frames, or increase tolCtbRcIntra > 1 so that CU level rate control will give I-frame bits large tolerance to work around this issue.
| Applicable | This value is valid when RCEnable is 1 (ABR or CBR mode), or when crf, bitrate, and vbvBufferSize are set (Capped CRF mode) |
| Not Applicable | JPEG |
| Supported Values | - 0: Disable - 1: Enable |
| Default | 0 |
tolCtbRcInter
Tolerance of CU level rate control for P-frames and B-frames (aka INTER frames). CU level rate control will enforce INTER frame bits limit within the range of: [ ExpectedBits * (1 – tolCtbRcInter), ExpectedBits * (1 + tolCtbRcInter)], except for -1 and 0 as described below:
- If
tolCtbRcInter == -1, CU level rate control is disabled for INTER frames - If tolCtbRcInter == 0, CU level rate control adjust INTER frames bits according to the current VBV buffer level. The total VBV buffer size can be configured by vbvBufferSize.
tolCtbRcInter only takes effects if cuLevelRCEnable is set to 1
| Not Applicable | JPEG |
| Supported Values | - -1: CU level rate control is disabled for P/B-frames - 0: CU level rate control adjust P/B-frame bits according to current VBV buffer level - \ > 0: CU level rate control adjust P/B-frames bits according to the tolerance setting, which is applied to the target picture size as described above |
| Default | 0.1 |
tolCtbRcIntra
Tolerance of CU level rate control for I-frames (aka INTRA frames). CU level rate control will enforce INTRA frame bits limit within the range of: [ ExpectedBits * (1 – tolCtbRcIntra), ExpectedBits * (1 + tolCtbRcIntra)], except for -1 and 0 as described below:
- If
tolCtbRcIntra == -1, CU level rate control is disabled for I-frames - If
tolCtbRcIntra == 0, CU level rate control adjust I-frames bits according to the current VBV buffer level. The total VBV buffer size can be configured by vbvBufferSize.
tolCtbRcIntra only takes effects if cuLevelRCEnable is set to 1
| Not Applicable | JPEG |
| Supported Values | - -1: CU level rate control is disabled for I-frames - 0: CU level rate control adjust I-frames bits according to the current VBV buffer level - \ > 0: CU level rate control adjust I-frames bits according to the tolerance setting, which is applied to the target picture size as described above |
| Default | 0.1 |
rcQpDeltaRange
Max absolute value of CU/MB QP delta relative to frame QP in CTB RC.
It controls maximum range CU/MB QP is allowed to vary within a frame.
rcQpDeltaRange only takes effects if cuLevelRCEnable = 1 or hvsQPEnable = 1.
| Not Applicable | JPEG |
| Supported Values | - 0 to 15 - 0 = effectively disables cuLevelRCEnable and/or hvsQPEnable |
| Default | 10 |
bitrateWindow
Specifies the bitrate window length in frames. Rate control allocates bits for one window and tries to match the target bitrate at the end of each window. This enforces an average target bit rate within the window interval, allowing encoder to adapt to changes of complexity on video input and variations on compression efficiency between frames. Typically window begins with an intra frame, but this is not mandatory.
By default bitrateWindow = intraPeriod
If intraPeriod = 0 (infinite period), bitrateWindow = 150
| Not Applicable | JPEG |
| Supported Values | 1 to 300 |
| Default | equals intraPeriod |
ctbRowQpStep
The maximum accumulated QP adjustment step per CTB Row allowed by CU level rate control. Increasing ctbRowQpStep helps reduce instant bitrate spike / overshoot, but it may also reduce compression efficiency. CU level rate control QP step per CTB is calculated by
QP_step_per_CTB = MIN((ctbRowQpStep / Ctb_per_Row),4)
If ctbRowQpStep == 0, Quadra will use pre-defined ctbRowQpStep value [4] for H.264 and [16] for HEVC.
The maximum effective value of ctbRowQpStep = CTB per Row * 4.
For example, if input resolution is 1920x1080, CTB per row = 1920 / 64 = 30, and maximum effective ctbRowQpStep = 30 * 4 = 120. A larger value is also accepted, but will have the same effects as the maximum effective value.
ctbRowQpStep only takes effects if cuLevelRCEnable is set to 1
| Not Applicable | JPEG |
| Supported Values | 0 to 500, setting 0 will cause Quadra to use pre-defined ctbRowQpStep value [4] for H.264 and [16] for HEVC |
| Default | 0 |
enableAcqLimit
Whether to enable encoder to limit its upstream’s output buffering count. Enabling this option could prevent the upstream instance outputting more buffers than encoder needs.
enableAcqLimit is enabled by default for FFmpeg-n6.1, FFmpeg-n7.1, FFmpeg 7.1.3,FFmpeg-n8.0.1 and FFmpeg-n8.1.
| Not Applicable | NA |
| Supported Values | - 0: disabled - 1: enabled. |
| Default | 0 |
customizeQpLevel
Specifies the level of the roi map. When customizeQpLevel > 0. Customize roi map will take effect after cutree in 2pass.
It supports to set roi map when crf enable and lookahead enable, the roi qp info must be same in one CTU, CTU size 16x16 for h264, 64x64 for h265 and av1
| Applicable | FFmpeg 3.4.2 and above |
| Not Applicable | JPEG |
| Supported Values | - 0: disable - 1: only take effect in 2-pass, use with customizeQpMapFile, roimap qp is index of customizeQpMapFile, the qp after ratecontrol will match to the customizeQpMapFile to obtain the final qp - 2: only take effect in 2-pass, replace the cutree roimap with the input roimap - 3: only take effect in 2-pass, if the value of block in roimap is not 0, overwrite the cutree roimap with the input roimap - 4: only take effect in 2-pass, if the value of block in roimap is not 0 and allow addition, add the input roimap into the cutree roimap |
| Default | 0 |
customizeQpMapFile
Specifies the name of the qp map file. It will take effect when ROI is enabled (roiEnable=1) and customizeQpLevel is 1. customizeQpMap is currently only supported on FFmpeg 3.4.2 and above. It supports qp info from 1 to 10, supports qp value from 0 to 63. The qp_info in roi block indicates the row number it chooses in customizeQpMapFile. And it will choose qp value in customizeQpMapFile table after rate control, the qp after rate control indicates the column number and qp_info indicates the row number. The qp map file must be created in the same directory where the command is running. The file contains one line or multiple lines of qp value map
| Not Applicable | JPEG |
| Applicable | FFmpeg 3.4.2 and above |
enableCompensateQp
It only takes effect when maxframesize > 0. XCoder firmware will record the previous frame first qp and ssim when previous frame trigger re-encode because of maxframesize. And re-encode with lower qp for next frame if its ssim different from last time is greater than the threshold
After re-encode, it will keep frame size < maxframesize, and if maxframesize is too low, it will re-encode repeated, fps will drop and psnr won’t improve
| Not Applicable | JPEG and AV1 |
| Supported Values | - 0: Disable - 1: Enable |
| Default | 0 |
adaptiveLamdaMode
This param is trying to optimize BD-rate for hevc encode with lookahead, It only takes effect when lookahead > = 4. XCoder firmware will adjust lambda of I frame based on the distortion ratio of I frame and P frame and adjust ipratio based on intra ratio and skip ratio in a gop
To get better BD-rate, used with encoder param enableSmoothCrf=1:cuTreeFactor=6: qcomp=0.535:ipRatio=1.5:pbRatio=0.917 and adaptiveLamdaMode will take over ipratio and pbratio
| Not Applicable | HEVC |
| Supported Values | - 0: Disable - 1: adjust I frame lambda, use adaptive ipratio and pbratio - 2: limit max ipratio based on mode 1 |
| Default | 0 |
adaptiveCrfMode
It only takes effect in capped-crf mode in pass2. This param will adjust crf when qp is capped by vbvbuffer to reduce qp capped in later gop, it will also adjust vbvMaxRate, allow to get better quality in complex picture. Worse quality should be better than before.
It would be better to set vbvBufferSize to 3000
The adaptiveCrfMode parameter is not supported when qpScaleEnable is set.
| Not Applicable | JPEG |
| Supported Values | - 0: Disable - 1: adjust crf every I frame - 2: adjust crf every second |
| Default | 0 |
intraCompensateMode
It only takes effect in crf mode in pass2. This param will compensate qp when frame intra ratio is high in pass1 encode, it will optimize subjective image quality in complex scenarios.
Enable intraCompensateMode will lead to an increase in instantaneous bitrate and overall bitrate
| Not Applicable | JPEG |
| Supported Values | - Disable for value 0 - Enable for value from 1 to 3, higher value is, more qp compensate |
| Default | 0 |