GStreamer pipeline service

The service is used to run a GStreamer pipeline to process audio and video streams, where both pipeline ends are EVA ICS sensors with binary values.

The service is useful for various scenarios:

  • Decoding video frames to raw images for further algorithmic or AI (computer vision) processing.

  • Transcoding video streams to different formats or resolutions.

  • Extracting or modifying certain parts of images (cropping/transforming/etc).

Preparing the system

The service requires GStreamer for proper functioning. Install GStreamer and its plugins (example for Debian/Ubuntu):

sudo apt install -y gstreamer1.0-tools \
        gstreamer1.0-plugins-base \
        gstreamer1.0-plugins-good \
        gstreamer1.0-plugins-bad \
        gstreamer1.0-plugins-ugly \
        gstreamer1.0-libav \
        gstreamer1.0-x \
        gstreamer1.0-alsa \
        gstreamer1.0-pulseaudio

Setup

Use the template EVA_DIR/share/svc-tpl/svc-tpl-gst-pipeline.yml:

# GStreamer pipeline service
command: svc/eva-gst-pipeline
bus:
  path: var/bus.ipc
config:
  # destination caps, required
  caps_dst: video/x-raw,format=RGB,width=640,height=480
  # destination sensor, required
  oid_dst: sensor:s0_raw
  # override source caps, required in case if the pipeline elements cannot negotiate by themselves
  # - if not present: auto caps, according to the source
  # - if set to an empty string: the source announces "any" caps
  #caps_src: video/x-h264,stream-format=byte-stream,alignment=au
  # source sensor, required
  oid_src: sensor:s0
  # GStreamer pipeline
  pipeline: h264parse ! openh264dec ! videoconvert
env:
  # increase debug level (0-5) for more verbose logging
  GST_DEBUG: 0
user: nobody

Create the service using eva-shell:

eva svc create eva.gst_pipeline.1 /opt/eva4/share/svc-tpl/svc-tpl-gst-pipeline.yml

or using the bus CLI client:

cd /opt/eva4
cat DEPLOY.yml | ./bin/yml2mp | \
    ./sbin/bus ./var/bus.ipc rpc call eva.core svc.deploy -

(see eva.core::svc.deploy for more info)

EAPI methods

See EAPI commons for the common information about the bus, types, errors and RPC calls.

pipeline.state

Description

Get pipeline state

Parameters

none

Returns

Pipeline state

Return payload example:

{
  "buffers_in": 281,
  "buffers_out": 277,
  "buffers_pending": 4,
  "state": "playing"
}