Error using v4l2sink when combining 2 camera streams

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Error using v4l2sink when combining 2 camera streams

Jim Ruxton

If I want to send a video stream on /dev/video4 to a loopback device in Ubuntu I can use :

./gst-launch-1.0 -v -m  v4l2src device=/dev/video4 ! v4l2sink device=/dev/video0    

And the video on /dev/video4 can be seen with :

ffplay /dev/video0

I can merge 2 videos with:

./gst-launch-1.0 v4l2src device=/dev/video4 ! videoscale ! queue ! videoconvert ! video/x-raw, format=YUY2, framerate=30/1, width=640, height=480! alpha alpha=1 ! videobox border-alpha=0 left=-640 ! compositor  name=Mix
 ! videoconvert ! autovideosink  v4l2src device=/dev/video2 ! videoscale ! queue ! videoconvert ! video/x-raw, format=YUY2, framerate=30/1, width=640, height=480! alpha alpha=1 ! videobox border-alpha=0 right=-640 ! Mix.

And see the merged camera videos on my monitor but I can't seem to send those merged videos to a loopback device. For example if I try changing autovideosink to v4l2sink device=/dev/video0:

./gst-launch-1.0 v4l2src device=/dev/video4 ! videoscale ! videoconvert ! video/x-raw, format=YUY2, framerate=30/1, width=640, height=480! alpha alpha=1 ! videobox border-alpha=0 left=-640 ! videomixer name=Mix ! videoconvert 
! v4l2sink device=/dev/video0 sync=false v4l2src device=/dev/video2 ! videoscale ! videoconvert ! video/x-raw, format=YUY2, framerate=30/1, width=640, height=480! alpha alpha=1 ! videobox border-alpha=0 right=-640 ! Mix.

I get the following result with no video  output:

Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src1: Internal data stream error.
Additional debug info:
gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src1:
streaming stopped, reason not-negotiated (-4)
Execution ended after 0:00:00.381495593
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

I have also tried not specifying a video format as I have in my first example above but get the same error. Does anyone know how I can send my merged stream to the loopback device?
Thanks
Jim

 


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Error using v4l2sink when combining 2 camera streams

gotsring
Assuming you're using v4l2loopback to create the loopback device, there seems
to be a hack to get this to work on the more recent GStreamer releases. Just
add identity drop-allocation=1 to the pipeline.

Example of using loopback (video1) using test sources:
gst-launch-1.0 videotestsrc ! video/x-raw, format=YUY2, framerate=30/1,
width=640, height=480 ! \
alpha alpha=1 ! videobox border-alpha=0 left=-640 ! compositor  name=Mix ! \
videoconvert ! video/x-raw, format=YUY2 ! identity drop-allocation=1 !
v4l2sink device=/dev/video1  \
videotestsrc pattern=ball ! video/x-raw, format=YUY2, framerate=30/1,
width=640, height=480 ! \
alpha alpha=1 ! videobox border-alpha=0 right=-640 ! Mix.


Solution gotten from the bottom of this page:
https://github.com/umlaeute/v4l2loopback/wiki/GStreamer

I typically use udpsink to send videos over network loopback, and then I can
play the videos as a network source on something like VLC. Probably not
great, but I've had no problems so far!



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Error using v4l2sink when combining 2 camera streams

Jim Ruxton
Thanks so much for this. Your pipeline worked when I substituted a
v4l2src for the videotestsrc. Much appreciated.

Jim

On 2021-02-17 6:16 p.m., gotsring wrote:

> Assuming you're using v4l2loopback to create the loopback device, there seems
> to be a hack to get this to work on the more recent GStreamer releases. Just
> add identity drop-allocation=1 to the pipeline.
>
> Example of using loopback (video1) using test sources:
> gst-launch-1.0 videotestsrc ! video/x-raw, format=YUY2, framerate=30/1,
> width=640, height=480 ! \
> alpha alpha=1 ! videobox border-alpha=0 left=-640 ! compositor  name=Mix ! \
> videoconvert ! video/x-raw, format=YUY2 ! identity drop-allocation=1 !
> v4l2sink device=/dev/video1  \
> videotestsrc pattern=ball ! video/x-raw, format=YUY2, framerate=30/1,
> width=640, height=480 ! \
> alpha alpha=1 ! videobox border-alpha=0 right=-640 ! Mix.
>
>
> Solution gotten from the bottom of this page:
> https://github.com/umlaeute/v4l2loopback/wiki/GStreamer
>
> I typically use udpsink to send videos over network loopback, and then I can
> play the videos as a network source on something like VLC. Probably not
> great, but I've had no problems so far!
>
>
>
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel