# vah264enc

vah264enc encodes raw video VA surfaces into H.264 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 ! vah264enc ! h264parse ! mp4mux ! filesink location=test.mp4

## Hierarchy

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

## 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-h264:

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. 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

### cabac

    “cabac” gboolean

It enables CABAC entropy coding mode to improve compression ratio, but requires main profile at least.

Flags : Read / Write / Construct

Default value : true

### cc-insert

    “cc-insert” gboolean

Closed Caption Insert mode. Only CEA-708 RAW format is supported for now.

Flags : Read / Write / Construct

Default value : true

### cpb-size

    “cpb-size” guint

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

Flags : Read / Write / Construct

Default value : 0

### dct8x8

    “dct8x8” gboolean

Enable adaptive use of 8x8 transforms in I-frames. This improves the compression ratio but requires high profile at least.

Flags : Read / Write / Construct

Default value : true

### 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. Not available in CQP mode.

Flags : Read / Write / Construct

Default value : disabled (0)

### 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

### qpb

    “qpb” guint

The quantizer value for B frame. 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. Available only in CQP mode.

Flags : Read / Write / Construct

Default value : 26

### 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. Available only when rate-control is VBR.

"target percentage" = "target bitrate" * 100 / "max bitrate"

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

The results of the search are