OpenCV MSMF can't grab frame error -2147483638 with Arducam 108MP USB 3.0 camera

Hi everyone, I’m using an Arducam 108MP Motorized Focus USB 3.0 Camera Module (b0494) with OpenCV on both Linux and Windows, and I keep getting this warning on frame 2:

[ WARN:[email protected]] global cap_msmf.cpp:1769 CvCapture_MSMF::grabFrame videoio(MSMF): can’t grab frame. Error: -2147483638

The warning slows the code down a lot and the camera becomes really hard to use in our manufacturing environment. It works intermittently and is quite unstable. I followed the quick start guides for Windows and Linux:

https://docs.arducam.com/UVC-Camera/Appilcation-Note/USB3-108MP-Camera/Quick-Start-Guide-on-Windows/
https://docs.arducam.com/UVC-Camera/Appilcation-Note/USB3-108MP-Camera/Quick-Start-Guide-on-Linux/

Here’s the capture log:

width: 1280 height: 720 fps: 31
width: 1280 height: 720 fps: 30
width: 1280 height: 720 fps: 30
wait 1
[ WARN:[email protected]] global cap_msmf.cpp:1769 CvCapture_MSMF::grabFrame videoio(MSMF): can’t grab frame. Error: -2147483638
wait 2
wait 3
wait 4
wait 5
wait 6
wait 7
wait 8
save success, file name: 108MP_2024-07-11_09_24_28.jpg
width: 1280 height: 720 fps: 24
width: 1280 height: 720 fps: 31
width: 1280 height: 720 fps: 30
width: 1280 height: 720 fps: 30
width: 1280 height: 720 fps: 30

I already tried uninstalling and reinstalling OpenCV, but the same warning keeps coming back. Any ideas?

Thanks for the detailed log. The important detail is that the capture does succeed at the end — save success, file name: 108MP_2024-07-11_09_24_28.jpg — so this looks like an intermittent frame grab failure rather than a complete capture failure. The -2147483638 error in CvCapture_MSMF::grabFrame is an MSMF-level grab failure, and that’s why your wait counter keeps incrementing while it retries.

The warning hitting at frame 2 and then taking several retries before recovering would explain the slowdown you’re seeing in production.

Let me reproduce this on our side and check what’s happening with the frame grabbing. I’ll get back to you.

Thanks, that matches what I’m seeing — it does eventually save a frame, but the retries are what kills the speed. Let me know what you find, or if you need me to run anything on my end.

Okay, I reproduced the issue on a Jetson Orin Nano. I can see the same warning there, though on that platform it shows up through V4L2: global cap_v4l.cpp:1136 .... I could not reproduce the case where the device fails to open unless the camera is physically reconnected.

The root cause turned out to be the ISP function operations running on the host side. That adds performance overhead and increases capture time, which is what’s triggering the grab warning. I’ve made changes to both the firmware and the Python demo code:

  • The latest firmware streams YUV video directly from the 108MP camera.
  • The ISP operations on the host have been removed, which reduces overhead, shortens capture time, and eliminates the warning.

I’ve sent you the latest firmware package and a test video through private message — please check your messages and update the camera firmware first.

For the updated Python code, use this branch:

Then run:
python3 arducam_demo.py -W 1280 -H 720 -F --wait-frames 2

If the warning still appears after the firmware update, let me know and we can dig deeper.

Thanks, I got the firmware. But I’m stuck on cloning the repo. I’m on Windows and tried:

git clone GitHub - Marco-ardu/ArducamUVCPythonDemo at Arducam108MPDemo · GitHub
cd ArducamUVCPythonDemo-Arducam108MPDemo

But I get:

Cloning into ‘Arducam108MPDemo’…
fatal: repository ‘GitHub - Marco-ardu/ArducamUVCPythonDemo at Arducam108MPDemo · GitHub’ not found

What’s the right way to clone this branch?

That error is because the link I posted is the web URL for viewing the branch, not a valid git clone URL. To clone that specific branch, use:

git clone -b Arducam108MPDemo GitHub - Marco-ardu/ArducamUVCPythonDemo · GitHub

That will create an ArducamUVCPythonDemo folder with the Arducam108MPDemo branch checked out. Then cd into it and run:

cd ArducamUVCPythonDemo
python3 arducam_demo.py -W 1280 -H 720 -F --wait-frames 2

Let me know if the clone goes through this time.

That did it — after the firmware update and the new demo code, the warning is gone and everything works at the other resolutions. One more thing: I can’t capture video at 12000x9000. When I try it in AMcap on Windows, I just get a black screen. Is there a way to record at that resolution?

Glad the warning is gone. For 12000x9000, I’d use OBS instead of AMcap — AMcap just shows a black screen at that resolution, and storing video at the full 108MP resolution (12000x9000) is problematic anyway.

Set these OBS settings:

  • Base Resolution: 12000 x 9000
  • Output Resolution: 4000 x 3000

Don’t store the video at the full 108MP resolution, or it will eat up all available memory. Outputting at 4000x3000 keeps it manageable. I’ve shared a sample captured video privately so you can see what the output should look like.