|
HVE
HVE Hardware Video Encoder library
|
Encoder configuration. More...
#include <hve.h>
Data Fields | |
| int | width |
| width of the encoded frames | |
| int | height |
| height of the encoded frames | |
| int | input_width |
| optional scaling if non-zero and different from width | |
| int | input_height |
| optional scaling if non-zero and different from height | |
| int | framerate |
| framerate of the encoded video | |
| const char * | device |
| NULL / "" or device, e.g. "/dev/dri/renderD128". | |
| const char * | encoder |
| NULL / "" or encoder, e.g. "h264_vaapi". | |
| const char * | pixel_format |
| NULL / "" for NV12 or format, e.g. "rgb0", "bgr0", "nv12", "yuv420p", "p010le". | |
| int | profile |
| 0 to guess from input or profile e.g. FF_PROFILE_H264_MAIN, FF_PROFILE_H264_HIGH, FF_PROFILE_HEVC_MAIN, ... | |
| int | max_b_frames |
| maximum number of B-frames between non-B-frames (disable if you need low latency) | |
| int | bit_rate |
| average bitrate in VBR mode (bit_rate != 0 and qp == 0) | |
| int | qp |
| quantization parameter in CQP mode (qp != 0 and bit_rate == 0) | |
| int | gop_size |
| group of pictures size, 0 for default, -1 for intra only | |
| int | compression_level |
| speed-quality tradeoff, 0 for default, 1 for the highest quality, 7 for the fastest | |
| int | low_power |
| alternative limited low-power encoding if non-zero | |
Encoder configuration.
The width and height are dimmensions of the encoded data.
To enable hardware accelerated scaling specify non-zero input_width and input_height different from width and height.
The device can be:
If you have multiple VAAPI devices (e.g. NVidia GPU + Intel) you may have to specify Intel directly. NVidia will not work through VAAPI for encoding (it works through VAAPI-VDPAU bridge and VDPAU is only for decoding).
The encoder can be:
You may check encoders supported by your hardware with ffmpeg:
Encoders typically can be:
The pixel_format (format of what you upload) typically can be:
There are no software color conversions in this library.
For pixel format explanation see: FFmpeg pixel formats
The available profiles depend on used encoder. Use 0 to guess from input.
For possible profiles see: FFmpeg profiles
For H.264 profile can typically be:
For HEVC profile can typically be:
You may check profiles supported by your hardware with vainfo:
The max_b_frames controls the number of B frames. Disable B frames if you need low latency (at the cost of quality/space). The output will be delayed by max_b_frames+1 relative to the input.
Set non zero bit_rate for average average bitrate and VBR mode.
Set non zero qp for quantization parameter and CQP mode.
If both bit_rate and qp are zero then CQP with default qp is used. If both are non-zero VBR mode will be used.
The gop_size is size of group of pictures (e.g. I, P, B frames). Note that gop_size determines keyframe period. Setting gop_size equal to framerate results in one keyframe per second. Use 0 value for default, -1 for intra only.
The compression_level is speed-quality trade-off. Use 0 for driver default. For highest quality use 1, for fastest encoding use 7. The default is not highest quality so if you need it, set it explicitly to 1. The exact interpretation is hardware dependent.
The low_power option enables alternative encoding path available on some Intel platforms.
You may check support with vainfo (entrypoints ending with LP):
Low power encoding supports limited subset of features.
Bitrate control with low power encoding requires loaded HuC. For the details on loading HuC see: Loading GuC and HuC