Reputation: 1702
We are getting unexpected behaviour when using videoconvert
with gst-launch
:
On doing option (1) below we get errors:
gst-launch-1.0 v4l2src ! 'video/x-raw, width=640, height=480, framerate=30/1' ! autovideosink
The erros is:
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data flow error. Additional debug info: gstbasesrc.c(2865): gst_base_src_loop():/GstPipeline:pipeline0/GstV4l2Src:v4l2src0: streaming task paused, reason not-negotiated (-4)
The error does make sense, because probably the format of filter does not match format of v4l2src
or format of autovideosink
.
But by using videoconvert in both options (2&3) below, it works OK without any errors:
I see that option (2) below works without any errors:
gst-launch-1.0 v4l2src ! videoconvert ! 'video/x-raw, width=640, height=480, framerate=30/1' ! autovideosink
I also see that option (3) below works without any errors:
gst-launch-1.0 v4l2src ! 'video/x-raw, width=640, height=480, framerate=30/1' ! videoconvert ! autovideosink
The question is why is works in both cases (2&3).
I would assume that it should only work in one of them because if src of v4l2src
does not match filter(width=640, height=480) then we must convert the format of v4l2src
to match filter.
On the other hand, if the format of autovideosink
does not match filter (width=640, height=480) then we must do the conversion right after the filter.
So, I would assume that only (2) or (3) should work but not both.
Upvotes: 0
Views: 3408
Reputation: 2094
(2) and (3) can work because this could actually be an issue with the format of your video. The likely reason is that your camera produces some format and your video sink cannot accept it. Adding videoconvert
in the middle makes it convert from one to another and them they are happy.
To negotiate, videoconvert
gets the downstream caps and propagates them upstream, except that it injects more formats than downstream can handle because it can accept a different one and then just convert. The dimension and framerate are kept as is because nothing in that pipeline can scale or change the rate.
If you run the working pipeline with -v
flag it should print the actual negotiated caps and then you can see what v4l2src produces on its source pad and what the video sink receives in its sink pad. Then you can see what exactly videoconvert is converting.
Upvotes: 1