uvcsink using arbitrary sources

Nicolas Dufresne nicolas at ndufresne.ca
Wed Sep 6 17:34:42 UTC 2023


Le lundi 04 septembre 2023 à 14:37 +0200, Michael Tretter via gstreamer-devel a
écrit :
> On Fri, 01 Sep 2023 16:25:28 +0200, Markus Fritsche wrote:
> > On 31.08.2023 15:53, Michael Tretter via gstreamer-devel wrote:
> > > On Fri, 18 Aug 2023 14:18:04 +0200, Markus Fritsche via gstreamer-devel
> > > wrote:
> > > > What additional info should I provide?
> > 
> > > Can you test if the patches in
> > > https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5170
> > > help?
> > 
> > I went ahead and merged the PR as well as the one referenced. I created a
> > new device using the uvc-gadget.sh skript from the freedesktop uvc-gadget
> > repo:
> > 
> >         create_frame $FUNCTION 1280 720 mjpeg mjpeg
> > 
> >         mkdir functions/$FUNCTION/streaming/header/h
> >         cd functions/$FUNCTION/streaming/header/h
> > #       ln -s ../../uncompressed/yuyv
> >         ln -s ../../mjpeg/mjpeg
> > 
> > (changed 'm' to 'mjpeg' and no yuyv formats).
> > 
> > > Please also provide the log of the pipeline with GST_DEBUG=uvcsink:5.
> > > The
> > > uvcsink should log its internal state changes and there should be
> > > something
> > > right before the pipeline stops.
> > 
> > With that, I started the Windows Camera App;
> > 
> [...]
> > 0:00:25.997892959   710  0x1c69ec0 DEBUG                uvcsink
> > gstuvcsink.c:348:gst_uvc_sink_to_v4l2sink:<uvcsink0> switching to v4l2sink
> 
> Here the uvcsink switches to the internal v4l2sink. That means the UVC device
> should start streaming,
> 
> > 0:00:26.531331084   710  0x1c69e88 WARN                GST_CAPS
> > gstpad.c:5788:pre_eventfunc_check:<v4l2sink:sink> caps image/jpeg,
> > sof-marker=(int)0, width=(int)1280, height=(int)720,
> > pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)15/1,
> > interlace-mode=(string)progressive, colorimetry=(string)2:4:7:1,
> > multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono
> > not accepted
> 
> but the internal v4l2sink does not accept the negotiated caps.
> 
> Try to add a capsfilter with exactly the caps in this warning to your pipeline
> right before the uvcsink. The v4l2sink is a bit picky regarding the caps, as
> the V4L2 output device of the UVC gadget is not entirely compliant to the V4L2
> API [0].

I believe that this may also be similar to issues seen with encoders. Often the
colorimetry= field is problematic. I will let you know if I see a fix for that,
or if I find the time to make one. In short, v4l2 sink pads in video4linux2
plugin tends to advertise less then what they actually support in term of
colorimetry. When upstream colorimetry is not set or is fixed, it just fails.

For encoders, the common workaround is to use a capssetter to "correct" the
fields that aren't right. I don't have any example handy, but you'll find a lot
on the RPi forum.

> 
> You may also increase the loglevel of GST_CAPS, check the log for caps that
> would be accepted by the v4l2sink, and only add the missing fields to the
> capsfilter.
> 
> Michael
> 
> [0] https://lore.kernel.org/linux-media/20230323-uvc-gadget-cleanup-v1-0-e41f0c5d9d8e@pengutronix.de



More information about the gstreamer-devel mailing list