Arducam 64MP Hawkeye buffer allocation error at 8000x6000 raw on Pi 4 Bookworm

Hi everyone, I’m stuck with an Arducam 64MP Hawkeye on a Pi 4. I need to use the full 64MP mode at 8000x6000, but the highest raw resolution I can actually get working is 4624x3472 (16MP). If I push the raw resolution up to 8000x6000, I get a “Cannot allocate memory” buffer error. A bit of background: after a system update the camera stopped being detected entirely - libcamera-hello saw no cameras at all. On a clean Bookworm install it was only recognized after I downgraded libcamera-apps. Bullseye got further but still had issues. I suspect some kind of driver/OS incompatibility, but right now I’m just stuck at the 16MP raw limit.

Can you share your full environment - camera model marking, Pi model, OS version, libcamera version - and the script you’re running? The “Cannot allocate memory” during buffer allocation usually points to CMA, but I want to see the exact error before jumping to conclusions.

Sure. The camera is the Arducam 64MP Hawkeye (arducam_64mp sensor, model B0399). Host is a Raspberry Pi 4 running Raspberry Pi OS Bookworm. libcamera version is v0.3.1+74-a65f44f4-dirty (2024-09-09T08:55:36BST). Pipeline config is /usr/share/libcamera/pipeline/rpi/vc4/arducam_64mp.yaml. Streaming path is picamera2 + ffmpeg → MediaMTX RTSP at rtsp://myuser:mypass@localhost:8554/hqstream, viewed in VLC. Here’s my script:

#!/usr/bin/python3
from picamera2 import Picamera2
from picamera2.encoders import H264Encoder, Quality
from picamera2.outputs import FfmpegOutput
import os, time

picam2 = Picamera2()
frame_rate = 2
video_config = picam2.create_video_configuration(raw={“size”: (4624,3472)},
main={“size”: (1920,1080), “format”: “RGB888”},
controls={‘FrameRate’: frame_rate, ‘AfMode’: 2 , ‘AfTrigger’: 0})
picam2.align_configuration(video_config)
picam2.configure(video_config)

FFMPEG output config

HQoutput = FfmpegOutput(“-f rtsp -rtsp_transport udp rtsp://myuser:mypass@localhost:8554/hqstream”, audio=False)

Encoder settings

encoder_HQ = H264Encoder(repeat=True, iperiod=30, framerate=frame_rate, enable_sps_framerate=True)

try:
print(“trying to start camera stream”)
picam2.start_recording(encoder_HQ, HQoutput, quality=Quality.LOW)
print(“Started camera stream”)
while True:
time.sleep(5)
except :
print(“exiting picamera2 streamer”)
picam2.stop_recording()

Thanks. Can you change the raw size to (8000,6000) in that same script and paste the full console output from the run? That will show us exactly where it dies.

Here’s the failing run with raw set to (8000,6000):

pi@pi:~ $ sudo python3 picam.py
[0:45:42.056306728] [1527] INFO Camera camera_manager.cpp:316 libcamera v0.3.1+74-a65f44f4-dirty (2024-09-09T08:55:36BST)
[0:45:42.076326460] [1530] WARN CameraSensorProperties camera_sensor_properties.cpp:295 No static properties available for ‘arducam_64mp’
[0:45:42.076504144] [1530] WARN CameraSensorProperties camera_sensor_properties.cpp:297 Please consider updating the camera sensor properties database
[0:45:42.099640586] [1530] WARN RPiSdn sdn.cpp:40 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise
[0:45:42.101850947] [1530] INFO RPI vc4.cpp:455 Registered camera /base/soc/i2c0mux/i2c@0/arducam_64mp@1a to Unicam device /dev/media4 and ISP device /dev/media0
[0:45:42.102094761] [1530] INFO RPI pipeline_base.cpp:1150 Using configuration file ‘/usr/share/libcamera/pipeline/rpi/vc4/arducam_64mp.yaml’
[0:45:42.110403467] [1527] INFO Camera camera.cpp:1191 configuring streams: (0) 1920x1080-RGB888 (1) 640x480-YUV420 (2) 8000x6000-SRGGB10_CSI2P
[0:45:42.112440163] [1530] INFO RPI vc4.cpp:630 Sensor: /base/soc/i2c0mux/i2c@0/arducam_64mp@1a - Selected sensor format: 8000x6000-SRGGB10_1X10 - Selected unicam format: 8000x6000-pRAA
trying to start camera stream
[0:45:42.358052297] [1537] WARN IPARPI ipa_base.cpp:1181 Could not set AF_TRIGGER - no AF algorithm or not Auto
[0:45:42.391376363] [1530] ERROR V4L2 v4l2_videodevice.cpp:1267 /dev/video0[16:cap]: Unable to request 1 buffers: Cannot allocate memory
[0:45:42.391563640] [1530] ERROR RPI pipeline_base.cpp:699 Failed to allocate buffers
exiting picamera2 streamer
pipe:: Invalid data found when processing input

To summarize what I’ve tried: 4624x3472 works fine, 8000x6000 fails with the buffer error above. Earlier on Bookworm it worked for a while then stopped detecting cameras, a clean Bookworm only recognized it after downgrading libcamera-apps, and Bullseye was also tried with issues remaining.

Thanks, that’s really helpful. The key lines are “Unable to request 1 buffers: Cannot allocate memory” and “Failed to allocate buffers”. That’s the CMA area running out - an 8000x6000 SRGGB10 frame plus the ISP buffers is a big chunk of contiguous memory, and the default CMA carveout just isn’t enough. The two warnings about “No static properties available for ‘arducam_64mp’” are just the sensor database not having an entry for this sensor, they aren’t what’s causing the allocation failure.

To fix the buffer allocation you need to grow the CMA allocation. Add dtoverlay=vc4-kms-v3d,cma-512 to config.txt (that gives 512MB of CMA) and reboot. I also made some modifications to your script so it can run at 8000x6000 - I’ve sent the modified file to you in a private message, please check your inbox. The setup reference is here: 64MP Hawkeye - Arducam Wiki

Thanks for the reply. The modified script you mentioned didn’t actually come through on my side - it looks like it got filtered out, could you send it again? Just so I’m on the same page, your reply said: add dtoverlay=vc4-kms-v3d,cma-512 in config.txt first, and that you modified the code so it can run at 8000x6000. I’ve re-run my original script with raw at 8000x6000 and still hit the same “Cannot allocate memory” / “Failed to allocate buffers” errors.

Sorry about that - I’ve re-uploaded the modified script and sent you the link in a private message, please check your messages this time. To recap: the 8000x6000 failure is a CMA memory problem, not a sensor/driver issue. Add dtoverlay=vc4-kms-v3d,cma-512 to config.txt and reboot. Then use the modified script I sent you (it’s adjusted for the 8000x6000 raw mode), and follow the setup doc at 64MP Hawkeye - Arducam Wiki for a clean install on a Pi 4B with a fresh SD card. Once the 512MB CMA is in place, the buffer allocation error should be gone.