Jetpack 4.3 CSI Camera Support from within Containers

As requested, I’ve posted a new topic with regards to running a CSI camera inside a container. I’m using the following container: nvcr.io/nvidia/l4t-base:r32.3.1

And runnning nvargus-daemon inside the container results in

bash: nvargus-daemon: command not found

Original problem posted here: https://devtalk.nvidia.com/default/topic/1068583/jetson-nano/jetpack-4-3-l4t-r32-3-1-released/post/5423380/#5423380

This may also be related:

https://devtalk.nvidia.com/default/topic/1069020/jetson-tx2/jetpack-4-3-csi-camera-support-from-within-containers

1 Like

Thanks jimwormold, can you try launching Docker with these flags?

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.2.1

Note the –ipc=host and -v /tmp/argus_socket:/tmp/argus_socket arguments.

1 Like

That’s fantastic and I can confirm that this works using the above command from within a container! Thank you

However when I attempt to grab the stream from opencv, it fails. I have built opencv 4.1.2 within the container, using the https://github.com/mdegans/nano_build_opencv script which sets the option to build gstreamer to true, however when I check this with cv2.getBuildProperties() it states that it has not been built with gstreamer.

Installing the following dependencies before running the opencv build script fixes this:

apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev

Thanks for the report. I will try to replicate and add the second package explicitly to the build script.

Edit: looks like it isn’t added by the main -dev package. I will add it later today. Thanks!

HI,

What’s the purpose of /tmp/.X11-unix?

root@jetson1:/# gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM),width=3820, height=2464, framerate=21/1, format=NV12' ! nvvidconv flip-method=0 ! 'video/x-raw,width=960, height=616' ! nvvidconv ! nvegltransform ! nveglglessink -e
X11 connection rejected because of wrong authentication.
nvbuf_utils: Could not get EGL display connection
Setting pipeline to PAUSED ...

Using winsys: x11 
X11 connection rejected because of wrong authentication.
ERROR: Pipeline doesn't want to pause.
Setting pipeline to NULL ...
Freeing pipeline ...

Inside are sockets so you can connect to the local display. You may wish to use a network sink instead of X depending on what you are doing, however. There is a python example in that thread that works. Then you can just EXPOSE a port and connect to it from outside the container (or another host altogether). You can then use gst-play (or probably even vlc) as a remote display client for your camera feed. The osd stuff works as well if you stick it in your pipeline.

Interesting.

Ok, I’ve solved authentication issues, it is basic X system administration.
Xauth set, $Display set, xrandr correct, I can launch xterm in GUI.

What is the meaning of this EGL display connection issue?
I did not manage to get X window output with nvargus.
When I unset DISPLAY I can run some some commands and bypass that error but I do not see anything.
Is openGL incompatible with X11?

Thanks for the details and help.

jetson1:~/docs# gst-launch-1.0 videotestsrc ! nvvidconv ! 'video/x-raw(memory:NVMM),format=NV12' ! nvivafilter cuda-process=true customer-lib-name="libnvsample_cudaprocess.so" ! "video/x-raw(memory:NVMM), format=(string)RGBA" ! nvoverlaysink
nvbuf_utils: Could not get EGL display connection
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM),width=3820, height=2464, framerate=21/1, format=NV12' ! nvvidconv flip-method=0 ! 'video/x-raw,width=960, height=616' ! nvvidconv ! nvegltransform ! nveglglessink -e
nvbuf_utils: Could not get EGL display connection
Setting pipeline to PAUSED ...

Using winsys: x11 
ERROR: Pipeline doesn't want to pause.
Setting pipeline to NULL ...
Freeing pipeline ...
jetson1:~/docs# gst-launch-1.0 nvarguscamerasrc ! nvoverlaysink
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
GST_ARGUS: Creating output stream
CONSUMER: Waiting until producer is connected...
GST_ARGUS: Available Sensor modes :
GST_ARGUS: 3264 x 2464 FR = 21.000000 fps Duration = 47619048 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 3264 x 1848 FR = 28.000001 fps Duration = 35714284 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1920 x 1080 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1280 x 720 FR = 59.999999 fps Duration = 16666667 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1280 x 720 FR = 120.000005 fps Duration = 8333333 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: Running with following settings:
   Camera index = 0 
   Camera mode  = 2 
   Output Stream W = 1920 H = 1080 
   seconds to Run    = 0 
   Frame Rate = 29.999999 
GST_ARGUS: PowerService: requested_clock_Hz=13608000
GST_ARGUS: Setup Complete, Starting captures for 0 seconds
GST_ARGUS: Starting repeat capture requests.
CONSUMER: Producer has connected; continuing.
^Chandling interrupt.
Interrupt: Stopping pipeline ...
Execution ended after 0:00:13.063601297
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
GST_ARGUS: Cleaning up
CONSUMER: Done Success
GST_ARGUS: Done Success
Setting pipeline to NULL ...
Freeing pipeline ...
GST_ARGUS: 
PowerServiceHwVic::cleanupResources