在GStreamer中获取rtmp流,创建马赛克并发送生成的rtmp

在GStreamer中获取rtmp流,创建马赛克并发送生成的rtmp,gstreamer,rtmp,Gstreamer,Rtmp,我运行以下代码 gst-launch-1.0 -e \ videomixer name=mix \ sink_0::xpos=0 sink_0::ypos=0 sink_0::alpha=0\ sink_1::xpos=0 sink_1::ypos=0 \ sink_2::xpos=200 sink_2::ypos=0 \ sink_3::xpos=0 sink_3::ypos=

我运行以下代码

gst-launch-1.0 -e \ videomixer name=mix \ sink_0::xpos=0 sink_0::ypos=0 sink_0::alpha=0\ sink_1::xpos=0 sink_1::ypos=0 \ sink_2::xpos=200 sink_2::ypos=0 \ sink_3::xpos=0 sink_3::ypos=100 \ sink_4::xpos=200 sink_4::ypos=100 \ rtmpsrc location='rtmp://streaming.example.com:1935/209147924'\ ! decodebin ! videoconvert ! videoscale \ ! video/x-raw,width=200,height=100 \ ! mix.sink_1 \ rtmpsrc location='rtmp://streaming.example.com:1935/209147925'\ ! decodebin ! videoconvert ! videoscale \ ! video/x-raw,width=200,height=100 \ ! mix.sink_2 \ rtmpsrc location='rtmp://streaming.example.com:1935/209147926'\ ! decodebin ! videoconvert ! videoscale \ ! video/x-raw,width=200,height=100 \ ! mix.sink_3 \ rtmpsrc location='rtmp://streaming.example.com:1935/209147927'\ ! decodebin ! videoconvert ! videoscale \ ! video/x-raw,width=200,height=100 \ ! mix.sink_4 \ mix. ! queue ! videoconvert ! x264enc ! flvmux streamable=true ! queue ! rtmpsink location='rtmp://streaming.example.com:1935/test' gst-launch-1.0-e\ 视频混合器名称=混合\ sink\u 0::xpos=0 sink\u 0::ypos=0 sink\u 0::alpha=0\ 接收器1::xpos=0接收器1::ypos=0\ 接收器2::xpos=200接收器2::ypos=0\ 接收器3::xpos=0接收器3::ypos=100\ 接收器4::xpos=200接收器4::ypos=100\ rtmpsrc位置传感器rtmp://streaming.example.com:1935/209147924'\ ! 德克宾!视频转换!视频秤\ ! 视频/x-raw,宽度=200,高度=100\ ! 混合水槽1\ rtmpsrc位置传感器rtmp://streaming.example.com:1935/209147925'\ ! 德克宾!视频转换!视频秤\ ! 视频/x-raw,宽度=200,高度=100\ ! 混合水槽2\ rtmpsrc位置传感器rtmp://streaming.example.com:1935/209147926'\ ! 德克宾!视频转换!视频秤\ ! 视频/x-raw,宽度=200,高度=100\ ! 混合水槽3\ rtmpsrc位置传感器rtmp://streaming.example.com:1935/209147927'\ ! 德克宾!视频转换!视频秤\ ! 视频/x-raw,宽度=200,高度=100\ ! 混合水槽4\ 混合队列视频转换!x264enc!flvmux streamable=true!队列rtmpsink位置rtmp://streaming.example.com:1935/test' 多谢各位。我们用马赛克解决了这个问题。这是工作版本。

有两个问题

1) 主要问题是“视频混合器”只有一个src键盘。您正在将其连接到两个焊盘。 -

通过这样做,您将视频混合器src_板连接到sixvimagesink的接收器板

最后,再次尝试使用queue和其他元素将videomixer src_uu连接到rtmpsink

因此,您必须删除其中一个连接

如果不想连接到xvimagesink,只需删除“!xvimagesink”

如果不想连接到rtmpsink,请删除“mix!queue!videoconvert…”部分

2) 如果要保留到队列的连接,则存在以下问题。 您正在将mix.sink_4连接到mix.src

... ! mix.sink_4 \
        ! mix. ! queue ! videoconvert ! ...
删除最后一行中的第一个“!”和“.”

... ! mix.sink_4 \
         mix ! queue ! videoconvert ! ...
那么它不应该给出语法错误

编辑1

我想你又犯了一个错误。您正在将mix的src连接到mix.sink\u 0。我已经改正了

gst-launch-1.0 -e \
    videomixer name=mix \
            sink_0::xpos=0   sink_0::ypos=0  sink_0::alpha=0\
            sink_1::xpos=0   sink_1::ypos=0 \
            sink_2::xpos=200 sink_2::ypos=0 \
            sink_3::xpos=0   sink_3::ypos=100 \
            sink_4::xpos=200 sink_4::ypos=100 \
      \    /* You should not add "! .mix.sink_0" here. */
    rtmpsrc location='rtmp://streaming.example.com:1935/209147924'\
        ! decodebin ! videoconvert ! videoscale \
        ! video/x-raw,width=200,height=100 \
        ! mix.sink_1 \
    rtmpsrc location='rtmp://streaming.example.com:1935/209147925'\
        ! decodebin ! videoconvert ! videoscale \
        ! video/x-raw,width=200,height=100 \
        ! mix.sink_2 \
    rtmpsrc location='rtmp://streaming.example.com:1935/209147926'\
        ! decodebin ! videoconvert ! videoscale \
        ! video/x-raw,width=200,height=100 \
        ! mix.sink_3 \
    rtmpsrc location='rtmp://streaming.example.com:1935/209147927'\
        ! decodebin ! videoconvert ! videoscale \
        ! video/x-raw,width=200,height=100 \
        ! mix.sink_4 \
        mix ! queue ! videoconvert ! x264enc ! flvmux streamable=true ! queue ! rtmpsink location='rtmp://streaming.example.com:1935/test'
让我在这里提供一些关于“name=”用法的信息。 您可以在gstreamer管道中命名一个元素,并使用它来构造管道。它在复杂管道中最有用。让我用一个简单的管道来展示它的用法

假设以下是所需的管道:

 srcelem ! elem1 ! elem2 ! elem3 ! sinkelem
可以这样写

elem2 name=named_elem \    /* Naming elem2 */
named_elem ! elem3 ! sinkelem \     /* Connecting elem2 to downstream pipeline part. Note that there is no "!" before "named_elem" */
srcelem ! elem1 ! named_elem /* Connecting elem2 to upstream pipeline part. Note that there is no "!" after "named_elem" */

如果您仔细阅读,它构造的管道与前面提到的管道相同。

添加最后一行时出错语法错误丢失。出现另一条错误消息。请告诉我,有什么问题吗<代码>警告:错误的管道:无法将mix链接到队列0网络上带有rtmp的马赛克示例,我没有找到。@user2306100还有更多问题。编辑了我的答案。没有“.”写入
警告:错误管道:没有元素“mix”
我编辑了问题中的代码。新错误<代码>警告:错误管道:没有元素“混合”哪里会有错误?谢谢。与“.”
一起工作!mix.sink_4\mix!队列videoconvert
我以为我是在混音。你能告诉我如何从马赛克的rtmp发出声音吗?
elem2 name=named_elem \    /* Naming elem2 */
named_elem ! elem3 ! sinkelem \     /* Connecting elem2 to downstream pipeline part. Note that there is no "!" before "named_elem" */
srcelem ! elem1 ! named_elem /* Connecting elem2 to upstream pipeline part. Note that there is no "!" after "named_elem" */