This little snippit takes video from two V4L2 sources (like webcams), and displays them side by side. The script in question is setup for 320×240 MJPEG, tweak the numbers and you get different resolution from your video sources.
One important parameter if you’re adding more sources is border-alpha. This needs to be set to 0, so that the black border that is added around a video source is transparent so you can push it on top of another video frame.
This is handy if you have two webcams, you can use this to setup side-by-side stereo display to 3D glasses. Just make sure to point your cameras at the right angle, otherwise your convergence will be all messed up.
You need the gstreamer-tools package in order to use the script.
#!/bin/sh
gst-launch \
v4l2src device=/dev/video1 ! "image/jpeg,width=320,height=240" ! jpegdec ! "video/x-raw-yuv" ! videobox right=-320 border-alpha=0 ! videomixer name=mix ! \
ffmpegcolorspace ! xvimagesink \
v4l2src device=/dev/video2 ! "image/jpeg,width=320,height=240" ! jpegdec ! "video/x-raw-yuv" ! videobox left=-320 ! mix.