Using gst-launch with ximagesrc says "There may be a timestamping problem, or this computer is too slow." - how do I solve this?

Alain Culos gstreamer at asoundmove.net
Sun Apr 5 00:20:39 UTC 2020


Dear All,

I just discovered GStreamer, so apologies if this is a basic error, but no matter how hard I try I can't find what is wrong with my set-up / pipeline.

===========
Summary:
When using ximagesrc, error messages appear to tell me buffers are lost and that there may be timestamping issues or that my computer is slow.

I have a beefy desktop, 1yo i7, 6-core hyperthreaded, 64GB RAM ubuntu 18.04).
GStreamer 1.14.5

===========
In detail:

The video shown with this command line is very laggy (it hardly uses any RAM or CPU // other note: my desktop easily copes with e.g. zoom meetings):

    gst-launch-1.0 autovideosrc ! videoconvert ! autovideosink # shows no error message
    gst-launch-1.0 v4l2src device=/dev/video0 ! videoconvert ! autovideosink # does exactly the same


Preparing the ground for chroma-keying a green screen background, this example works the same way the first two do (laggy but good quality & no error message showing):
    w=1280; h=800; x0=450; y0=200; gst-launch-1.0 \
        v4l2src device=/dev/video0 \
        ! videocrop left=$x0 right=$(( 1920 - $w - $x0 )) top=$y0 bottom=$(( 1080 - $h - $y0 )) \
        ! alpha method=green angle=70 \
        ! videoconvert \
        ! autovideosink

The background to replace the green screen will be taken from an application window.
This causes issues with buffers dropped & it complains about timestamping issues.
    gst-launch-1.0   ximagesrc xid=0x02a00006 ! videoconvert ! autovideosink

Below is the output of the command above:
    Setting pipeline to PAUSED ...
    Pipeline is live and does not need PREROLL ...
    Setting pipeline to PLAYING ...
    New clock: GstSystemClock
    WARNING: from element /GstPipeline:pipeline0/GstAutoVideoSink:autovideosink0/GstXvImageSink:autovideosink0-actual-sink-xvimage: A lot of buffers are being dropped.
    Additional debug info:
    gstbasesink.c(2902): gst_base_sink_is_too_late (): /GstPipeline:pipeline0/GstAutoVideoSink:autovideosink0/GstXvImageSink:autovideosink0-actual-sink-xvimage:
    There may be a timestamping problem, or this computer is too slow.


Even if I impose a low frame rate, it outputs the same error messages as above, command line:
    gst-launch-1.0   ximagesrc xid=0x02a00006 ! video/x-raw,framerate=5/1 ! videoconvert ! autovideosink

Obviously, if I combine the two, performance gets worse, despite still not hitting the CPU or RAM, and the following command shows exactly the same messages as above:
    w=1280; h=800; x0=450; y0=200; gst-launch-1.0   \
        v4l2src device=/dev/video0 \
        ! videocrop left=$x0 right=$(( 1920 - $w - $x0 )) top=$y0 bottom=$(( 1080 - $h - $y0 )) \
        ! alpha method=green angle=70 \
        ! mixer.sink_1   \
        \
        ximagesrc xid=0x02a00006 ! videoscale \
        ! video/x-raw,width=$w,height=$h ! mixer.sink_0   \
        \
        videomixer name=mixer sink_0::zorder=0 sink_1::zorder=1 \
        ! videoconvert ! autovideosink

Whether I put ximagesrc before v4l2src or after changes nothing.

(next challenges: 1/ channelling this to /dev/video10; 2/ channeling the audio from the webcam (/dev/video0) to the virtual webcam (dev/video10))

For now I  would most appreciate some help with making the above commands works without error/warning messages and good performance. Or in other words how do I resolve timestamping with ximagesrc?

Best regards,
Alain.


On Wed, 1 Apr 2020, at 02:42, Alain Culos wrote:
> Hi,
> 
> I am a recent newcomer to gstreamer.
> Trying to use `gst-launch-1.0` to chroma-key my webcam and insert a pdf 
> as background.
> 
> My attempt is very imperfect:
> 1/ I have not been able to find the right parameters to make the window 
> sizes match.
> 2/ gst-launch occasionally complains it loses a lot of buffers.
> 3/ the video output only updates seemingly randomly, infrequently, and 
> seems to (but not always) needs the pdf window to have focus and the 
> mouse to be over it (but not exclusively).
> 
> Maybe there is a better solution.
> My desktop is quite powerful: a modern (about 1yo, i7, 6-core, 
> hyperthreaded, 64GB RAM), 4k display, 1080p USB webcam, SSD.
> Linux 5.3.0-40-generic #32~18.04.1-Ubuntu SMP Mon Feb 3 14:05:59 UTC 
> 2020 x86_64 x86_64 x86_64 GNU/Linux
> ()
> 
> The commands I ran are:
> 
> 1/ testing the chroma-key with a chequered background
> gst-launch-1.0 \
>   videotestsrc pattern=checkers-8 ! video/x-raw,width=800,height=640 ! 
> mixer.sink_0 \
>   autovideosrc ! video/x-raw,width=800 ! alpha method=custom 
> target-r=255 target-g=255 target-b=255 ! mixer.sink_1 \
>   videomixer name=mixer sink_0::zorder=0 sink_1::zorder=1 ! 
> videoconvert ! autovideosink
> -> Very slow video, does not chroma-key on white!
> gst-launch recurrent message: "A lot of buffers are being dropped"
> 
> 2/ testing the chroma-key (2nd attempt)
> gst-launch-1.0 \
>   videotestsrc pattern=checkers-8 ! 
> video/x-raw,width=800,height=640,framerate=1/1 ! mixer.sink_0 \
>   autovideosrc ! video/x-raw,width=800 ! alpha method=custom 
> target-r=255 target-g=255 target-b=255 ! mixer.sink_1 \
>   videomixer name=mixer sink_0::zorder=0 sink_1::zorder=1 ! 
> videoconvert ! autovideosink
> -> Same as above
> 
> 3/ testing my video
> gst-launch-1.0 autovideosrc ! video/x-raw,width=800 ! videoconvert ! 
> autovideosink
> -> Showing my webcam is almost real-time, but has a bit of lag
> The same test at 1080p is very laggy
> 
> 4/ testing a source application window (evince, showing a pdf file)
> gst-launch-1.0 \
>   ximagesrc xid=0x06800008 ! mixer.sink_0 \
>   autovideosrc ! video/x-raw,width=800 ! alpha method=custom 
> target-r=255 target-g=255 target-b=255 ! mixer.sink_1 \
>   videomixer name=mixer sink_0::zorder=0 sink_1::zorder=1 ! 
> videoconvert ! autovideosink
> -> Does not update the video in realtime (only updates rarely, at most 
> every few seconds, when the application window has the focus or redraw 
> events (possibly and/or mouse over)), does not allow me to resize the 
> application window video stream.
> 
> 
> Hoping to find here some pointers to solve the issues highlighted 
> above, most importantly performance (framerate).
> 
> Next steps: a/ including the audio stream, b/ outputting to a video 
> device so I can use this as a source for a video conference 
> (zoom/skype/jitsi), c/ using an actual green screen.
> 
> Thanks for any help, pointers to documentation or tutorials.
> Regards,
> Alain.
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>


More information about the gstreamer-devel mailing list