simaaiencoder
The simaaiencoder
GStreamer plugin provides video encoding capabilities using the SiMa.ai hardware accelerator. This plugin allows you to integrate SiMa.ai’s encoding functionality seamlessly into your GStreamer pipelines.
Properties
The plugin exposes several properties to configure the encoding process:
Property Name |
Type |
Default Value |
Description |
---|---|---|---|
enc-width |
int |
1920 |
Input resolution width. |
enc-height |
int |
1080 |
Input resolution height. |
enc-frame-rate |
int |
30 |
Frame rate for encoding. |
ip-queue-max-buffers |
int |
30 |
High watermark for the input queue (works only in ASYNC mode). If the queue size exceeds this value, it will block. |
enc-bitrate |
int |
0 |
Bitrate in kbps. Choose a value appropriate for your resolution (e.g., 1000-2000 kbps for 640x480, 2500-4000 kbps for 1280x720, 5000-7000 kbps for 1920x1080). |
ip-queue-min-buffers |
int |
15 |
Low watermark for the input queue (works only in ASYNC mode). |
enc-profile |
string |
main |
H.264 (baseline, main, high) & H.265 (main) profile. |
enc-level |
string |
4.0 |
H.264/H.265 level (e.g., 4.0, 4.1, 4.2, 5.0, 5.1, 5.2). The encoder may adjust the level automatically in ASYNC mode if the provided level is insufficient. |
enc-type |
string |
h264 |
Encoder type: h264 or h265. |
enc-ip-mode |
string |
async |
Encoder input mode: async or sync. |
enc-fmt |
string |
NV12 |
Input encoder format: NV12 or YUV420P. |
dump-cnt |
int |
0 |
Number of encoded frames to dump to file (for debugging). |
dump-path |
string |
/tmp |
Path to dump encoded frames. |
ignore-caps-event |
boolean |
FALSE |
Ignore caps negotiation if the previous plugin sends incorrect caps. |
ip-cache-inval |
boolean |
FALSE |
Invalidate the input buffer cache before reading (if mapped as cached). Requires custom meta with sima-mem-ptr. |
ip-rate-ctrl |
boolean |
FALSE |
Enable input buffer rate control. Only use if your source is not rate-controlled (e.g., YUV filesrc). |
transmit |
boolean |
FALSE |
Transmit KPI messages. |
Usage
The simaaiencoder
plugin integrates into a GStreamer pipeline like this:
gst-launch-1.0 filesrc location=/path/to/your/video.mp4 ! decodebin ! videoconvert ! simaaiencoder enc-width=1280 enc-height=720 enc-bitrate=3000 ! h264parse ! filesink location=/path/to/output.mp4
Replace /path/to/your/video.mp4
and /path/to/output.mp4
with the actual paths. Adjust other properties as needed. Remember that the input video needs to be in a format that the decodebin
can handle.
For Async mode:
gst-launch-1.0 videotestsrc ! videoconvert ! simaaiencoder enc-ip-mode=async enc-width=640 enc-height=480 enc-bitrate=1000 ! h264parse ! fakesink
Installation
To install the simaaiencoder
plugin, copy the plugin file from /usr/local/simaai/plugin_zoo/gst-simaai-plugins-base/gst/
into your project’s plugins/
directory. Ensure the necessary SiMa.ai libraries are installed and configured on your system.