0
votes

Here is the code for 2 mp4 videos playing in videoboxes.

gst-launch-1.0 filesrc location=1.mp4 ! decodebin ! queue ! videoconvert ! videobox border-alpha=0 right=-100 ! videomixer name=mix ! videoconvert ! autovideosink filesrc location=2.mp4 ! decodebin ! queue ! videoconvert ! videobox border-alpha=0 left=-100 ! mix.

I have tried with this code to play 3 videos

gst-launch-1.0 filesrc location=Downloads/1.mp4 ! decodebin ! queue ! videoconvert ! videobox border-alpha=0 right=-100 ! videomixer name=mix !

videoconvert ! autovideosink filesrc location=Downloads/2.mp4 ! decodebin ! queue ! videoconvert ! videobox border-alpha=0 left=-100 ! mix !

videoconvert ! autovideosink filesrc location=Downloads/3.mp4 ! decodebin ! queue ! videoconvert ! videobox border-alpha=0 left=-200 ! mix.

I get syntax error :(

2

2 Answers

0
votes

Once you instantiate an element with a name (eg. videomixer name=mix), you can later connect to it with . (eg. mix.). You don't need to repeat autovideosink 3 times after that.

gst-launch-1.0 filesrc location=Downloads/1.mp4 ! decodebin ! queue ! videoconvert ! videobox border-alpha=0 right=-100 ! videomixer name=mix ! videoconvert ! autovideosink 

               filesrc location=Downloads/2.mp4 ! decodebin ! queue ! videoconvert ! videobox border-alpha=0 left=-100 ! mix. 

               filesrc location=Downloads/3.mp4 ! decodebin ! queue ! videoconvert ! videobox border-alpha=0 left=-200 ! mix.

Here, we have initialized 3 pipes and merged three of them with mix element.

0
votes

Something like that with videomixer

gst-launch-1.0 -e \
videomixer name=mix background=0 \
        sink_1::xpos=0   sink_1::ypos=0 \
        sink_2::xpos=200 sink_2::ypos=0 \
        sink_3::xpos=100 sink_3::ypos=100 \
    ! autovideosink \
uridecodebin uri='file:///data/big_buck_bunny_trailer-360p.mp4' \
    ! videoscale \
    ! video/x-raw,width=200,height=100  \
    ! mix.sink_1 \
uridecodebin uri='file:///data/sintel_trailer-480p.webm' \
    ! videoscale \
    ! video/x-raw,width=200,height=100  \
    ! mix.sink_2 \
uridecodebin uri='file:///data/the_daily_dweebs-720p.mp4' \
    ! videoscale \
    ! video/x-raw,width=200,height=100  \
    ! mix.sink_3