开发者

Gstreamer: how to get three copies of the same video stream in one window?

开发者 https://www.devze.com 2023-01-27 05:33 出处:网络
I\'m trying to reproduce \"Fractals without a computer\" but with a computer instead of three projectors.

I'm trying to reproduce "Fractals without a computer" but with a computer instead of three projectors. I think it should be quite simple to do with gstreamer: just replicate stream from camera with tee and put three identical pictures on one with videomixer.

Here I'm using 'videotestsrc pattern=1' as a stream which I wish to replicate, and 'videotestsrc pattern="black"' as a background for the whole screen.

#!/bin/bash
gst-launch -v \
    videotestsrc pattern=1 ! video/x-raw-yuv,width=200,height=200 \
        ! tee name=t \
    videomixer name=mix \
          sink_0::xpos=0   sink_0::ypos=0 \
          sink_1::xpos=100 sink_1::ypos=0 \
          sink_2::xpos=200 sink_2::ypos=200 \
          sink_3::xpos=0   sink_3::ypos=200 \
        ! ffmpegcolorspace ! xvimages开发者_StackOverflow中文版ink \
    videotestsrc pattern="black" ! video/x-raw-yuv,width=400,height=400 \
        ! mix.sink_0 \
    t. ! queue ! mix.sink_1 \
    t. ! queue ! mix.sink_2 \
    t. ! queue ! mix.sink_3 \

The problem is that I get only two copies: the one corresponding to sink_1 and the other -- to sink_2. If I swap last two lines then I get only sink_1 and sink_3.

So the question is how to show all three copies?


Something like this

gst-launch -v \
videotestsrc pattern=1 ! video/x-raw-yuv,width=200,height=200 \
    ! tee name=t \
videomixer name=mix \
      sink_0::xpos=0   sink_0::ypos=0    sink_0::zorder=0\
      sink_1::xpos=100 sink_1::ypos=0    sink_1::zorder=1\
      sink_2::xpos=200 sink_2::ypos=200  sink_2::zorder=2\
      sink_3::xpos=0   sink_3::ypos=200  sink_3::zorder=3\
    ! ffmpegcolorspace ! xvimagesink \
videotestsrc pattern="black" ! video/x-raw-yuv,width=400,height=400 \
    ! mix.sink_0 \
t. ! queue ! mix.sink_1 \
t. ! queue ! mix.sink_2 \
t. ! queue ! mix.sink_3 


Yoa! adding sink_i::zorder=i for each i=0..3 solves the problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消