June 16, 2016

Intel QuickSync H.264 encoder parameters in Nimble Streamer Transcoder

Intel® Quick Sync technology provides efficient encoding capabilities. It allows using hardware acceleration for video encoding using Intel® processors feature set and software encoding in all other cases.

Nimble Streamer Transcoder allows using Intel® Quick Sync as a H.264 video encoder in transcoding scenarios.

Library and SDK installation instructions can be found on QuickSync support page.

Here we'll take a look at encoder settings available at the moment.

First of all, take a look at Quick Sync encoder usage in our web UI.


As you see, it takes just a few clicks to use Quick Sync as encoder.

Now let's see what parameters you can use there in order to control encoding process. It's similar to previously described libx264 encoder settings but it has its specifics. In the encoder settings dialog box you can add any of the parameters described below.



preset

It's mapped to target usage and indicates trade-offs between quality and speed. The application can use any number in the range. The actual number of supported target usages depends on implementation.

  • "ultrafast"  - best speed
  • "veryfast"
  • "faster"
  • "fast"
  • "medium" - balanced
  • "slow"
  • "slower"
  • "veryslow" - best quality


profile

Specifies the codec profile use it explicitly or the Quick Sync functions will determine the correct profile from other sources, such as resolution and bitrate.
"baseline"
"main"
"high"
"extended"
"high422"

async_depth

Specifies how many asynchronous operations an application performs before the application explicitly synchronizes the result. If zero, the value is not specified. Set async_depth=1 to low latency encoding. Read this article for more details.

level

Specifies the codec level.

  • 0 - Unspecified codec level, determine the correct level from other sources, such as resolution and bitrate
  • 1
  • 1b
  • 11
  • 12
  • 13
  • 2
  • 21
  • 22
  • 3
  • 31
  • 32
  • 4
  • 41
  • 42
  • 5
  • 51
  • 52


keyint

Number of pictures within the current GOP (Group of Pictures).

  • 0 - the GOP size is unspecified
  • 1 - only I-frames are used.


bf

Maximum number of B frames between non-B-frames.
0 - unspecified,
1 - no B frames

cgop

Frames in this GOP do not use frames in previous GOP as reference. The encoder generates open GOP if this flag is not set. In this GOP frames prior to the first frame of GOP in display order may use frames from previous GOP as reference. Frames subsequent to the first frame of GOP in display order do not use frames from previous GOP as reference.
The AVC encoder ignores this flag if idr_interval is set to 0, i.e. if every GOP starts from IDR frame. In this case, GOP is encoded as closed. This flag does not affect long-term reference frames.

scenecut

The encoder must strictly follow the given GOP structure as defined by keyint parameter, bf etc. Otherwise, the encoder can adapt the GOP structure for better efficiency, whose range is constrained by keyint, bf parameters etc. See also description of i_adapt and b_adapt.

idr_interval

Specifies IDR-frame interval in terms of I-frames;

  • 0 - I-frame is an IDR-frame.
  • 1 - every other I-frame is an IDR-frame, etc.

If keyint or bf is zero, idr_interval is undefined.

rate_control

Sets bitrate control methods.

  • cbr - Use the constant bitrate control algorithm. "bitrate", "init_bufsize", "bufsize", "max_bitrate" - might be specified.
  • vbr - Use the variable bitrate control algorithm; "bitrate", "init_bufsize", "bufsize", "max_bitrate" - might be specified.
  • cqp -  Use the constant quantization parameter algorithm; "qpi", "qpp", "qpb" must be specified.
  • avbr - Use the average variable bitrate control algorithm. The algorithm focuses on overall encoding quality while meeting the "bitrate" specified bitrate, within the "accuracy" accuracy range, after a "convergence" period. This method does not follow HRD and the instant bitrate is not capped or padded. "bitrate", "accuracy", "convergence" must be set.
  • la - Use the VBR algorithm with look ahead. It is a special bitrate control mode in the encoder that has been designed to improve encoding quality. It works by performing extensive analysis of several dozen frames before the actual encoding and as a side effect significantly increases encoding delay and memory consumption. The only available rate control parameter in this mode is "bitrate". Two other parameters, "max_bitrate" and "init_bufsize", are ignored. To control LA depth the application can use "la_depth" parameter. This method is not HRD compliant.
  • icq - Use the Intelligent Constant Quality algorithm. This algorithm improves subjective video quality of encoded stream. Depending on content, it may or may not decrease objective video quality. Only one control parameter is used - quality factor, specified by "icq_quality"
  • vcm - Use the Video Conferencing Mode algorithm. This algorithm is similar to the VBR and uses the same set of parameters "init_bufsize", "bitrate" and "max_bitrate". It is tuned for IPPP GOP pattern and streams with strong temporal correlation between frames. It produces better objective and subjective video quality in these conditions than other bitrate control algorithms. It does not support interlaced content, B frames and produced stream is not HRD compliant.
  • la_icq - Use intelligent constant quality algorithm with look ahead. Quality factor is specified by "icq_quality". To control LA depth the application, use "la_depth" parameter. This method is not HRD compliant.
  • la_hrd - Use HRD compliant look ahead rate control algorithm.
  • qvbr - Use the variable bitrate control algorithm with constant quality. This algorithm trying to achieve the target subjective quality with the minimum number of bits, while the bitrate constraint and HRD compliance are satisfied. It uses the same set of parameters as VBR and quality factor specified by "qvbr_quality".


bitrate

Sets bitrate in Kbps, must be specified for cbr and vbr

init_bufsize

Sets how full the rate buffer must be before playback starts. If is equal to zero, the value is calculated using bitrate, frame rate, profile, level and etc.

bufsize

Sets the size of the rate buffer in kilobits (Kb). If is equal to zero, the value is calculated using bitrate, frame rate, profile, level, and so on

max_bitrate

Set max bitrate in Kbps.

qpi, qpp, qpb

Quantization Parameters for I, P and B frames, respectively, for the CQP mode.
It's a value from 1…51 range, where 1 corresponds to the best quality. 0 uses Quick Sync default.

accuracy

AVBR accuracy in tenth of percent

convergence

AVBR Convergence period with 1..100 frames.

icq_quality

This parameter is for ICQ bitrate control algorithm.
It's a value from 1…51 range, where 1 corresponds to the best quality.

qvbr_quality

qvbr quality factor.
It's a value from 1…51 range, where 1 corresponds to the best quality.

slices

Number of slices in each video frame; each slice contains one or more macro-block rows.
If "slices" equals zero, the encoder may choose any slice partitioning allowed by the codec standard. Slices contain a fixed number of macroblock rows.  The number of rows per slice is automatically calculated.   When the number of rows is not evenly divisible slices may be different sizes (+/-1 row).

ref

Number of reference frames;
if "ref" = 0, this parameter is not specified.

pict_struct

Set picture structure

  • default is for progressive
  • tff is for tff;
  • bff is for bff;

cavlc

CAVLC value

  • 0 - CABAC is used;
  • 1 - CAVLC is used;

mbbrc

Setting this flag enables macroblock level bitrate control that generally improves subjective visual quality. Enabling this flag may have negative impact on performance and objective visual quality metric. The values are 0 and 1 for "off" and "on".

la_depth

Specifies the depth of look ahead rate control algorithm. It is the number of frames that encoder analyzes before encoding. Valid value range is from 10 to 100 inclusive. To instruct the encoder to use the default value the application should zero this field.

trellis

This option is used to control trellis quantization in AVC encoder.

  • 0 - Turn trellis quantization off for all frame types.
  • 1 - Turn on for I frames.
  • 2 - Turn on for I and P frames.
  • 3 - Turn on for I,P,B frames.

b_pyramid

This option controls usage of B frames as reference. This parameter is valid only during initialization.

  • 0 - Do not use B frames as reference.
  • 1 - Arrange B frames in so-called “B pyramid” reference structure.

i_adapt

This flag controls insertion of I frames by the encoder. Turn ON this flag to allow changing of frame type from P and B to I. This option is ignored if scenecut=1.

  • 0 - don't allow changing of frame type from P and B to I
  • 1 - allow changing of frame type from P and B to I

b_adapt

This flag controls changing of frame type from B to P. Turn ON this flag to allow such changing. This option is ignored if scenecut=1.


fps_n, fps_d
Set output FPS numerator and denominator. It only affects num_units_in_tick and time_scale fields in SPS.
If fps_n=30 and fps_d=1 then it's 30 FPS
If fps_n=60000 and fps_d=2002 then it's 29.97 FPS
Source stream FPS or filter FPS is used if fps_n and fps_d are not set.
Please also check Handling fuzzy FPS to get proper bitrate output article.


keep_sar

If your input stream is anamorphic you might need to save its SAR parameter in the output as well, especially if you’re using a 'scale' filter in your Transcoder pipeline while DAR = SAR x Width / Height. Nimble supports keeping input SAR using keep-sar parameter set to true for encoder in its ‘Video output’ section. SAR/DAR/PAR correlation is described in this article.


These are the parameters which you can use already in order to control Intel® Quick Sync video encoder.
We keep improving our transcoder feature set, contact us for any questions.

Related documentation


Live Transcoder for Nimble StreamerLive Streaming featuresTranscoder support for Intel® Quick Sync

Intel is a trademark of Intel Corporation in the U.S. and/or other countries.

No comments:

Post a Comment

If you face any specific issue or want to ask some question to our team,
PLEASE USE OUR HELPDESK

This will give much faster and precise response.
Thank you.

Note: Only a member of this blog may post a comment.