Evaluating use of GStreamer

Tim Müller tim at centricular.com
Tue Dec 19 11:46:45 UTC 2017


On Tue, 2017-12-19 at 04:03 -0700, bdiesel wrote:

Hi Bruce,

> I have spent a day trying to understand how to use the text overlay,
> but have come to the conclusion that this requires timing information
> in order to embed changing text (using the subtitle mechanism).  I
> have also tried numerous work-arounds e.g. piping serial data to a
> udp port, piping to a text file and tailing it etc, but have not been
> successful.

Not sure if I understand you correctly here. There are multiple ways to
make textoverlay show text on top of video. One is by feeding it timed
text as input on the text sink pad (the "subtitle way" if you like),
the other is to simply set its "text" property via g_object_set(). You
can do this at run-time from your application thread, in which case
it's up to your application when to change it / set it.


> The application that I need to do is as follows:
> - Run a rolling window of 30 sec of video data captured from the
> camera.
> - Embed data received over a serial port onto each video frame.
> - Monitor a sensor on an I2C interface.  This data also needs to be
> embedded on the video.
> - When the value of the data on the I2C interface goes below a
> certain threshold, trigger the recording of the video buffer, and
> continue recording until 30sec after the trigger event.
> 
> In short, I am wanting to record the 30sec prior to a trigger event,
> along with the 30sec after, whilst embedding text on the video.
> 
> I have a number of questions:
> 1. Is this achievable using standard unix pipes and standard
> GStreamer plugins such as fdsrc and text overlay etc.

Yes, that's achievable. I'm not sure whether you really need to grab
the data via fdsrc and pipes though, I would rather do this in your
application and then change the text property on textoverlay.

You can find some code here to start/stop recording with a backlog:

 https://people.freedesktop.org/~tpm/code/test-backlog-recording-h264.c

It's a bit more complicated than it needs to be, to make sure we start
on a keyframe and because it works around a bug/missing feature in
older versions of GStreamer.


> 2. If not, Is it a significant effort to develop my own plugins for
> this?  It appears that a plugin that can embed sensor data from a
> communication port (udp, serial, I2C) whould be quite useful.

Well. It's not really a lot of lines of code, but there's a bit of a
learning curve (GObject, GStreamer etc.). I'm not sure you need to do
this if you grab the sensor data in your app.

Cheers
 -Tim

-- 
Tim Müller, Centricular Ltd - http://www.centricular.com


More information about the gstreamer-devel mailing list