# vah265enc

vah265enc encodes raw video VA surfaces into H.265 bitstreams using the installed and chosen VA-API driver.

The raw video frames in main memory can be imported into VA surfaces.

## Example launch line

    gst-launch-1.0 videotestsrc num-buffers=60 ! timeoverlay ! vah265enc ! h265parse ! mp4mux ! filesink location=test.mp4

## Hierarchy

    GObject
        ╰──GInitiallyUnowned
            ╰──GstObject
                ╰──GstElement
                    ╰──GstVideoEncoder
                        ╰──GstVaBaseEnc
                            ╰──vah265enc

## Implemented interfaces

    GstPreset

## Factory details

Authors: – He Junyan

Classification: – `Codec/Encoder/Video/Hardware`

Rank – none

Plugin – va

Package – GStreamer Bad Plug-ins

## Pad Templates

### `sink`

    video/x-raw(memory:VAMemory):
             format: { NV12 }
              width: [ 1, 2147483647 ]
             height: [ 1, 2147483647 ]
          framerate: [ 0/1, 2147483647/1 ]
    video/x-raw:
             format: { NV12 }
              width: [ 1, 2147483647 ]
             height: [ 1, 2147483647 ]
          framerate: [ 0/1, 2147483647/1 ]

Presence – always

Direction – sink

Object type – GstPad

### `src`

    video/x-h265:

Presence – always

Direction – src

Object type – GstPad

## Properties

### aud

    “aud” gboolean

Insert the AU (Access Unit) delimeter for each frame.

Flags : Read / Write / Construct

Default value : false

### b-frames

    “b-frames” guint

Number of B-frames between two reference frames.

Flags : Read / Write / Construct

Default value : 0

### b-pyramid

    “b-pyramid” gboolean

Enable the b-pyramid reference structure in GOP.

Flags : Read / Write / Construct

Default value : false

### bitrate

    “bitrate” guint

The desired target bitrate, expressed in kbps. This is not available in CQP mode.

CBR: This applies equally to the minimum, maximum and target bitrate. VBR: This applies to the target bitrate. The driver will use the "target-percentage" together to calculate the minimum and maximum bitrate. VCM: This applies to the target bitrate. The minimum and maximum bitrate are not needed.

Flags : Read / Write / Construct

Default value : 0

### cpb-size

    “cpb-size” guint

The desired max CPB size in Kb (0: auto-calculate).

Flags : Read / Write / Construct

Default value : 0

### i-frames

    “i-frames” guint

Force the number of i-frames insertion within one GOP.

Flags : Read / Write / Construct

Default value : 0

### key-int-max

    “key-int-max” guint

The maximal distance between two keyframes.

Flags : Read / Write / Construct

Default value : 0

### max-qp

    “max-qp” guint

The maximum quantizer value.

Flags : Read / Write / Construct

Default value : 51

### mbbrc

    “mbbrc” GstVaFeature *

Macroblock level bitrate control. This is not compatible with Constant QP rate control.

Flags : Read / Write / Construct

Default value : auto (2)

### min-qp

    “min-qp” guint

The minimum quantizer value.

Flags : Read / Write / Construct

Default value : 1

### num-slices

    “num-slices” guint

The number of slices per frame.

Flags : Read / Write / Construct

Default value : 1

### num-tile-cols

    “num-tile-cols” guint

The number of tile columns when tile encoding is enabled.

Flags : Read / Write / Construct

Default value : 1

### num-tile-rows

    “num-tile-rows” guint

The number of tile rows when tile encoding is enabled.

Flags : Read / Write / Construct

Default value : 1

### qpb

    “qpb” guint

The quantizer value for B frame. This is available only in CQP mode.

Flags : Read / Write / Construct

Default value : 26

### qpi

    “qpi” guint

The quantizer value for I frame. In CQP mode, it specifies the QP of I frame, in other mode, it specifies the init QP of all frames.

Flags : Read / Write / Construct

Default value : 26

### qpp

    “qpp” guint

The quantizer value for P frame. This is available only in CQP mode.

Flags : Read / Write / Construct

Default value : 26

### rate-control

    “rate-control” Va-encoder-rate-control_h265_render-d128 *

The desired rate control mode for the encoder

Flags : Read / Write / Construct

Default value : cbr (2)

### ref-frames

    “ref-frames” guint

The number of reference frames.

Flags : Read / Write / Construct

Default value : 3

### target-percentage

    “target-percentage” guint

The target percentage of the max bitrate, and expressed in uint, equal to "target percentage"*100. "target percentage" = "target bitrate" * 100 / "max bitrate" This is available only when rate-control is VBR. The driver uses it to calculate the minimum and maximum bitrate.

Flags : Read / Write / Construct

Default value : 66

### target-usage

    “target-usage” guint

The target usage of the encoder. It controls and balances the encoding speed and the encoding quality. The lower value has better quality but slower speed, the higher value has faster speed but lower quality.

Flags : Read / Write / Construct

Default value : 4

### trellis

    “trellis” gboolean

It enable the trellis quantization method. Trellis is an improved quantization algorithm.

Flags : Read / Write / Construct

Default value : false

## Named constants

### Va-encoder-rate-control_h265_render-d128

#### Members

`cbr` (2) – Constant Bitrate
`vbr` (4) – Variable Bitrate
`vcm` (8) – Video Conferencing Mode (Non HRD compliant)
`cqp` (16) – Constant Quantizer
`icq` (64) – Intelligent Constant Quality
`qvbr` (1024) – Quality defined VBR

The results of the search are