March 15, 2017

VA API (libVA) support in Nimble Streamer

Video Acceleration API (VA API) is a royalty-free API along with its implementation as free and open-source library (libVA). This API provides access to hardware-accelerated video processing, using hardware such as graphics processing units (GPU) to accelerate video encoding and decoding by offloading processing from CPU.

Supported codecs are H.264 and VP8.

Nimble Streamer supports VAAPI and allows using libVA in Live Transcoder as one of the options for encoding among other libraries and SDKs.

Let's see how you can start using libVA in Nimble Streamer Live Transcoder.


Open your transcoding scenario or create a new one.

Sample scenario
Click on encoding block "gear" icon for open details dialog.

Encoder settings dialog with vaapi as Encoder
Here you need to choose "vaapi" option from "Encoder" drop-down and use the Codec dropdown list to select from h264 and vp8.
Now you can fill in library-specific parameters like profile etc. Once you save encoder settings and save the scenario, libva will start working.

Check the description of all supported parameters below.

H.264 encoding parameters


profile

Specifies the codec profile. The values are:

  • high (this one is default)
  • main
  • contstrained baseline

level

Specifies the codec level (level_idc value * 10).
Default: 51 (Level 5.1, up to 4K30)

g, keyint

Number of pictures within the current GOP (Group of Pictures).
1 - only I-frames are used.
Default: 120

bf

Maximum number of B frames between non-B-frames.

  • 0 - no B frames (default)
  • 1 - IBPBP...
  • 2 - IBBPBBP... etc.

rate_control

Sets bitrate control methods.

  • cbr - Use the constant bitrate control algorithm. "bitrate", "init_bufsize", "bufsize", "max_bitrate" - might be specified.
  • cqp -  Use the constant quantization parameter algorithm; "qpi", "qpp", "qpb" might be specified.

Default: cbr if bitrate is set, cqp otherwise.

b, bitrate

Maximum bit-rate to be constrained by the rate control implementation. Sets bitrate in kbps.
Must be specified for cbr.

target_percentage

The bit-rate the rate control is targeting, as a percentage of the maximum bit-rate for example if target_percentage is 95 then the rate control will target a bit-rate that is 95% of the maximum bit-rate.
Default: 66%

windows_size_ms

windows size in milliseconds. For example if this is set to 500, then the rate control will guarantee the target bit-rate over a 500 ms window.
Default: 1000

initial_qp

Initial QP for the first I frames, 0 - encoder chooses the best QP according to rate control;
Default: 0

min_qp

Minimal QP frames, 0 - encoder chooses the best QP according to rate control;
Default: 0

bufsize

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

init_bufsize

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

qpi, qpp, qpb

Quantization Parameters for I, P and B frames, must be specified for CQP mode.
It's a value from 1…51 range, where 1 corresponds to the best quality.
Defult: 0

quality

Encoding quality - higher is worse and faster, 0 - use driver default.
Default: 0

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.

VP8 encoding parameters


The following parameters can be used if you select VP8 as your target codec.

g, keyint

Number of pictures within the current GOP (Group of Pictures).
1 - only I-frames are used.
Default: 120

rate_control

Sets bitrate control methods.


  • cbr - Use the constant bitrate control algorithm. "bitrate", "init_bufsize", "bufsize", "max_bitrate" - might be specified.
  • cqp -  Use the constant quantization parameter algorithm; "qpi", "qpp", "qpb" might be specified.

Default: cbr if bitrate is set, cqp otherwise.

b, bitrate

Maximum bit-rate to be constrained by the rate control implementation. Sets bitrate in kbps.
Must be specified for cbr.

target_percentage

The bit-rate the rate control is targeting, as a percentage of the maximum bit-rate for example if target_percentage is 95 then the rate control will target a bit-rate that is 95% of the maximum bit-rate.
Default: 66%

windows_size_ms

Windows size in milliseconds. For example if this is set to 500, then the rate control will guarantee the target bit-rate over a 500 ms window.
Default: 1000

initial_qp

Initial QP for the first I frames, 0 - encoder chooses the best QP according to rate control;
Default: 0

min_qp

Minimal QP frames, 0 - encoder chooses the best QP according to rate control;
Default: 0

bufsize

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

init_bufsize

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

qpi, qpp

Quantization Parameters for I, P and B frames, must be specified for CQP mode.
It's a value from 1…51 range, where 1 corresponds to the best quality.
Defult: 0

quality

Encoding quality - higher is worse and faster, 0 - use driver default.
Default: 0

error_resilient 

enable error resilience features

  • 0 - disable(default)
  • 1 - enable


kf_auto

Auto keyframe placement, non-zero means enable auto keyframe placement

  • 0 - disable
  • 1 - enable(default) 


kf_min_dist

keyframe minimum interval

kf_max_dist

keyframe maximum interval

recon_filter

Reconstruction Filter type

  • 0: bicubic,
  • 1: bilinear,
  • other: none


loop_filter_type

Loop filter type

  • 0: no loop fitler,
  • 1: simple loop filter


loop_filter_level

loop filter level value. When loop_filter_level is 0, loop filter shall be disabled.

sharpness

Controls the deblocking filter sensitivity

iqi

I-frame quantization index
Range: 0..127

pqi

P-frame quantization index
Range: 0..127






Feel free to visit Live Transcoder webpage for other transcoding features description and contact us if you have any question.

Related documentation


4 comments:

  1. Should work with the same numbers as quicksync. in fact the same HW engine is in use.
    But it works on Linux without special Linux kernel or OS version

    ReplyDelete
  2. nvidia GPU should work via NVENC encoder and nimble supports it http://blog.wmspanel.com/2016/10/nvidia-nvenc-gpu-nimble-streamer-transcoder.html
    I don't know about ATI. I think va works for Intel/AMD GPU embedded in CPU

    ReplyDelete