USB Camera - High Latency on TX1

Hello everyone.

I’m working on a real-time computer vision project. I’m currently using a Jetson TX1 board with the latest jetpack and a USB OV1064O camera (UVC compliant) delivering 1280x1080@30. Recently, I’ve started measuring latency with different pipelines. The way I measure latency is the following:

  • Print a timestamp in milliseconds since the epoch before capturing a frame.
  • Call the function for capturing a frame.
  • Draw that timestamp over the image.

Then, I aim the camera to my monitor to get the timestamps being printed and afterwards I compare the recorded timestamp with the one drawn over the image.

My results are:

CODE	                          FRAME TIME (ms)	   LATENCY (ms)		
	                        MIN	MAX	AVG	MIN	MAX	AVG
OpenCV	                        17	44	25.3	130	198	168.4
gst-camera (jetson-inference)	19	27	21.7	99	114	105.2
v4l2cuda (tegra_multimedia_api)	27	37	30.1	84	116	106.5

I find it hard to believe that for most real-time applications 100ms (around 3 frames at 30fps) is acceptable.

Does this benchmark sound plausible to you?
Is there any way I could improve latency with this setup?

Thanks in advance.

Hi mescarra,
For going through UVC driver, you may try ‘sudo ~/jetson_clocks.sh’ to get better performance because the buffers are CPU buffers.

Hi DaneLLL,

The reported results were taken after having run the jetson_clocks.sh script.

Hi mescarra,
We try with See3CAM_CU135 and see 9-frame latency(300ms) on r28.1(Kernel 4.4):

nvidia@tegra-ubuntu:~/tegra_multimedia_api/samples/12_camera_v4l2_cuda$ ./camera_v4l2_cuda -d /dev/video0 -s 1920x1080 -f UYVY
Failed to query video capabilities: Inappropriate ioctl for device
libv4l2_nvvidconv (0):(774) (INFO) : Allocating (4) OUTPUT PLANE BUFFERS Layout=0
libv4l2_nvvidconv (0):(790) (INFO) : Allocating (4) CAPTURE PLANE BUFFERS Layout=0
[INFO] (NvEglRenderer.cpp:109) <renderer0> Setting Screen width 1920 height 1080
^CQuit due to exit command from user!
----------- Element = renderer0 -----------
Total Profiling time = 319.323
Average FPS = 30.0009
Total units processed = 9581
Num. of late units = 1188
-------------------------------------

The result may vary with different USB cameras. The UVC video driver is default in K4.4. Not sure but there might be room for improvement. Other users may share experience.