video-streaminggstreamergst-launch

Make gst-launch-1.0 window occupy full screen


I have this pipeline here where I'm running two streams in one window. I want this window size to increase and occupy the full screen to prevent the cropping that's happening in the video. How can I achieve this?

/usr/bin/gst-launch-1.0 -e videomixer name=mix background=0 sink_1::xpos=0 sink_1::ypos=0 sink_2::xpos=500 sink_2::ypos=0 ! autovideosink uridecodebin uri=https://gstreamer.freedesktop.org/data/media/sintel_trailer-480p.webm ! videoscale ! video/x-raw,width=500,height=400 ! mix.sink_1 uridecodebin uri=https://gstreamer.freedesktop.org/data/media/sintel_trailer-480p.webm ! videoscale ! video/x-raw,width=500,height=400 ! mix.sink_2

I expected that changing the dimensions of the individual stream would increase the size of the overall window but it just crops the video. How can I fix this?


Solution

  • Making an answer because comment doesn't allow so so many chars...

    For Linux case running X, you may get the current screen resolution and try to rescale output to that resolution such as:

    WIDTH=$(xrandr | grep '*' | tr -s ' ' |&tee | cut -d' ' -f2 | cut -d'x' -f1)
    HEIGHT=$(xrandr | grep '*' | tr -s ' ' |&tee | cut -d' ' -f2 | cut -d'x' -f2)
    echo $WIDTH $HEIGHT
    
    gst-launch-1.0 -e \
      uridecodebin uri=https://gstreamer.freedesktop.org/data/media/sintel_trailer-480p.webm ! queue ! videoscale ! video/x-raw,width=500,height=400 ! mix.sink_0\
      uridecodebin uri=https://gstreamer.freedesktop.org/data/media/sintel_trailer-480p.webm ! queue ! videoscale ! video/x-raw,width=500,height=400 ! mix.sink_1\
      videomixer name=mix\
        sink_0::xpos=0   sink_0::ypos=0 sink0::width=500 sink_0::height=400\
        sink_1::xpos=500 sink_1::ypos=0 sink1::width=500 sink_1::height=400\
      ! video/x-raw,width=1000,height=400,pixel-aspect-ratio=1/1 ! videoconvert ! videoscale ! video/x-raw,width=$WIDTH,height=$HEIGHT ! xvimagesink 
    
    # Simple example for NVIDIA platform case (Jetson, using nvcompositor would be better):
    gst-launch-1.0 -e \
      uridecodebin uri=https://gstreamer.freedesktop.org/data/media/sintel_trailer-480p.webm ! queue ! nvvidconv ! video/x-raw,width=500,height=400 ! mix.sink_0\
      uridecodebin uri=https://gstreamer.freedesktop.org/data/media/sintel_trailer-480p.webm ! queue ! nvvidconv ! video/x-raw,width=500,height=400 ! mix.sink_1\
      videomixer name=mix\
        sink_0::xpos=0   sink_0::ypos=0 sink0::width=500 sink_0::height=400\
        sink_1::xpos=500 sink_1::ypos=0 sink1::width=500 sink_1::height=400\
      ! video/x-raw,width=1000,height=400,pixel-aspect-ratio=1/1 ! nvvidconv ! "video/x-raw(memory:NVMM),format=NV12,width=$WIDTH,height=$HEIGHT" ! nv3dsink