scalegstreameraspect-ratiogst-launch

How to change aspect-ratio with gstreamer?


I have this command:

gst-launch-1.0 ximagesrc startx=1920 starty=0 endx=2943 endy=768 use-damage=0\
! video/x-raw,framerate=15/1 \
! videoscale method=0 \
! video/x-raw,width=640,height=360 \
! videoflip method=horizontal-flip \
! ximagesink

It takes the second display (from pixel 1920 to the last one -1) and shows it in a small window in first display, applying a horizontal-flip and using neighbour scaling method, at 15fps. It is for "monitor" my second display (TV) in my first display (computer monitor).

Now, my second display is a 16:9 TV, and I'm using 1024x768. The images that are shown there are already scaled (from 16:9 to 4:3). Now, I need to scale that 4:3 proportion back to 16:9 in gstreamer window.

But, by using this command, I have what you can see in this complete screenshot (with the actual window and a the "wished" window):

enter image description here

What is the correct command to do that?


Solution

  • Do not add borders with videoscale:

    gst-launch-1.0 ximagesrc startx=1920 starty=0 endx=2943 endy=768 use-damage=0\
    ! video/x-raw,framerate=15/1 \
    ! videoscale method=0 add-borders=false \
    ! video/x-raw,width=640,height=360 \
    ! videoflip method=horizontal-flip \
    ! ximagesink