是否可以在Gstreamer中执行appsrc--ximagesink设置 [英] Is it possible to do appsrc--ximagesink setup in Gstreamer

查看:270
本文介绍了是否可以在Gstreamer中执行appsrc--ximagesink设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将一些随机字节流式传输到Gstreamer并显示如下:

I want to stream some random bytes to Gstreamer and display it as follows:

[Rand Bytes]--[Video source=appsrc]--[Video sink=ximagesink]

我在此SO中找到了以下Python代码发布作品

The following Python code I found in this SO post works

source = gst.element_factory_make("appsrc", "source")
caps = gst.Caps("video/x-raw-gray,bpp=16,endianness=1234,width=320,height=240,framerate=(fraction)10/1")
source.set_property('caps',caps)
source.set_property('blocksize',320*240*2)
source.connect('need-data', self.genRandBytes)

colorspace = gst.element_factory_make('ffmpegcolorspace') #To remove

videosink = gst.element_factory_make('ximagesink')
caps = gst.Caps("video/x-raw-yuv,width=320,height=240,framerate=(fraction)10/1,format=(fourcc)I420")
videosink.caps = caps

gst.element_link_many(source, colorspace, videosink)

但是,如果我删除colorspace部分并将videosink.caps设置为与source相同,它将停止工作(单击开始"后没有任何反应).

However if I remove the colorspace part and set videosink.caps as the same as source's, it stops working(nothing happens after clicking start).

我的问题是为什么在这里需要colorspace?可以只进行appsrc--ximagesink设置吗?

My question is why is colorspace needed here? Is it possible to do just appsrc--ximagesink setup?

推荐答案

ximagesink不支持x-raw-gray,因此需要进行色彩空间转换.

ximagesink doesn't support x-raw-gray, hence the need for colorspace conversion.

话虽如此,文档说ximagesink仅支持video/x-raw-rgb,所以我认为在接收器上设置caps属性并没有多大作用.实际上,在ximagesource的get_caps()方法上查看水槽垫的输出,即使设置了caps属性并开始播放,它仍然是video/x-raw-rgb.删除设置caps属性的行对输出没有影响.

Having said that, the documentation says that ximagesink only supports video/x-raw-rgb, so I'm thinking that setting that caps property on the sink isn't doing much. In fact, looking at the output of the sink pad on ximagesource's get_caps() method, it's still video/x-raw-rgb even after that caps property is set and playback has started. Taking out the line setting the caps property has no effect on the output.

http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-ximagesink.html

这篇关于是否可以在Gstreamer中执行appsrc--ximagesink设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆