Overlay with python, appsrc, cairo and a full cast of errors

Michael Tyson michael at tyson.id.au
Sat Mar 1 22:54:37 PST 2014


Hello,

I’m putting together a python app that receives video data and pops an overlay on top of it, rendered using Cairo. The general idea seems to be to use appsrc, and to watch for 'need-data' and then render and push a buffer.

Little demonstration app: https://gist.github.com/michaeltyson/9302751

This appears to work, sorta-kinda, but:

1. The buffer fill() call takes *ten seconds* at 720p
2. The whole thing only works with a really basic pipeline (appsrc | whatevervideosink)

Two questions:

1. Gst.Buffer.fill takes 10 seconds for 720p. What can I do about that? I’d imagine allocating a buffer/buffer pool in advance and rendering straight into the buffer’s memory would be better, but Gst.MapInfo (as returned from Gst.Buffer.map()) has a ‘data’ field of type int, as opposed to some kind of byte array! What’s with that??

2. How do I get this contraption to function with videomixer? When I run the above script, I see two of the following:

    (test.py:9818): GStreamer-CRITICAL **: gst_segment_to_running_time: assertion 'segment->format == format’ failed

    Running with GST_DEBUG=6 shows a bunch of this nonsense once the pipeline’s up and running: https://gist.github.com/michaeltyson/b004988e428d423ec27d (tl;dr: "gst_videomixer2_sink_clip:<mix:sink_0> Timestamped buffers required!” / "gst_base_src_do_sync:<overlay> we have no clock")

In response to the message about timestamped buffers I’ve attempted to:

1. Set format=time on appsrc (this stops those GStreamer-CRITICAL errors showing up, but that’s all)
2. Explicitly add timestamps to the buffer, like:
        self.buffer.timestamp = self.time
        self.buffer.duration = Gst.SECOND * self.OVERLAY_FRAME_DURATION
        self.time += self.buffer.duration
3. Add/remove do-timestamp=true to appsrc.
4. Combinations of the above

Any pointers whatsoever would be greatly appreciated.

Best,
Michael


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20140302/f63dbd28/attachment.html>


More information about the gstreamer-devel mailing list