问题描述
我正在尝试编写一个接受图像输入的代码,在其上写入一些文本,然后将其发送到接收器(应用程序、文件或 Gtk 显示)。
下面的代码在终端和 python 中工作:
pipeline = Gst.parse_launch(f"videotestsrc ! videoscale ! video/x-raw,width=1920,height=1080 ! autovideosink")
这里我需要一个探针来在图像上放置一些文本,因此我已将其转换为 gi
格式以进行操作。该代码不提供视觉或文本输出。代码有什么问题吗:
pipeline = Gst.Pipeline()
source = Gst.ElementFactory.make("videotestsrc","video-source")
pipeline.add(source)
scale = Gst.ElementFactory.make("videoscale","scale")
pipeline.add(scale)
caps = Gst.Caps.from_string("video/x-raw,height=1080")
filter = Gst.ElementFactory.make("capsfilter","filter")
filter.set_property("caps",caps)
pipeline.add(filter)
scale.link(filter)
sink = Gst.ElementFactory.make("autovideosink","video-sink")
pipeline.add(sink)
filter.link(sink)
loop = GLib.MainLoop()
pipeline.set_state(Gst.State.PLAYING)
try:
loop.run()
except Exception as e:
print(e)
pipeline.set_state(Gst.State.NULL)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)