在Gstreamer中实现多流 [英] Implement multi-stream in Gstreamer

查看:285
本文介绍了在Gstreamer中实现多流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经编写了一个Gstreamer源插件,它可以产生缓冲区并转换为下游元素并进行预览.最近,我收到一个实现多流的请求,一个流进行预览,另一个流进行记录(我想是使用文件接收器).我之前研究过"tee"插件,但事实证明,它仅支持具有相同格式/分辨率的多个流. 如果两个流具有不同的格式/分辨率(例如,在一个管道中有两个capsfilters),我应该使用哪个插件?如果有插件可以做到这一点,您能提供一些使用它们的示例吗?

I've written a Gstreamer source plugin, it can produce buffers and transform to downstream elements and do preview. Recently I received a request to implement multi-stream, that one stream to do preview, and the other stream to do recording(using filesink, I suppose). I investigated 'tee' plugin before, but it turns out that it only supports multiple streams with the same formats/resolutions. What plugin should I use if two streams have different formats/resolutions, say, two capsfilters in one pipeline? If there are plugin could do that, could you provide some examples for how to use them?

我期望的管道是这样的:

the pipeline I expect goes like this:

gst-launch-1.0 mysrc ! (some plugins) name=t ! video/x-raw,format=NV12,width=320,height=240 ! xvimagesink t. ! video/x-raw,format=YUY2,width=640,height=480 ! filesink location=img_file

推荐答案

我认为,要么在您的插件中实现此功能,该插件就会产生两个src填充,您只需正确连接文件接收器和视频接收器即可..

I think either you implement this in your plugin which will produce two src pads and you will just connect the filesink and videosink correctly..

或者您将使用tee和videoscale视频转换视频速率元素来实现不同的分辨率.当然,这种方法对资源的要求更高,第一种方法可能具有更好的可优化性(只是猜测,我对您的插件一无所知).

Or you will use tee and videoscale videoconvert videorate elements to achieve different resolutions. This approach is of course more resource demanding and the first approach may be better optimisable (just guessing, I dont know anything about your plugin).

这是一个示例,其中有两个视频接收器,每个接收器的大小各不相同..您必须意识到自己的mysrc有一个输入..也就是说,您必须复制它,然后必须调整一个分支的大小(或者如果两个分支,则可能需要两个您需要)..没有其他方法.您想要的是tee和videoscale/videorate/videoconvert组合的元素.我不确定是否有这样的元素,并且我不确定它是否会非常有用(但是也许有道理,我只是看不到它).

This is example with two videosink each different size.. You have to realise that you have one input from your mysrc.. that is you have to duplicate it and then one of the branches have to be resized (or maybe two if you need).. there is no other way. What you want is element of combination of tee and videoscale/videorate/videoconvert.. I am not sure if there is such element, and I am not sure it would be very usable(but maybe it has sense, I just do not see it)..

gst-launch-1.0 videotestsrc ! video/x-raw,width=640,height=480 ! tee name=t t. ! queue ! videoscale ! video/x-raw,width=320,height=240 ! videoconvert ! autovideosink t. ! queue ! videoscale ! video/x-raw,width=200,height=200 ! videoconvert ! autovideosink

也许我只是不明白你的问题.

Maybe I just didnt understand your question.

这篇关于在Gstreamer中实现多流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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