Camera Setup and Verification
This page outlines how to verify the camera setup used with the Clara Holoscan target and x86 host devices to ensure they are functioning properly for use with the sample applications.
Connect a CSI or USB camera module to your Clara AGX Developer Kit or Jetson AGX module. Once connected, you may see what device(s) you have by the following:
$ ls /dev/video*
The format(s) of your device(s) may be seen by:
$ v4l2-ctl -d /dev/video0 --list-formats
If the above command fails (which may occur if the DeepStream example was not installed), then run:
$ sudo apt install -y v4l-utils
Please see the Prerequisites section for the list of compatible camera devices.
NoteThe CSI camera module, including the CSI HDMI input board included with the Clara AGX Developer Kit, will enumerate as
/dev/video0
and any additional USB cameras will start to enumerate with/dev/video1
. If there is no CSI module attached, USB cameras will start to enumerate with/dev/video0
.Run one of the following commands to prove that capture is working correctly. In all cases, a window should be rendered onto the display with a live stream from the capture.
CSI Camera
$ gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=(fraction)30/1' ! nvoverlaysink -e
Notenvarguscamerasrc
plugin is not available in dGPU mode on Clara AGX Developer Kit.CSI HDMI Input Board
$ gst-launch-1.0 v4l2src io-mode=mmap device=/dev/video0 ! 'video/x-raw, format=(string)BGRA, width=(int)1920, height=(int)1080, framerate=(fraction)60/1' ! capssetter join=true caps='video/x-raw, format=(string)RGBA' ! nvvideoconvert ! 'video/x-raw(memory:NVMM), format=(string)RGBA' ! nveglglessink sync=0
USB Camera
$ gst-launch-1.0 v4l2src device=/dev/video1 ! xvimagesink
NoteReplace
/dev/video0
in the commands above with the path that corresponds to the device being tested. See note about device enumeration in step 1, above.Press Ctrl+C to exit the camera capture.
Connect a USB camera to your Linux x86 host.
Run the following command to prove that capture is working correctly. A window should be rendered onto the display with a live stream from the camera.
$ gst-launch-1.0 v4l2src device=/dev/video1 ! xvimagesink
NoteReplace
/dev/video1
in the command above with the path that corresponds to the USB camera device being tested.Press Ctrl+C to exit the camera capture.
The DeepStream sample application offers the ability to stream the camera image from the target device to a remote host system using a UDP data stream. These steps can be followed to ensure that both the target and host systems are setup correctly for this streaming to work.
AGX Target
Ensure the camera capture is working as described in the AGX Camera Setup section, above.
Run the following command to start streaming the camera capture, replacing
<IP_ADDRESS>
with the IP address of the host system that will be receiving the stream.CSI Camera
$ gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=(fraction)30/1' ! \ omxh264enc control-rate=2 bitrate=4000000 ! 'video/x-h264, stream-format=(string)byte-stream' ! \ h264parse ! rtph264pay mtu=1400 ! udpsink host=<IP_ADDRESS> port=5000 sync=false async=false
CSI HDMI Input Board
$ gst-launch-1.0 v4l2src io-mode=mmap device=/dev/video0 ! 'video/x-raw, format=(string)BGRA, width=(int)1920, height=(int)1080, framerate=(fraction)60/1' ! capssetter join=true caps='video/x-raw, format=(string)RGBA' ! nvvideoconvert ! 'video/x-raw(memory:NVMM) , format=(string)I420' ! nvv4l2h264enc ! h264parse ! rtph264pay ! udpsink host=<IP_ADDR> port=5000
USB Camera
$ gst-launch-1.0 v4l2src device=/dev/video0 ! nvvideoconvert ! 'video/x-raw(memory:NVMM), format=(string)I420' ! nvv4l2h264enc ! h264parse ! rtph264pay ! udpsink host=<IP_ADDR> port=5000
NoteReplace
/dev/video0
in the commands above with the path that corresponds to the device being tested. See note about device enumeration in step 1 of the AGX Camera Setup, above.
Linux Host
Use the following command to start streaming the camera capture on a Linux x86 host (close with Ctrl+C):
$ gst-launch-1.0 udpsrc port=5000 ! application/x-rtp,encoding-name=H264, payload=96 ! rtph264depay ! queue ! avdec_h264 ! autovideosink sync=false