Capture camera stream from CSI camera from multiple sessions

In my application, I have two docker containers that must read the camera stream,

I use this GStreamer pipeline to read the camera stream
nvarguscamerasrc ! video/x-raw(memory:NVMM),width=3840,height=2160,framerate=30/1 ! nvvidconv ! videoconvert! video/x-raw, format=(string)BGR ! appsink drop=1

the problem is the first container can read the stream normally and the other returns an error

Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, execute:751 Failed to create CaptureSession

how can we enable multiple reading sessions from CSI camera?

Device: Jetson Xavier NX Emmc 16 GB
Camera: IMX477 CSI camera
Jetpack: 4.6.1 L4T 32.7.1

nvidia@nvidia:~/Desktop$ v4l2-ctl -d /dev/video0 --list-formats-ext
Index : 0
Type : Video Capture
Pixel Format: ‘RG10’
Name : 10-bit Bayer RGRG/GBGB
Size: Discrete 3840x2160
Interval: Discrete 0.033s (30.000 fps)
Size: Discrete 1920x1080
Interval: Discrete 0.017s (60.000 fps)


hello HusamAlqaza,

is it a single camera or multi-cam in your system?
are you going to access to the same video stream with different app?

Hello JerryChang,
It is a single camera system
and yes I am planning to access the same camera stream from 2 different apps

hello HusamAlqaza,

all right, this is not supported. you cannot have different apps to access to the same video stream.

But if you send your stream to an rtsp server you can easily multiplex it and get what you want.

nvarguscamerasrc ! video/x-raw(memory:NVMM),width=3840,height=2160,framerate=30/1 ! nvvidconv ! nvv4l2h265enc ! h265parse ! rtspclientsink location=rtsp://localhost:8554/live/stream1

Alternatively you can put “tee” in your stream and multiplex is that way.