So I did what you said and it still does not work. My code boils down to the following:Ah... I see the problem. Although rpicam-apps will use the existing value of that environment variable, Picamera2 overrides it when imported. This is a bug in Picamera2.
The workaround is to set it after importing Picamera2, before opening the camera.Code:
os.environ["LIBCAMERA_RPI_CONFIG_FILE"]="./timeout.yaml"
Code:
import time, cv2, osfrom picamera2 import Picamera2#activate external triggeros.system(" echo 1 | sudo tee /sys/module/imx296/parameters/trigger_mode") #workaround for a bug in picam2 so that the library uses the set timeout valueos.environ["LIBCAMERA_RPI_CONFIG_FILE"]="./timeout.yaml"picam2 = Picamera2()config = picam2.create_preview_configuration(main={"size": (640, 480),"format":"RGB888"})picam2.configure(config)picam2.set_controls({"ExposureTime": 30000})picam2.set_controls({"AnalogueGain": 1.0})picam2.start()while True: #receiving images from the camera frame = picam2.capture_array("main") #show frame cv2.imshow("Camera", frame) key = cv2.waitKey(1) #stop when esc is pressed match key: case 27: break#stop cameracv2.destroyAllWindows()picam2.close()Statistics: Posted by Aipathon — Mon Aug 04, 2025 8:53 am