如何在 GStreamer Video Stream 上显示日期(文本叠加)?
How to display date (text overlay) on GStreamer Video Stream?
目前我可以在视频流上显示本地时间文本(时钟覆盖)。
gst-launch-1.0 v4l2src ! videoconvert ! 'video/x-raw,width=640,height=480' ! clockoverlay ! ximagesink
我正在努力寻找一种方法来显示当前日期(假设是本地时区)。
我确信我可以通过编写自己的插件来做到这一点。但是,是否有库存或变通方法来避免重新发明轮子?有什么想法吗?
查看 gst-inspect-1.0 clockoverlay
。如果这样做,您会注意到以下选项:
time-format : Format to use for time and date value, as in strftime.
flags: readable, writable
String. Default: "%H:%M:%S"
因此,如您所见,您可以按照 strftime
格式将其设置为您想要的任何值。查看 http://www.cplusplus.com/reference/ctime/strftime/ 了解详情。
一个简单的方法就是使用:
gst-launch-1.0 v4l2src ! videoconvert ! 'video/x-raw,width=640,height=480' ! \
clockoverlay time-format="%D %H:%M:%S" ! ximagesink
您还会在叠加层中看到日期。您可以根据自己的喜好随意设计 text-format
字符串。
目前我可以在视频流上显示本地时间文本(时钟覆盖)。
gst-launch-1.0 v4l2src ! videoconvert ! 'video/x-raw,width=640,height=480' ! clockoverlay ! ximagesink
我正在努力寻找一种方法来显示当前日期(假设是本地时区)。
我确信我可以通过编写自己的插件来做到这一点。但是,是否有库存或变通方法来避免重新发明轮子?有什么想法吗?
查看 gst-inspect-1.0 clockoverlay
。如果这样做,您会注意到以下选项:
time-format : Format to use for time and date value, as in strftime.
flags: readable, writable
String. Default: "%H:%M:%S"
因此,如您所见,您可以按照 strftime
格式将其设置为您想要的任何值。查看 http://www.cplusplus.com/reference/ctime/strftime/ 了解详情。
一个简单的方法就是使用:
gst-launch-1.0 v4l2src ! videoconvert ! 'video/x-raw,width=640,height=480' ! \
clockoverlay time-format="%D %H:%M:%S" ! ximagesink
您还会在叠加层中看到日期。您可以根据自己的喜好随意设计 text-format
字符串。