How to make libcamera-still faster?

im currently using libcamera-still to capture still image with 64mp hawkeye arducam. it takes ~10 seconds to capture one image at maximum resolution. is it possible to make it faster while keeping resolution?

The command I currently use to make it as fast as i could:

libcamera-still --width 9150 --height 6944 -o test.jpg -n -t 1

I used -n to remove the preview to make it faster and i found that if u use -t 1 then it doesent try to use the autofocus so i won about 3-4 seconds just from that.
RPI4 CM4, 2GB RAM, 8GB SSD, gpu memory 256MB, swap file size 512MB

Or should i use some other command like libcamera-raw or libcamera-jpeg?

If i used libcamera directly from my code instead of calling out these console commands, would the decrease in overhead be significant?

@henri

The fastest way is to use code with picamera2.

example:

The first image capture will be slower, because it requires a series of operations to open the camera.
It will stabilize at about 1 second later, if you need opencv to display or save pictures, it will take 3-4 seconds.

pi@pi:~/picamera2_examples $ python 64mp_speed_test.py
Traceback (most recent call last):
  File "/home/pi/picamera2_examples/64mp_speed_test.py", line 5, in <module>
    from picamera2 import Picamera2, Preview
  File "/usr/local/lib/python3.9/dist-packages/picamera2/__init__.py", line 1, in <module>
    import libcamera
ModuleNotFoundError: No module named 'libcamera'

I built and installed libcamera from source. Do you know how can i fix this?

@henri

Are you follow the README.md?

Yes i was following the readme, I just skipped the steps

wget -O install_pivariety_pkgs.sh https://github.com/ArduCAM/Arducam-Pivariety-V4L2-Driver/releases/download/install_script/install_pivariety_pkgs.sh 
chmod +x install_pivariety_pkgs.sh
./install_pivariety_pkgs.sh -p libcamera_dev
./install_pivariety_pkgs.sh -p libcamera_apps

because i already had libcamera built and installed from source so i thought i dont need to do it. So what i had to do to fix the issue:

sudo apt install -y python3-libcamera

i now ran the test:

pi@pi:~/picamera2_examples $ python 64mp_speed_test.py
[0:38:27.838465863] [1845]  INFO Camera camera_manager.cpp:299 libcamera v0.0.0+4225-74d023d8-dirty (2023-04-02T17:35:52+03:00)
[0:38:27.864323043] [1846]  WARN CameraSensorProperties camera_sensor_properties.cpp:243 No static properties available for 'arducam_64mp'
[0:38:27.864393579] [1846]  WARN CameraSensorProperties camera_sensor_properties.cpp:245 Please consider updating the camera sensor properties database
[0:38:27.887888833] [1846]  WARN RPI raspberrypi.cpp:1357 Mismatch between Unicam and CamHelper for embedded data usage!
[0:38:27.889340959] [1846]  INFO RPI raspberrypi.cpp:1476 Registered camera /base/soc/i2c0mux/i2c@1/arducam_64mp@1a to Unicam device /dev/media4 and ISP device /dev/media1
[0:38:27.897417132] [1845]  INFO Camera camera.cpp:1028 configuring streams: (0) 9152x6944-RGB888
[0:38:27.897843533] [1846]  INFO RPI raspberrypi.cpp:851 Sensor: /base/soc/i2c0mux/i2c@1/arducam_64mp@1a - Selected sensor format: 9152x6944-SRGGB10_1X10 - Selected unicam format: 9152x6944-pRAA
open time:0.7141423225402832

what am i supposed to make of this?

Does that mean that every time I do from command line:
libcamera-still --width 9150 --height 6944 -o test.jpg -n -t 1
there is extra ~0.7 sec latency for shooting each picture and if i used libcamera from code directly instead of running terminal commands i could eliminate that 0.7 sec overhead for shooting each picture?

@henri

In theory, you can save this time by using code.

Using the command line will repeat the startup and shutdown operations.

It stands to reason that you will also print out the time of each image acquisition. If you do not save or display the image, the first image acquisition will be slower, and then it will stabilize at about 1 second.