Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display date (text overlay) on GStreamer Video Stream?

Currently I can display the local time text (clock overlay) on the video stream.

gst-launch-1.0 v4l2src ! videoconvert ! 'video/x-raw,width=640,height=480' ! clockoverlay ! ximagesink

I am struggling to find out a way to display the current date (assuming local time zone).

I am sure I can do this by writing my own plugin. However, is there one in the stock or work arounds to avoid reinventing the wheel? Any ideas?

like image 327
enthusiasticgeek Avatar asked Nov 01 '25 15:11

enthusiasticgeek


1 Answers

Check out gst-inspect-1.0 clockoverlay. If you do that you will notice the following option:

  time-format         : Format to use for time and date value, as in strftime.
                        flags: readable, writable
                        String. Default: "%H:%M:%S"

So as you see you can just set this to whatever you want following the strftime format. Check out http://www.cplusplus.com/reference/ctime/strftime/ for details.

So a simple way for you would be to use:

gst-launch-1.0 v4l2src ! videoconvert ! 'video/x-raw,width=640,height=480' ! \
clockoverlay time-format="%D %H:%M:%S" ! ximagesink

And you will have the date in the overlay as well. Feel free to design the text-format string to your liking.

like image 131
Florian Zwoch Avatar answered Nov 03 '25 04:11

Florian Zwoch



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!