# Configure encoder GStreamer plug-in qtic2venc

Source: [https://docs.qualcomm.com/doc/80-88500-3/topic/17_Configure_encoder_Gstreamer_plug_in_qtic2venc.html](https://docs.qualcomm.com/doc/80-88500-3/topic/17_Configure_encoder_Gstreamer_plug_in_qtic2venc.html)

Table : Properties of qtic2venc element. The following table lists the properties currently supported for the implementation of qtic2venc:

| Property | Value type | Description |
| --- | --- | --- |
| `name ` | String | Name of the object |
| `b-frames` | Integer | Number of B-frames between 2 consecutive P-Frames (0=component default) |
| `target-bitrate` | Integer | Set the video encoding rate |
| `control-rate` | Enum | Select a control encoding rate from the disable/variable/constant/variable skip frames/constant skip frames |
| `entropy-mode` | Enum | Entropy mode for encoding process |
| `intra-refresh-mode` | Enum | Intrarefresh mode, only supports random mode. Allow IR only for CBR(\_CFR/VFR) RC modes |
| `intra-refresh-mbs` | Integer | Period of intrarefresh, supports random mode only |
| `loop-filter-mode` | Enum | Enable or disable the deblocking filter |
| `max-quant-i-frames` | Integer | Maximum quantization parameter for I-frames from 0 to 51 |
| `max-quant-p-frames` | Integer | Maximum quantization parameter for P-Frames from 0 to 51 |
| `max-quant-b-frames` | Integer | Maximum quantization parameter for B-frames from 0 to 51 |
| `min-quant-i-frames` | Integer | Minimum quantization parameter for I-frames from 0 to 51 |
| `min-quant-p-frames` | Integer | Minimum quantization parameter for P-Frames from 0 to 51 |
| `min-quant-b-frames` | Integer | Minimum quantization parameter for B-frames from 0 to 51 |
| `quant-b-frames` | Integer | Initialize quantization parameter for B-frames |
| `quant-i-frames` | Integer | Initialize quantization parameter for i-frames |
| `quant-p-frames` | Integer | Initialize quantization parameter for P-frames |
| `idr-interval` | Integer | Frame number between 2 IDR frames |
| `slice-mode` | Enum | Slice mode, support MB, and BYTES mode |
| `slice-size` | Integer | Slice size, set when slice mode setting to MB or bytes |
| `roi-quant-boxes` | Boolean | Manually set ROI boxes`'<<X, Y, W, H, QP>, <X, Y, W, H, QP>>'`. The QP values must be in the range of -31 (best quality) to 30 (worst quality) |
| `roi-quant-meta-value` | Integer array | Set a specific QP value, different than the default value of (-15), for a `GstVideoRegionOfInterestMeta` type ( `roi-meta-qp`,person=-20,cup=10,dog=-5;). The QP values must be in the range of -31 (best quality) to 30 (worst quality) |
| `roi-quant-mode` | `Gststructure` | Set a specific QP value, different than the default value of (-15), for a `GstVideoRegionOfInterestMeta` type (for example, `roi-meta-qp,person=-20,cup=10,dog=-5;`). The QP values must be in the range of -31 (best quality) to 30 (worst quality) |
| `rotate` | – | <ul class="ul" id="Configure_encoder_Gstreamer_plug_in_qtic2venc_17__ul_ird_dfh_wwb"><br>                <li class="li">Rotate video image<br>                  <ul class="ul" id="Configure_encoder_Gstreamer_plug_in_qtic2venc_17__ul_vdw_dfh_wwb"><br>                    <li class="li">(0): none – no rotation</li><br><br>                    <li class="li">(1): 90CW – rotate 90 degrees clockwise</li><br><br>                    <li class="li">(2): 180 – rotate 180 degrees</li><br><br>                    <li class="li">(3): 90CCW – rotate 90 degrees counterclockwise</li><br><br>                  </ul><br><br>                </li><br><br>              </ul> |

## Encoding and decoding examples

- H.264 and HEVC encoding example

        Encoder: qtic2venc
        H264: 
        gst-launch-1.0 -e qtiqmmfsrc camera=0 name=qmmf ! video/x-raw\(memory:GBM\),format=NV12,width=3840,height=2160,framerate=30/1 ! qtic2venc ! h264parse ! mp4mux ! queue ! filesink location=/data/4k_mux.mp4Copy to clipboard

        H265: 
        gst-launch-1.0 -e qtiqmmfsrc camera=0 name=qmmf ! video/x-raw\(memory:GBM\),format=NV12,width=3840,height=2160,framerate=30/1 ! qtic2venc ! h265parse ! mp4mux ! queue ! filesink location=/data/4k_mux_h265.mp4 Copy to clipboard
- Decoder GStreamer plug-in is qtic2vdec

        gst-launch-1.0 filesrc location=/data/4k_mux.mp4 ! qtdemux ! queue ! h264parse ! qtic2vdec ! video/x-raw\(memory:GBM\),compression=ubwc ! queue ! waylandsink fullscreen=trueCopy to clipboard

        gst-launch-1.0 filesrc location=/data/4k_mux_h265.mp4 ! qtdemux ! queue ! h265parse ! qtic2vdec ! video/x-raw\(memory:GBM\),compression=ubwc ! queue ! waylandsink fullscreen=trueCopy to clipboard

Encoder Codec2 can support more hardware codecs than `qtic2venc`.

## GBM replacement

In the Codec2 implementation, `gralloc` is replaced with GBM because GBM is the prevalent mechanism on the Linux distribution for sharing display buffers between applications. Other advantages are as follows:

- Data copying is avoided bacause of buffer sharing
- Power consumption is reduced to a minimum

Certain usages of GBM replacement are as follows.

- Video recording from camera on QRB5165. The Qualcomm platform supplies the multimedia framework called QMMF to use the camera interface.
- Video encoding from the camera output. The buffers between camera and video are GBM allocated.

`buffer_handle_t` is redined in QComOMXMetadata.h:

    typedef const gbm_bo* buffer_handle_t;Copy to clipboard

The member variable is replaced with GBM buffers, when the camera sends frames to video within `struct encoder_media_buffer_type`.

    typedef struct encoder_media_buffer_type {
         MetadataBufferType buffer_type;
         buffer_handle_t meta_handle;
    } encoder_media_buffer_type;Copy to clipboard

This procedure of sending camera frames to video within struct `encoder_media_buffer_type` is called meta mode or the zero-copy feature.

**Parent Topic:** [Configure video settings](https://docs.qualcomm.com/doc/80-88500-3/topic/16_Configure_video_settings.html)

Last Published: Sep 26, 2023

[Previous Topic
Configure video settings](https://docs.qualcomm.com/bundle/publicresource/80-88500-3/topics/16_Configure_video_settings.md) [Next Topic
Configure audio settings](https://docs.qualcomm.com/bundle/publicresource/80-88500-3/topics/18_Configure_audio_settings.md)