How to use xvimagesink in nvcompositor or set a fixed aspect ratio on nv3dsink

Below is my current pipeline:

    ./gst-rtsp-server/examples/test-launch "v4l2src device=/dev/video2 ! video/x-raw, width=2560, height=720, framerate=60/1 ! nvvidconv ! nvv4l2h265enc maxperf-enable=1 iframeinterval=4 profile=4 ! h265parse ! rtph265pay name=pay0"
    ```
    ```
    gst-launch-1.0 nvcompositor name=comp sink_0::xpos=0 sink_0::ypos=0 sink_0::width=2560 sink_0::height=720 sink_0::zorder=1 sink_0::alpha=1 sink_1::xpos=0 sink_1::ypos=0 sink_1::width=2560 sink_1::height=720 sink_1::zorder=2 sink_1::alpha=0.1 ! 'video/x-raw(memory:NVMM),format=RGBA' ! nv3dsink rtspsrc location=rtsp://127.0.0.1:8554/test latency=0 ! rtph265depay ! h265parse ! nvv4l2decoder ! nvvidconv ! 'video/x-raw(memory:NVMM),format=RGBA' ! comp.sink_0  videotestsrc ! videoconvert ! video/x-raw,format=RGBA ! nvvidconv ! 'video/x-raw(memory:NVMM),format=RGBA,width=2560,height=720' ! comp.sink_1    
    ```
I want my video to open in full screen but keep the 2560x720 ratio. I know xvimagesink keeps aspect ratios automatically. I was wondering if I could use xvimagesink instead or if not, how to open nv3dsink as a fullscreen but keeping the aspect-ratio (ie. filling in the rest with a black screen)

Hi,
I am able to see aspect ratio be kept while running:

$ gst-launch-1.0 videotestsrc ! video/x-raw,width=2560,height=720 ! nvvidconv ! 'video/x-raw(memory:NVMM)' ! nv3dsink

If you still see wrong aspect ratio, please set the properties to get desired layout:

  window-x            : X coordinate of window
                        flags: readable, writable
                        Unsigned Integer. Range: 0 - 2147483647 Default: 0
  window-y            : Y coordinate of window
                        flags: readable, writable
                        Unsigned Integer. Range: 0 - 2147483647 Default: 0
  window-width        : Width of window
                        flags: readable, writable
                        Unsigned Integer. Range: 0 - 2147483647 Default: 0
  window-height       : Height of window
                        flags: readable, writable
                        Unsigned Integer. Range: 0 - 2147483647 Default: 0

Sorry to clarify, it does open with the right aspect-ratio, but I want the window to have black padding on the top and bottom. In other words I want it to open in “full screen mode”. I can position it with window-height but that’ll still show my computer background

Hi,
Have checked and confirmed nv3dsink does not support filling background. A possible solution is to use nvcompositor to composite out a video plane with back ground and then render out.

Please try this command:

$ gst-launch-1.0 nvcompositor name=comp  sink_0::xpos=0 sink_0::ypos=360 sink_0::width=2560 sink_0::height=720 sink_0::zorder=1 sink_0::alpha=1 sink_1::xpos=0 sink_1::ypos=0 sink_1::zorder=2 sink_1::alpha=0.1 ! 'video/x-raw(memory:NVMM),format=RGBA' ! nv3dsink    videotestsrc ! video/x-raw,format=YUY2,width=2560,height=720,framerate=30/1 ! nvvidconv ! 'video/x-raw(memory:NVMM),format=RGBA' ! comp.sink_0    videotestsrc pattern=2 ! video/x-raw,format=RGBA,width=640,height=360 ! nvvidconv ! 'video/x-raw(memory:NVMM),format=RGBA,width=2560,height=1440' ! comp.sink_1

The videotestsrc pattern=2 is the background foe keeping aspect ratio.

Thanks @DaneLLL I’m trying to avoid nvcompositor to do this because it would add a bit of latency. What about adding some parameters to xvimagesink so that it opens in full screen in this pipeline?

    gst-launch-1.0 rtspsrc location=rtsp://127.0.0.1:8554/test latency=0 ! rtph265depay ! h265parse ! nvv4l2decoder ! nvvidconv ! xvimagesink sync=0

When I manually open it in fullscreen it automatically adds the black padding but I’m not sure if there’s a way to always force it to fill the screen.

Thanks!

Hi,
Please set pixel-aspect-ratio and give it a try. All properties are listed in xvimagesink

We don’t actually have experience about setting the properties. Would need other users to provide further suggestion.

Thanks I decided to just use a script that calls wmctrl -r 'gst-launch-1.0' -b toggle,fullscreen so that I don’t have to set a parameter. I appreciate your help!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.