How to use mipi csi camera inside docker container?

Hello,

I would like to use mipi csi raspberry pi v2 camera inside docker container. I pulled the l4t-ml:r32.5.0 docker image on my jetson nano module. I use custom carrier board and my jetpack version is 4.5.0. I created my container like below.

sudo docker run -it --gpus all -v /home/nvidia/docker_yolov5/:/yolov5 -e DISPLAY=:0 -v /tmp/.X11-unix:/tmp/.X11-unix -v /dev/video0:/dev/video0 --device=/dev/video0:/dev/video0 nvcr.io/nvidia/l4t-ml:r32.5.0-py3

When I type below command, I get the following error. My docker container creation might be wrong. How can I fix this problem?

gst-launch-1.0 nvarguscamerasrc ! nvoverlaysink

nvbuf_utils: Could not get EGL display connection
nvbuf_utils: Could not get EGL display connection
Setting pipeline to PAUSED …
Pipeline is live and does not need PREROLL …
Setting pipeline to PLAYING …
New clock: GstSystemClock
(Argus) Error FileOperationFailed: Connecting to nvargus-daemon failed: No such file or directory (in src/rpc/socket/client/SocketClientDispatch.cpp, function openSocketConnection(), line 201)
(Argus) Error FileOperationFailed: Cannot create camera provider (in src/rpc/socket/client/SocketClientDispatch.cpp, function createCameraProvider(), line 102)
Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, execute:639 Failed to create CameraProvider

(gst-launch-1.0:37): GStreamer-CRITICAL **: 13:17:23.675: gst_mini_object_set_qdata: assertion ‘object != NULL’ failed
Got EOS from element “pipeline0”.
Execution ended after 0:00:00.004020519
Setting pipeline to PAUSED …
Setting pipeline to READY …
Setting pipeline to NULL …
Freeing pipeline …
root@b2365f6c3fb8:/dev# gst-launch-1.0 v4l2src device=/dev/video0 ! ‘video/x-raw, format=RGB, width=640, height=480, framerate=30/1’ ! queue ! videoconvert ! xvimagesink
WARNING: erroneous pipeline: no element “xvimagesink”
root@b2365f6c3fb8:/dev# gst-launch-1.0 v4l2src device=/dev/video0 ! ‘video/x-raw, format=RGB, width=640, height=480, framerate=30/1’ ! queue ! videoconvert ! fakesink
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: Internal data stream error.
Additional debug info:
gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming stopped, reason not-negotiated (-4)
Execution ended after 0:00:00.001240344
Setting pipeline to PAUSED …
Setting pipeline to READY …
Setting pipeline to NULL …
Freeing pipeline …

Thanks in advance.

Did you check if any device by v4l2-ctl --list-devices before run the docker?

The device is listed like this,

vi-output, imx219 7-0010 (platform:54080000.vi:0):
/dev/video0

Could you try below command.

sudo docker run --net=host --runtime nvidia --rm --ipc=host -v /tmp/.X11-unix/:/tmp/.X11-unix/ -v /tmp/argus_socket:/tmp/argus_socket --cap-add SYS_PTRACE -e DISPLAY=$DISPLAY -it nvcr.io/nvidia/l4t-base:r32.5.0
2 Likes

Hello @ShaneCCC ,

It worked. Thanks for helping.