Error when capturing image from OV5693 stream

Hello,

I use a Jetson TX2 developer kit and the camera OV5693 with OpenCV to do some image processing but I encounter some issue.

Here is what I do:

I have a simple python code in which I use a cv2.VideoCapture object with a gstreamer pipeline. Here is a simplify version:

GST_STR = 'nvcamerasrc sensor-id=0 ! '
          'video/x-raw(memory:NVMM), width=(int)1280, height=(int)720, '
          'format=(string)I420, framerate=(fraction)120/1 ! '
          'nvvidconv ! '
          'video/x-raw, format=(string)BGRx ! '
          'videoconvert !'
          'appsink sync=0'

video_capture.open(GST_STR, cv2.CAP_GSTREAMER)

while True:
    is_image, image_array = video_capture.read()
    #do stuff...
    time.sleep(0.0250)

The issue:

After a while (sometime after an hour, but it can be less or more) the call to video_capture.read() block and never return. I try to figure what is the root cause be cannot find anything.

I have observed a suspicious line in dmesg which published by nvcamera-daemon:
(“complete” dmesg : https://pastebin.com/5wvMixp9)

Feb 21 15:41:05 tegra-ubuntu nvcamera-daemon[20059]: nvcamera-daemon started new client thread = 548029825504
[...]
Feb 21 15:41:23 tegra-ubuntu nvcamera-daemon[20059]: (548029825504) Error in calling capture= 2047 result= 8
Feb 21 15:41:23 tegra-ubuntu nvcamera-daemon[20059]: message repeated 6 times: [(548029825504) Error in calling capture= 2047 result= 8]

Is there any documentation for this error code? I cannot figure if the issue come from the gstreamer pipeline, the driver, or the camera itself and was not able to find any similar problem on this forum. So I am kind of lost =/…

If need, I add here few details:

  • gstreamer v1.14.4
  • opencv v3.4.1-dev

And few more logs/outputs from other runs when the issue occurred if needed:

Could you have try the gst-launch-1.0 for your pipeline to clarify the problem is cause by the opencv or camera framework.

I have tried with the following command:

gst-launch-1.0 -v nvcamerasrc sensor-id=0 ! \
    'video/x-raw(memory:NVMM), width=(int)1280, height=(int)720, format=(string)I420, framerate=(fraction)120/1' ! \
    nvvidconv ! \
    'video/x-raw, format=(string)BGRx' ! \
    videoconvert ! \
    appsink sync=0

And it reproduced the same issue. In journalclt I can observed the same log:
(“complete” log: https://pastebin.com/Wc9dtzdU)

Feb 22 15:52:48 tegra-ubuntu nvcamera-daemon[26202]: nvcamera-daemon started new client thread = 548058407392
Feb 22 15:52:48 tegra-ubuntu nvcamera-daemon[26202]: (548058407392) USB Sensors :  0 CSI Sensors :  1
Feb 22 15:52:48 tegra-ubuntu nvcamera-daemon[26202]: (548058407392) getSource successful
[...]
Feb 22 15:53:41 tegra-ubuntu nvcamera-daemon[26202]: (548058407392) Error in calling capture= 1057 result= 5

Please check
https://devtalk.nvidia.com/default/topic/1024245/jetson-tx2/opencv-3-3-and-integrated-camera-problems-/post/5210735/#5210735

Not sure if it helps this case but it is with better performance to send NV12/I420 to appsink.

Hello,

Sorry for the late reply, I had to deal with other issue.

I had a look at the other topic and removing videoconvert from the pipeline did not change anything.
I try to different configuration for the pipeline. Here is a quick sum up:

I tested the following configuration for the OV5693:
(FORMAT - WIDTH x HEIGHT @ FPS)
#1: I420 - 1280 x 720 @ 120
#2: NV12 - 1280 x 720 @ 120
#3: I420 - 2592 x 1944 @ 30

with the following command:

gst-launch-1.0 nvcamerasrc sensor-id=0 ! 'video/x-raw(memory:NVMM), width=(int)<WIDTH>, height=(int)<HEIGHT>, format=(string)<FORMAT>, framerate=(fraction)<FRAMERATE>/1' ! fakesink

And I watch the log of nvcamera-daemon:

journalctl --unit=nvcamera-daemon.service --follow

For config #1 and #2, I have this log occurring:

... nvcamera-daemon ... Error in calling capture= ... result= 8]

But (fortunately?) for the config #3, the issue never occurs.

I don’t really understand what can explain this result… But it seems that something (the camera, the firmware, nvcamera-daemon) does not handle well the “120 FPS” config.

BTW, here are the modes displayed when I run a gst-launch with nvcamerasrc:

Available Sensor modes :
2592 x 1944 FR=30.000000 CF=0x1109208a10 SensorModeType=4 CSIPixelBitDepth=10 DynPixelBitDepth=10
2592 x 1458 FR=30.000000 CF=0x1109208a10 SensorModeType=4 CSIPixelBitDepth=10 DynPixelBitDepth=10
1280 x 720 FR=120.000000 CF=0x1109208a10 SensorModeType=4 CSIPixelBitDepth=10 DynPixelBitDepth=10q

Hi,
From your comment, it looks not related to OpenCV. So please confirm if below steps are correct for reproducing the issue.

  1. Run ‘gst-launch-1.0 nvcamerasrc ! ‘video/x-raw(memory:NVMM),format=NV12,width=1280,height=720,framerate=60/1’ ! fakesink’
  2. Run ‘journalctl --unit=nvcamera-daemon.service --follow’ to catch the error.

Once you confirm it, we will try to reproduce it on r28.2.1(Jetpack 3.3)