Video sink controller
Contents
The service allows to sink video streams from cameras and other devices.
See more: Binary streams (Video/Audio/Custom).
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
Building pipelines
The service uses an embedded GStreamer to get video frames. Refer to the GStreamer documentation for more information on how to build pipelines.
Requirements:
The pipeline must produce video/x-h264, video/x-h265, video/x-vp8, video/x-vp9, or video/x-av1 stream.
The pipeline must not end with a sink, as the service is the sink itself.
For web playback it is necessary to have the video stream color space set to “I420”, “NV12” or other modern web-browser compatible format.
CAPs filtering should not be quoted.
Examples
A signal test pipeline:
# ....
pipeline: videotestsrc ! video/x-raw,format=I420,width=640,height=480 ! openh264enc
# ....
A pipeline for a RTSP camera. For H264 make sure the stream-format produced is byte-stream and alignment is AU. Add h264parse element if required:
# ....
pipeline: rtspsrc latency=0 location=rtsp://eva:xxx@192.168.20.1/axis-media/media.amp
! rtph264depay
! h264parse config-interval=-1
! video/x-h264,stream-format=byte-stream,alignment=au
# ....
Including external pipelines
For security purposes, to avoid pipeline duplication or in certain cases where it may be usable, a pipeline can be included from an external file. Note that CAPs still do not need to be quoted:
# ....
pipeline: ^include /path/to/pipeline
# ....
Where the included file contains the required pipeline.
Video recording
See: Video server service
Setup
Use the template EVA_DIR/share/svc-tpl/svc-tpl-videosink.yml:
command: svc/eva-videosink
workers: 1
bus:
path: var/bus.ipc
config:
# target sensor to write stream to
oid: sensor:streams/s0
# the gstreamer pipeline to use. must produce video/x-h264, video/x-h265,
# video/x-vp8, video/x-vp9 or video/x-av1
#
# the picture format is recommended to be compatible with the web browsers
pipeline: videotestsrc pattern=ball
! video/x-raw,width=640,height=480,framerate=15/1,format=I420
! openh264enc
# optionally force a specific width and height in case if the pipeline can
# not be properly negotiated
#force_width: 640
#force_height: 480
# if running under restricted user, 'chown -R eva:eva /var/cache/fontconfig/'
# may be required. if streaming a USB camera, make sure the user has access to
# the device
user: eva
timeout:
default: 10
startup: 45
Create the service using eva-shell:
eva svc create eva.controller.camera.1 /opt/eva4/share/svc-tpl/svc-tpl-videosink.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.
stream.info
Description |
Get info for the current stream |
Parameters |
none |
Returns |
Stream info |
Return payload example:
{
"format": "video/x-h264",
"fps": 15,
"frames": 7231,
"height": 480,
"width": 640
}