Best option to add overlay, ensure frame rate (fallback source), handle need callback, and frame transfer in GStreamer

Israel Díaz isra601988 at
Mon Jun 12 06:47:11 UTC 2023


I'm working with GStreamer and have a pipeline that captures video from a
v4l2src device and sends it to an appsink. Currently, I receive the frames
through the new-sample callback of appsink. I need to add a simple overlay
before sending the frames to another pipeline with omxh264enc.
Additionally, I would like to ensure that the frames arrive at a rate of 30

My current pipeline is as follows: v4l2src device=/dev/video1 io-mode=4 !
video/x-raw,width=1920,height=1080,format=NV16_10LE32,framerate=30/1 !
appsink name=videosourcesink

And the next pipeline is: appsrc name=encodersource !
video/x-raw,width=1920,height=1080,format=NV16_10LE32,framerate=30/1 !
omxh264enc target-bitrate=8000 num-slices=2 periodicity-idr=30 !
video/x-h264, alignment=au ! appsink name=encodersink

I have the following questions:


   What would be the best approach to add an overlay in the first pipeline
   before sending the frames to the second pipeline?

   Is there a way to ensure that the need-data callback of appsrc is called
   at a rate of 30 fps? Or should I consider an alternative approach, such as
   restarting a timer every time a frame is received from v4l2src and, in case
   of a timeout without receiving frames, generating the test pattern at that

   Currently, I'm receiving the frames through the new-sample callback of
   appsink, and then I add the frames to appsrc using gst_app_src_push_buffer.
   Is this the recommended method for frame transfer in this scenario, or are
   there other approaches I should consider?

I would greatly appreciate any guidance or recommendation on these three
aspects, considering both efficiency and effectiveness.

Thank you in advance!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gstreamer-devel mailing list