0

I am trying to run a Gstreamer pipeline that duplicates a video stream so it can be used in two applications. Here is my sample pipeline that fails when run on a Jetson Nano, but works on my Ubuntu PC.

I have used v4l2loopback to create 2 v4l2 devices (/dev/video1 and /dev/video2) like so:

sudo modprobe v4l2loopback video_nr=1,2

PRODUCER:

gst-launch-1.0 videotestsrc ! tee name=t ! queue ! v4l2sink device=/dev/video1 t. ! queue ! v4l2sink device=/dev/video2

CONSUMER:

gst-launch-1.0 v4l2src device=/dev/video2 ! xvimagesink

As you can see I'm trying to use tee to duplicate the stream and send it to 2 v4l2 devices that I created with v4l2loopback.

When I run the consumer, it displays the first frame, then crashes with:

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:v4l2src0: Failed to allocate a buffer
Additional debug info:
gstv4l2src.c(998): gst_v4l2src_create (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0
Execution ended after 0:00:00.056466348
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

Any idea on why it fails to allocate a buffer? And why doesn't this happen on my Ubuntu PC?

Here is my full Jetson Nano pipeline that uses the camera and splits the stream into 2 v4l2 sinks:

gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=1920, height=1080, format=NV12, framerate=(fraction)30/1' ! nvvidconv ! tee name=t ! queue ! v4l2sink device=/dev/video1 t. ! queue ! v4l2sink device=/dev/video2

A_toaster
  • 1,196
  • 3
  • 22
  • 50

1 Answers1

0

The error disappears by using the max_buffers=2 argument in v4l2loopback. I can't explain why it doesn't need this option on my Ubuntu PC, must be something to do with the amount of available memory?

Curiously, increasing max_buffers to something higher (eg max_buffers=8) causes the same Failed to allocate buffer error.

A_toaster
  • 1,196
  • 3
  • 22
  • 50