Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trying to play multiple video files simultaneously in Gstreamer

Im trying to make a command for gstreamer so it can play multiple video files simultaneously. So I done some research and found this one

gst-launch -e videomixer name=mix ! ffmpegcolorspace ! xvimagesink \
    videotestsrc pattern=1 ! video/x-raw-yuv, framerate=5/1, width=320, height=180 ! \
    videobox border-alpha=0 top=0 left=0 ! mix. \
    videotestsrc pattern=15 ! video/x-raw-yuv, framerate=5/1, width=320, height=180 ! \
    videobox border-alpha=0 top=0 left=-320 ! mix. \
    videotestsrc pattern=13 ! video/x-raw-yuv, framerate=5/1, width=320, height=180 ! \
    videobox border-alpha=0 top=-180 left=0 ! mix. \
    videotestsrc pattern=0 ! video/x-raw-yuv, framerate=5/1, width=320, height=180 ! \
    videobox border-alpha=0 top=-180 left=-320 ! mix. \
    videotestsrc pattern=3 ! video/x-raw-yuv, framerate=5/1, width=640, height=360 ! mix.

This is the output image= http://i.stack.imgur.com/4lZWL.png

and here is the code that i modified that suppose to be like this

http://i.stack.imgur.com/Mdsc0.png

time gst-launch -e videomixer name=mix ! ffmpegcolorspace ! xvimagesink \
    filesrc location=./Cityscape1Min_720p_mp4.mp4 ! video/x-raw-yuv, framerate=5/1, \
        width=320, height=180 ! videobox border-alpha=0 top=0 left=0 ! mix. \
    filesrc location=./Cityscape1Min_720p_mp4.mp4 ! video/x-raw-yuv, framerate=5/1, \
        width=320, height=180 ! videobox border-alpha=0 top=0 left=-320 ! mix. \
    filesrc location=./Cityscape1Min_720p_mp4.mp4 ! video/x-raw-yuv, framerate=5/1, \
        width=320, height=180 ! videobox border-alpha=0 top=-180 left=0 ! mix. \
    filesrc location=./Cityscape1Min_720p_mp4.mp4 ! video/x-raw-yuv, framerate=5/1, \
        width=320, height=180 ! videobox border-alpha=0 top=-180 left=-320 ! mix. 

But it does not work. Anyone have other solutions?

like image 636
Muhammad Amirul Syahmi Hamzah Avatar asked Sep 15 '11 06:09

Muhammad Amirul Syahmi Hamzah


1 Answers

I like this approach, it will create a matrix of 2x2. sink_0 is your background, you can also set it as an image. More info on picture in picture.

gst-launch -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 \
    ! xvimagesink \
videotestsrc pattern="black" \
    ! video/x-raw-yuv,width=400,height=200 \
    ! mix.sink_0 \
uridecodebin uri='file:///home/user/video/test1.mp4' \
    ! ffmpegcolorspace ! videoscale \
    ! video/x-raw-yuv,width=200,height=100 \
    ! mix.sink_1 \
uridecodebin uri='file:///home/user/video/test2.mp4' \
    ! ffmpegcolorspace ! videoscale \
    ! video/x-raw-yuv,width=200,height=100 \
    ! mix.sink_2 \
uridecodebin uri='file:///home/user/video/test.avi' \
    ! ffmpegcolorspace ! videoscale \
    ! video/x-raw-yuv,width=200,height=100 \
    ! mix.sink_3 \
uridecodebin uri='mms://server/video/test.wmv' \
    ! ffmpegcolorspace ! videoscale \
    ! video/x-raw-yuv,width=200,height=100 \
    ! mix.sink_4 \
like image 175
Dejan Avatar answered Sep 23 '22 01:09

Dejan