tearing in gstreamer-captured screen video with OpenGL Full-screen mode

Hi,

On Tegra TX1, we are using gstreamer-1.0 ximagesrc to capture the screen to a video file when an OpenGl application is rendering to display.

The run-time display is normal. However, when we play back the recorded stream, the captured video shows tearing effect when OpenGL application is in Full Screen mode, although the tearing is not seen when OpenGL app exit to window mode.

Is there any way to fix this?

Any update?

Hi HooverLv,
Please share your full pipeline for further check.

If it is an issue in ximagesrc, we probably cannot help since it is developed by gstreamer organization.

gst-launch-1.0 -v ximagesrc use-damage=0 ! nvvidconv ! ‘video/x-raw(memory:NVMM),alignment=(string)au,format=(string)I420,framerate=(fraction)25/1,pixel-aspect-ratio=(fraction)1/1’ ! omxh264enc ! ‘video/x-h264,stream-format=(string)byte-stream’ ! filesink location=“test.h264” -e

Hi HooverLv, are you able to share an open GL app for reproducing the issue also?

Hi, DaneLLL,

Sorry I can’t create an app soon.

Probably I can stream a USB camera video to a GL texture and render it to full screen and I may try this when I have time.

Please try to download the below OpenGL app (SphereW) and run it on Tegra Tx1, then use the " gst-launch-1.0 " mentioned before to store screen capture.

https://pan.baidu.com/s/1dE2pyql

or download attached 7z file
SphereW.7z (248 KB)

upload the app

Hi, Danelll,

Are you seeing the below tearing in SphereW ?

Hi HooverLv,
We are now still checking it. For now it looks to be an issue in ximagesrc fetching frames.

Could you try to run jetson_clocks.sh to max out all clocks?

And ximagesrc is not developed/owned by NVIDIA. Please other users could kindly share information about it.

Hi,

I tried. With or without jetson_clocks.sh, the tearing is still seen.

hi HooverLv,
We don’t observe the tearing in all max clocks.

Please check tegrastats. Not sure but probably the GPU gets 100% loaded.

Hi, DaneLLL

If this is really an ximagesrc issue, is there any plugins other than ximagesrc that I can use to capture screen?

with jetson_clocks.sh, the SphereW is OK.
But out use case where 7 PAL video are captured and streamed to GPU the issue is still there.In our real case GPU is 100% loaded, however when exit from full sreen to windows mode, the GPU usage did not change, but recorded data is fine, So I guess GPU usage is not root cause?

Hi HooverLv,
Here is a sample for reference:

It demonstrates an simple GL application as EGLStream producer and binds to nveglstreamsrc. The encoding can be done by linking nveglstreamsrc and omxh264enc. Please refer to source of nvgstcapture-1.0 also.

hi DaneLLL,

I follow the operation in readme, appear purple and blue alternate picture, did not see the capture screen.

I test the example on the Tegra TX2 board, no picture appears,

GST_DEBUG=3 nvgstcapture-1.0 --camsrc=1 --prev-res=3

output error:

Framerate set to : 30 at NvxVideoEncoderSetParameter0:00:00.089985600 2671 0x63f4f0 WARN omxh264enc gstomxh264enc.c:252:gst_omx_h264_enc_set_format: Setting profile/level not supported by component
NvMMLiteOpen : Block : BlockType = 4
===== MSENC =====
NvMMLiteBlockCreate : Block : BlockType = 4
0:00:00.091299616 2671 0x63f4f0 WARN omxvideoenc gstomxvideoenc.c:1773:gst_omx_video_enc_set_format: Error setting temporal_tradeoff 0 : Vendor specific error (0x00000001)
Obtained EGLConfig and EGLContext
Bound layer to rendering surface
0:00:00.586830080 2671 0x63f540 ERROR nvvidconv gstnvvconv.c:1752:gst_nvvconv_do_transform: gst_nvvconv_do_transform: NvDdk2dBlit failed: 2

0:00:00.586879328 2671 0x63f540 ERROR nvvidconv gstnvvconv.c:3728:gst_nvvconv_transform: gst_nvvconv_transform: Rmsurface colorspace conversion failed

0:00:00.602776224 2671 0x63f050 WARN basesrc gstbasesrc.c:2948:gst_base_src_loop: error: Internal data flow error.
0:00:00.602811904 2671 0x63f050 WARN basesrc gstbasesrc.c:2948:gst_base_src_loop: error: streaming task paused, reason error (-5)
0:00:00.602940928 2671 0x63f050 WARN queue gstqueue.c:992:gst_queue_handle_sink_event: error: Internal data flow error.
ERROR on bus: by /GstPipeline:capture_native_pipeline/GstBin:cap_bin/GstNvEglStreamSrc:nveglstreamsrc0: Internal data flow error.
0:00:00.602970944 2671 0x63f050 WARN queue gstqueue.c:992:gst_queue_handle_sink_event: error: streaming task paused, reason error (-5)
0:00:00.603166432 2671 0x63f4f0 FIXME basesink gstbasesink.c:3126:gst_base_sink_default_event: stream-start event without group-id. Consider implementing group-id handling in the upstream elements
debug info:
gstbasesrc.c(2948): gst_base_src_loop (): /GstPipeline:capture_native_pipeline/GstBin:cap_bin/GstNvEglStreamSrc:nveglstreamsrc0:
streaming task paused, reason error (-5)

Hi linwen,
What you have observed is normal. In the sample, it simply changes background colors every 15 frames.

while (frame < 100) {
        if (frame % 15 == 0) {
            r = (r > 0)?0:0.5;
            g = (g > 0)?0:0.5;
            b = (b > 0.5)?0.5:1;
        }
	    glClearColor( r, g, b, 1 );
        glClear( GL_COLOR_BUFFER_BIT );
        eglSwapBuffers_wrapper();

        usleep(32000);
        frame ++;
    }

Hi DaneLLL,
Thank you for your reply.

Which function Can I call to achieved screenshot, if I want to save as a file to test my record screen wheather tearing, can I use gst-launch-1.0 to achieve it?

Hi linwen, you can try ximagesrc but it probably has the issue
https://devtalk.nvidia.com/default/topic/1001636/jetson-tx1/tearing-in-gstreamer-captured-screen-video-with-opengl-full-screen-mode/post/5126864/#5126864

You can run jetson_clocks.sh and see if it helps.