I’ve enabled ssh, vnc, i2c, spi, and remote gpio through raspi-config. Installed all the packages: python3-pyqt5, python3-opencv, python3-kms++, python3-libcamera, python3-prctl, libatlas-base-dev, ffmpeg, rpi.gpio, python3-picamera2. Cloned the Arducam repo from GitHub.
I modified AdapterDemoTest.py to swap out the old libcamera calls for rpicam equivalents, and that script runs fine — all four cameras show a short preview one by one. So I know the hardware, wiring, and config are correct.
The problem is previewOpencv.py. When I run it for multi-camera preview, the behavior is all over the place. Sometimes nothing shows up at all. Sometimes I get only Camera D with three black screens. And sometimes all four screens display the exact same camera feed. It’s completely inconsistent. Anyone know what’s going on here?
The fact that AdapterDemoTest.py works and successfully previews all four cameras — even if one at a time — is actually the important clue here. Your hardware, wiring, and config.txt are all verified good.
The real issue is previewOpencv.py itself. That script is old and unmaintained. It was never properly updated for modern Raspberry Pi OS running the libcamera/rpicam stack, and it’s known to be unstable with multiplexer boards. The multi-camera adapter is a multiplexer — it can only stream from one sensor at a time, and it rapidly switches between them. previewOpencv.py doesn’t handle that switching timing properly on current OS builds.
My recommendation: stop using previewOpencv.py entirely. The officially supported way to control the cameras is through native rpicam commands. You can address each camera individually like this:
So Camera C (index 2) works fine, but the other three all timeout. That seems really odd given that AdapterDemoTest.py can cycle through all four without issues.
Also, I’m a bit confused about something you said — you mentioned the multiplexer can only show one camera at a time. But isn’t the whole point of these multi-camera boards to display four cameras at once on screen? How does that work if it can only stream from one sensor at a time?
Good questions. Let me tackle the multiplexer one first: the board rapidly switches between cameras in a cycle. It’s not streaming all four simultaneously. For a live preview that looks like four feeds on screen, the software grabs a frame from camera 0, tells the mux to switch to camera 1, grabs a frame, switches to camera 2, and so on. It cycles fast enough that it appears simultaneous to your eyes. The rpicam-still command just connects to one camera and holds that connection — there’s no cycling.
As for the timeouts on cameras 0, 1, and 3 — that’s definitely unusual. The fact that camera 2 works and AdapterDemoTest.py works with all four suggests there’s something timing-related going on with the multiplexer switching when rpicam connects to those specific indices.
A few things to try before we go deeper:
Have you tested this same board on a different Pi model, like a Pi 5?
Can you grab the full debug output from one of the failing commands? Run:
LIBCAMERA_LOG_LEVELS=*:DEBUG rpicam-still -t 0 --camera 0 2>&1 | tee debug_cam0.log
That’ll show us exactly what’s happening during the pipeline setup and where the timeout triggers.
Alright, before grabbing those debug logs I tried a couple of things:
First, I tested the same multi-camera board on a Raspberry Pi 5 — not using previewOpencv.py at all, just native tools. On the Pi 5, it can display and switch between all four cameras in one window. So the hardware is definitely not faulty. The frame rate is really low though, which I guess is expected with the multiplexer switching overhead.
Second, I found the pipeline configuration at /usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml and changed camera_timeout_value_ms from 0 to 9000, thinking maybe the multiplexer just needs more time to settle after switching. Didn’t help — same timeout errors on cameras 0, 1, and 3.
The Pi 5 test is a useful data point — confirms the board and sensors are all functional. The timeout config change was a reasonable thing to try even though it didn’t pan out.
Those debug logs are going to be key here. I’m particularly interested in:
Whether all four sensors are being detected and registered correctly at the kernel level
What mode and format libcamera negotiates for each camera
The exact point in the pipeline where the timeout fires
Post them when you’ve got them and we’ll dig through it.
So the kernel sees all four OV5647 sensors on the I2C mux and they’re all mapped properly. Here’s the mode selection that happens when I attempt camera 0:
The registration and mode selection look perfectly clean. All four sensors enumerated on the I2C mux, all assigned to the same Unicam and ISP media devices (which is correct for a multiplexer — they share the CSI interface). The mode choice of 1296x972 is standard for the OV5647.
Can you post the section of the log where it actually fails? I’m looking for the V4L2 dequeue timer warnings and the pipeline timeout errors specifically. That’ll tell us whether the failure is at the sensor level, the Unicam frontend, or somewhere else in the pipeline.
Yeah, here’s the failure section from running rpicam-still -t 0 --camera 0:
[0:19:13.188960618] [2913] WARN V4L2 v4l2_videodevice.cpp:2155 /dev/video0[35:cap]: Dequeue timer of 1000000.00us has expired!
[0:19:13.189071450] [2913] ERROR RPI pipeline_base.cpp:1346 Camera frontend has timed out!
[0:19:13.189086505] [2913] ERROR RPI pipeline_base.cpp:1347 Please check that your camera sensor connector is attached securely.
[0:19:13.189099245] [2913] ERROR RPI pipeline_base.cpp:1348 Alternatively, try another cable and/or sensor.
ERROR: Device timeout detected, attempting a restart!!!
The dequeue timer is at 1,000,000 microseconds (1 second), which is the default. So what’s happening is the Unicam frontend queues a buffer to /dev/video0 and waits for frame data from the sensor — but never receives anything. The timer expires and the pipeline declares a frontend timeout.
What makes this so confusing is that AdapterDemoTest.py (modified with rpicam) still successfully cycles through all four cameras. So camera 0, 1, and 3 clearly can produce frames — rpicam just can’t seem to grab them when addressed directly.
Thanks for posting those — that’s really helpful. Here’s my read on where things stand:
What’s confirmed:
Hardware is validated. AdapterDemoTest.py (modified for rpicam) works with all four cameras. Pi 5 test also works with all four. The board and sensors are fine.
Camera registration is correct — all four OV5647 sensors detected and assigned properly on the I2C mux.
Mode negotiation completes normally. It picks 1296x972 without issues.
The failure is specifically at the V4L2 buffer dequeue stage. The Unicam frontend queues a buffer on /dev/video0 but never receives frame data back. Cameras 0, 1, and 3 timeout. Camera 2 does not.
What this points to:
The multiplexer switching timing is the likely culprit. When rpicam connects to a specific camera index, the mux has to switch the I2C bus and CSI lanes to that sensor before the sensor can start streaming. For camera 2, the timing works out — the sensor is ready by the time the buffer dequeues. For 0, 1, and 3, something in the switching sequence doesn’t complete before the 1-second dequeue timer fires. AdapterDemoTest.py likely goes through a slightly different initialization path or has enough delay built into its sequential switching that the mux settles properly.
Bottom line:
previewOpencv.py is deprecated — don’t use it. Your AdapterDemoTest.py results already proved that.
rpicam commands are the correct interface, but there appears to be a timing issue with the multiplexer on your Pi 4B + current OS for certain camera indices. The Pi 5 doesn’t seem affected (though frame rate is low as expected).
If AdapterDemoTest.py is meeting your needs for now, stick with it. For individual camera control via rpicam, camera 2 works as-is. The other three may need further investigation into the mux switching delay — possibly a libcamera pipeline tuning parameter, but that’s going to take some deeper debugging.