Re: 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
Wed Apr 8 10:38:35 UTC 2020


On Tue, 7 Apr 2020, at 01:24, Desouza, Ederson wrote:
> On Tue, 2020-04-07 at 00:52 +0100, Alain Culos wrote:
> > On Tue, 7 Apr 2020, at 00:11, Desouza, Ederson wrote:
> > > On Mon, 2020-04-06 at 23:16 +0100, Alain Culos wrote:
> > > > On Mon, 6 Apr 2020, at 21:44, Desouza, Ederson wrote:
> > > > > On Mon, 2020-04-06 at 20:39 +0100, Alain Culos wrote:
> > > > > > On Mon, 6 Apr 2020, at 17:26, Desouza, Ederson wrote:
> > > > > > > On Sun, 2020-04-05 at 01:20 +0100, Alain Culos wrote:
> > > > > > > > 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.
> > > > > > > Have you tried using "use-damage=false" parameter on ximagesrc?
> > > > > >     gst-launch-1.0   ximagesrc xid=0x02a00006 use-damage=false ! videoconvert ! autovideosink
> > > > > > The simple pipeline above now works flawlessly, with near real-time mirroring of the original window, great, now I need to make the more complex pipeline work better.
> > > > > > 
> > > > > > The mixer pipeline below, now updates about once per second (much better than without the "use-damage=false"), but still reports the timestamping error message.
> > > > > > 
> > > > > >     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 use-damage=false ! videoscale \
> > > > > >         ! video/x-raw,width=$w,height=$h ! mixer.sink_0   \
> > > > > >         \
> > > > > >         videomixer name=mixer sink_0::zorder=0 sink_1::zorder=1 \
> > > > > >         ! videoconvert ! autovideosink
> > > > > 
> > > > > Try matching the framerate of both ximagesrc and v4l2src elements.
> > > > > Maybe add some queues to the pipeline too?
> > > You can take a look at this link for a nice overview of queues:
> > > https://gstreamer.freedesktop.org/documentation/tutorials/basic/multithreading-and-pad-availability.html?gi-language=c
> > > I suggested it so that you may have more than on thread in your
> > > pipeline. It _may_ help - or not =D
> > Great resource, clear.
> > I moved both queues to the end of my pipelines, just before the input into the mixer sinks, it did not change anything.
> > 
> > > > Trying (see below, 2nd block, ximagesrc, 2nd line, framerate) and (2nd block, 1st line, queue) - one or the other or both - all yield the same result as previously:
> > > >     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 use-damage=false ! queue ! videoscale \
> > > >         ! video/x-raw,width=$w,height=$h,framerate=30/1 ! mixer.sink_0   \
> > > >         \
> > > >         videomixer name=mixer sink_0::zorder=0 sink_1::zorder=1 \
> > > >         ! videoconvert ! autovideosink
> > > > 
> > > 
> > > I see that you fixed the framerate for the ximagesrc - are you sure
> > > that v4l2src has the same framerate? Anyway, another thing to try is to
> > > lower both framerates. You may need to use "videorate" element to
> > > reduce v4l2src framerate.
> > I kept the queues and added "! videorate max-rate=5" (if I use rate instead of max-rate, it freezes the video output) after both ximagesrc and v42src, it made things worse (slower than 1 refresh per second) + same error messages.
> I imagined something like:
>  ... ! videorate ! video/x-raw,framerate=10/1 ! ...
> 
> For the v4l2src branch. I think that you don't need the videorate on
> the ximagesrc branch, only the caps. 

Ok, I removed the videorate from the ximagesrc branch, using caps to set the framerate to 5/1 or 10/1.
I tried the "! videorate ! video/x-raw,framerate=5/1" (or 10/1) before or after (or also without) the videocrop element.
In all cases I still get the error messages and warnings, as well as a very laggy video stream.
With framerate at 10/1 it also scales the v4l2src to something much smaller.

(thanks so much for trying to help and find a solution, but I am not quite there yet)

    w=1280; h=800; x0=450; y0=200; gst-launch-1.0
           v4l2src device=/dev/video0  ! videorate ! video/x-raw,framerate=5/1 \
           ! videocrop left=$x0 right=$(( 1920 - $w - $x0 )) top=$y0 bottom=$(( 1080 - $h - $y0 )) \
           ! alpha method=green angle=70 \
           ! queue ! mixer.sink_1 \
            \
           ximagesrc xid=0x06600003 use-damage=false ! videoscale \
           ! video/x-raw,width=$w,height=$h,framerate=5/1 ! queue ! mixer.sink_0 \
            \
           videomixer name=mixer sink_0::zorder=0 sink_1::zorder=1 \
           ! videoconvert ! autovideosink -v

> > > > > > Output:
> > > > > > 
> > > > > >     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.
> > > > > > } * repeats every second or so.
> > > > > > 
> > > > > > Thanks & regards,
> > > > > > Alain.
> > > > > > 
> > > > > > 
> > > > > > > > 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

This point is solved by "use-damage=false"

> > > > > > > > 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.


More information about the gstreamer-devel mailing list