venari / timelapse

A set of tools/scripts to automate the taking and creation of timelapse videos and videos with a Raspberry Pi
MIT License
1 stars 0 forks source link

Unable to get long exposure over 1.7s #55

Open leighghunt opened 1 year ago

leighghunt commented 1 year ago

During testing of long exposure captures, can't get capture for longer than 1.7s.

Test images were default settings, and then attempting to set `camera.set_controls({"AfMode": controls.AfModeEnum.Manual, ... , "AeEnable": False, "ExposureTime": 5000000, "AnalogueGain": 8})

pi@timelapse-camera-ethan:~/dev/timelapse$ exiftool output/images/uploaded/2023-07-31_210041.jpg 
ExifTool Version Number         : 12.16
File Name                       : 2023-07-31_210041.jpg
Directory                       : output/images/uploaded
File Size                       : 208 KiB
File Modification Date/Time     : 2023:07:31 21:00:47+12:00
File Access Date/Time           : 2023:07:31 21:00:43+12:00
File Inode Change Date/Time     : 2023:07:31 21:16:46+12:00
File Permissions                : rw-r--r--
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
JFIF Version                    : 1.01
Resolution Unit                 : None
X Resolution                    : 1
Y Resolution                    : 1
Exif Byte Order                 : Big-endian (Motorola, MM)
Make                            : Raspberry Pi
Camera Model Name               : /base/soc/i2c0mux/i2c@1/imx708@1a
Software                        : Picamera2
Modify Date                     : 2023:07:31 21:00:43
Exposure Time                   : 1/8
ISO                             : 603
Date/Time Original              : 2023:07:31 21:00:43
Image Width                     : 4608
Image Height                    : 2592
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
Image Size                      : 4608x2592
Megapixels                      : 11.9
Shutter Speed                   : 1/8
pi@timelapse-camera-ethan:~/dev/timelapse$ exiftool output/images/uploaded/2023-07-31_210154.jpg 
ExifTool Version Number         : 12.16
File Name                       : 2023-07-31_210154.jpg
Directory                       : output/images/uploaded
File Size                       : 368 KiB
File Modification Date/Time     : 2023:07:31 21:02:04+12:00
File Access Date/Time           : 2023:07:31 21:01:59+12:00
File Inode Change Date/Time     : 2023:07:31 21:16:44+12:00
File Permissions                : rw-r--r--
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
JFIF Version                    : 1.01
Resolution Unit                 : None
X Resolution                    : 1
Y Resolution                    : 1
Exif Byte Order                 : Big-endian (Motorola, MM)
Make                            : Raspberry Pi
Camera Model Name               : /base/soc/i2c0mux/i2c@1/imx708@1a
Software                        : Picamera2
Modify Date                     : 2023:07:31 21:01:59
Exposure Time                   : 1.7
ISO                             : 800
Date/Time Original              : 2023:07:31 21:01:59
Image Width                     : 4608
Image Height                    : 2592
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
Image Size                      : 4608x2592
Megapixels                      : 11.9
Shutter Speed                   : 1.7

18_2023-07-31_210041 18_2023-07-31_210154

leighghunt commented 1 year ago

Seems like support didn't get into the release...

https://forums.raspberrypi.com/viewtopic.php?t=345891 https://forums.raspberrypi.com/viewtopic.php?p=2069524#p2069521

Need to check if updating Pi will get support in.

leighghunt commented 1 year ago
>>> from pprint import *
>>> from picamera2 import Picamera2
>>> picam2 = Picamera2()
# output omitted
>>> pprint(picam2.sensor_modes)
[0:09:13.320386168] [7927]  INFO Camera camera.cpp:1028 configuring streams: (0) 640x480-XBGR8888 (1) 1536x864-SBGGR10_CSI2P
[0:09:13.325468796] [9523]  INFO RPI raspberrypi.cpp:851 Sensor: /base/soc/i2c0mux/i2c@1/imx708@1a - Selected sensor format: 1536x864-SBGGR10_1X10 - Selected unicam format: 1536x864-pBAA
[0:09:13.486950750] [7927]  INFO Camera camera.cpp:1028 configuring streams: (0) 640x480-XBGR8888 (1) 2304x1296-SBGGR10_CSI2P
[0:09:13.516533405] [9523]  INFO RPI raspberrypi.cpp:851 Sensor: /base/soc/i2c0mux/i2c@1/imx708@1a - Selected sensor format: 2304x1296-SBGGR10_1X10 - Selected unicam format: 2304x1296-pBAA
[0:09:13.690291876] [7927]  INFO Camera camera.cpp:1028 configuring streams: (0) 640x480-XBGR8888 (1) 4608x2592-SBGGR10_CSI2P
[0:09:13.691765058] [9523]  INFO RPI raspberrypi.cpp:851 Sensor: /base/soc/i2c0mux/i2c@1/imx708@1a - Selected sensor format: 4608x2592-SBGGR10_1X10 - Selected unicam format: 4608x2592-pBAA
[{'bit_depth': 10,
  'crop_limits': (0, 0, 4608, 2592),
  'exposure_limits': (9, 603186, None),
  'format': SRGGB10_CSI2P,
  'fps': 120.13,
  'size': (1536, 864),
  'unpacked': 'SRGGB10'},
 {'bit_depth': 10,
  'crop_limits': (0, 0, 4608, 2592),
  'exposure_limits': (13, 875283, None),
  'format': SRGGB10_CSI2P,
  'fps': 56.03,
  'size': (2304, 1296),
  'unpacked': 'SRGGB10'},
 {'bit_depth': 10,
  'crop_limits': (0, 0, 4608, 2592),
  'exposure_limits': (26, 1722331, None),
  'format': SRGGB10_CSI2P,
  'fps': 14.35,
  'size': (4608, 2592),
  'unpacked': 'SRGGB10'}]
leighghunt commented 1 year ago

Tuning files for imx708 don't have long exposure mode: http://sources.buildroot.net/libcamera/git/src/ipa/raspberrypi/data/imx708_noir.json

134 pi@timelapse-camera-ethan:~/dev/timelapse/scripts$ python3 savePhotos.py 
[0:08:06.996260817] [8974]  INFO Camera camera_manager.cpp:299 libcamera v0.0.4+22-923f5d70
[0:08:07.354735886] [9185]  INFO RPI raspberrypi.cpp:1476 Registered camera /base/soc/i2c0mux/i2c@1/imx708@1a to Unicam device /dev/media3 and ISP device /dev/media0
[0:08:07.553360370] [8974]  INFO Camera camera.cpp:1028 configuring streams: (0) 4608x2592-BGR888
[0:08:07.556809361] [9185]  INFO RPI raspberrypi.cpp:851 Sensor: /base/soc/i2c0mux/i2c@1/imx708@1a - Selected sensor format: 4608x2592-SBGGR10_1X10 - Selected unicam format: 4608x2592-pBAA
[0:08:07.721917932] [9209] FATAL RPiAgc agc.cpp:540 No exposure profile long
leighghunt commented 1 year ago

May also be helpful: https://github.com/raspberrypi/picamera2/issues/735

leighghunt commented 1 year ago

Think this is the commit that will add the long exposure mode back to the camera - https://github.com/raspberrypi/libcamera/commit/c6ff999053cef89813d6b2f4601b9ec5d2590167

leighghunt commented 1 year ago
cat /usr/share/libcamera/ipa/raspberrypi/imx708.json  | grep exposure_modes --context 20
            }
        },
        {
            "rpi.agc":
            {
                "metering_modes":
                {
                    "centre-weighted":
                    {
                        "weights": [ 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0 ]
                    },
                    "spot":
                    {
                        "weights": [ 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
                    },
                    "matrix":
                    {
                        "weights": [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
                    }
                },
                "exposure_modes":
                {
                    "normal":
                    {
                        "shutter": [ 100, 15000, 30000, 60000, 120000 ],
                        "gain": [ 1.0, 1.0, 2.0, 4.0, 6.0 ]
                    },
                    "short":
                    {
                        "shutter": [ 100, 5000, 10000, 20000, 120000 ],
                        "gain": [ 1.0, 2.0, 4.0, 6.0, 6.0 ]
                    }
                },
                "constraint_modes":
                {
                    "normal": [
                        {
                            "bound": "LOWER",
                            "q_lo": 0.98,
                            "q_hi": 1.0,
                            "y_target":
leighghunt commented 1 year ago
libcamera-hello --version
libcamera-apps build: 54a781dffdd1 01-03-2023 (17:47:29)
libcamera build: v0.0.4+22-923f5d70
pi@timelapse-camera-ethan:~$ sudo apt update
Get:1 http://raspbian.raspberrypi.org/raspbian bullseye InRelease [15.0 kB]                                                                            
Get:2 http://archive.raspberrypi.org/debian bullseye InRelease [23.6 kB]                                
Get:3 https://pkgs.tailscale.com/stable/raspbian bullseye InRelease        
Get:4 http://raspbian.raspberrypi.org/raspbian bullseye/main armhf Packages [13.2 MB]                                                                   
Get:5 http://archive.raspberrypi.org/debian bullseye/main armhf Packages [314 kB]                                                                       
Get:6 https://pkgs.tailscale.com/stable/raspbian bullseye/main armhf Packages [8,383 B]                                                                 
Get:7 http://raspbian.raspberrypi.org/raspbian bullseye/contrib armhf Packages [60.2 kB]                                                                
Fetched 13.7 MB in 1min 17s (177 kB/s)                                                                                                                  
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
57 packages can be upgraded. Run 'apt list --upgradable' to see them.
pi@timelapse-camera-ethan:~$ apt list --upgradable
Listing... Done
avahi-daemon/stable 0.8-5+deb11u2 armhf [upgradable from: 0.8-5+deb11u1]
base-files/stable 11.1+rpi1+deb11u7 armhf [upgradable from: 11.1+rpi1+deb11u6]
bind9-host/stable 1:9.16.42-1~deb11u1 armhf [upgradable from: 1:9.16.37-1~deb11u1]
bind9-libs/stable 1:9.16.42-1~deb11u1 armhf [upgradable from: 1:9.16.37-1~deb11u1]
firmware-atheros/stable 1:20230210-5~bpo11+1+rpt1 all [upgradable from: 1:20221012-1~bpo11+1+rpt1]
firmware-brcm80211/stable 1:20230210-5~bpo11+1+rpt1 all [upgradable from: 1:20221012-1~bpo11+1+rpt1]
firmware-libertas/stable 1:20230210-5~bpo11+1+rpt1 all [upgradable from: 1:20221012-1~bpo11+1+rpt1]
firmware-misc-nonfree/stable 1:20230210-5~bpo11+1+rpt1 all [upgradable from: 1:20221012-1~bpo11+1+rpt1]
firmware-realtek/stable 1:20230210-5~bpo11+1+rpt1 all [upgradable from: 1:20221012-1~bpo11+1+rpt1]
grep/stable 3.6-1+deb11u1 armhf [upgradable from: 3.6-1]
isc-dhcp-client/stable 4.4.1-2.3+deb11u2 armhf [upgradable from: 4.4.1-2.3+deb11u1]
isc-dhcp-common/stable 4.4.1-2.3+deb11u2 armhf [upgradable from: 4.4.1-2.3+deb11u1]
libavahi-common-data/stable 0.8-5+deb11u2 armhf [upgradable from: 0.8-5+deb11u1]
libavahi-common3/stable 0.8-5+deb11u2 armhf [upgradable from: 0.8-5+deb11u1]
libavahi-core7/stable 0.8-5+deb11u2 armhf [upgradable from: 0.8-5+deb11u1]
libcamera-apps-lite/stable 1.2.1-1 armhf [upgradable from: 0~git20230301+54a781d-1]
libcamera0/stable 0~git20230720+bde9b04f-1 armhf [upgradable from: 0~git20230302+923f5d70-1]
libgstreamer-plugins-base1.0-0/stable 1.18.4-2+deb11u1 armhf [upgradable from: 1.18.4-2]
libncurses6/stable 6.2+20201114-2+deb11u1 armhf [upgradable from: 6.2+20201114-2]
libncursesw6/stable 6.2+20201114-2+deb11u1 armhf [upgradable from: 6.2+20201114-2]
libpam-systemd/stable 247.3-7+rpi1+deb11u2 armhf [upgradable from: 247.3-7+rpi1+deb11u1]
libraspberrypi-bin/stable 1:2+git20230322~143557+9d5250f-1 armhf [upgradable from: 1:2+git20220616~133208+6e8f786-1]
libraspberrypi-dev/stable 1:2+git20230322~143557+9d5250f-1 armhf [upgradable from: 1:2+git20220616~133208+6e8f786-1]
libraspberrypi-doc/stable 1:2+git20230322~143557+9d5250f-1 all [upgradable from: 1:2+git20220616~133208+6e8f786-1]
libraspberrypi0/stable 1:2+git20230322~143557+9d5250f-1 armhf [upgradable from: 1:2+git20220616~133208+6e8f786-1]
libssl1.1/stable 1.1.1n-0+deb11u5+rpt1 armhf [upgradable from: 1.1.1n-0+deb11u4+rpt1]
libsystemd0/stable 247.3-7+rpi1+deb11u2 armhf [upgradable from: 247.3-7+rpi1+deb11u1]
libtinfo5/stable 6.2+20201114-2+deb11u1 armhf [upgradable from: 6.2+20201114-2]
libtinfo6/stable 6.2+20201114-2+deb11u1 armhf [upgradable from: 6.2+20201114-2]
libudev1/stable 247.3-7+rpi1+deb11u2 armhf [upgradable from: 247.3-7+rpi1+deb11u1]
libwbclient0/stable 2:4.13.13+dfsg-1~deb11u5 armhf [upgradable from: 2:4.13.13+dfsg-1~deb11u4]
libwebp6/stable 0.6.1-2.1+deb11u1 armhf [upgradable from: 0.6.1-2.1]
libwebpdemux2/stable 0.6.1-2.1+deb11u1 armhf [upgradable from: 0.6.1-2.1]
libwebpmux3/stable 0.6.1-2.1+deb11u1 armhf [upgradable from: 0.6.1-2.1]
libx11-6/stable 2:1.7.2-1+deb11u1 armhf [upgradable from: 2:1.7.2-1]
libx11-data/stable 2:1.7.2-1+deb11u1 all [upgradable from: 2:1.7.2-1]
libxml2/stable 2.9.10+dfsg-6.7+deb11u4 armhf [upgradable from: 2.9.10+dfsg-6.7+deb11u3]
libxpm4/stable 1:3.5.12-1.1~deb11u1 armhf [upgradable from: 1:3.5.12-1]
linux-libc-dev/stable 1:1.20230405-1 armhf [upgradable from: 1:1.20230306-1]
ncurses-base/stable 6.2+20201114-2+deb11u1 all [upgradable from: 6.2+20201114-2]
ncurses-bin/stable 6.2+20201114-2+deb11u1 armhf [upgradable from: 6.2+20201114-2]
ncurses-term/stable 6.2+20201114-2+deb11u1 all [upgradable from: 6.2+20201114-2]
openssl/stable 1.1.1n-0+deb11u5+rpt1 armhf [upgradable from: 1.1.1n-0+deb11u4+rpt1]
python3-libcamera/stable 0~git20230720+bde9b04f-1 armhf [upgradable from: 0~git20230302+923f5d70-1]
python3-picamera2/stable 0.3.12-2 all [upgradable from: 0.3.9-1]
raspberrypi-bootloader/stable 1:1.20230405-1 armhf [upgradable from: 1:1.20230306-1]
raspberrypi-kernel/stable 1:1.20230405-1 armhf [upgradable from: 1:1.20230306-1]
raspberrypi-sys-mods/stable 20230510~bullseye armhf [upgradable from: 20221019]
rpi-eeprom/stable 16.1-1 armhf [upgradable from: 16.0-1]
systemd-sysv/stable 247.3-7+rpi1+deb11u2 armhf [upgradable from: 247.3-7+rpi1+deb11u1]
systemd-timesyncd/stable 247.3-7+rpi1+deb11u2 armhf [upgradable from: 247.3-7+rpi1+deb11u1]
systemd/stable 247.3-7+rpi1+deb11u2 armhf [upgradable from: 247.3-7+rpi1+deb11u1]
tailscale/unknown 1.46.1 armhf [upgradable from: 1.36.2]
traceroute/stable 1:2.1.0-2+deb11u1 armhf [upgradable from: 1:2.1.0-2]
tzdata/stable 2021a-1+deb11u10 all [upgradable from: 2021a-1+deb11u8]
udev/stable 247.3-7+rpi1+deb11u2 armhf [upgradable from: 247.3-7+rpi1+deb11u1]
vcdbg/stable 1:1.20230405-1 armhf [upgradable from: 1:1.20230306-1]
leighghunt commented 1 year ago
pi@timelapse-camera-ethan:~$ sudo apt upgrade
...
...
pi@timelapse-camera-ethan:~$ libcamera-hello --version
libcamera-apps build: 7e4d3d71867f 17-07-2023 (07:34:37)
libcamera build: v0.0.5+83-bde9b04f
pi@timelapse-camera-ethan:~$ cat /usr/share/libcamera/ipa/raspberrypi/imx708.json  | grep exposure_modes --context 20
cat: /usr/share/libcamera/ipa/raspberrypi/imx708.json: No such file or directory
1 pi@timelapse-camera-ethan:~$ 

pi@timelapse-camera-ethan:~$ cat  /usr/share/libcamera/ipa/rpi/vc4/imx708.json | grep exposure_modes --context 20
            }
        },
        {
            "rpi.agc":
            {
                "metering_modes":
                {
                    "centre-weighted":
                    {
                        "weights": [ 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0 ]
                    },
                    "spot":
                    {
                        "weights": [ 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
                    },
                    "matrix":
                    {
                        "weights": [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
                    }
                },
                "exposure_modes":
                {
                    "normal":
                    {
                        "shutter": [ 100, 15000, 30000, 60000, 120000 ],
                        "gain": [ 1.0, 1.0, 2.0, 4.0, 6.0 ]
                    },
                    "short":
                    {
                        "shutter": [ 100, 5000, 10000, 20000, 120000 ],
                        "gain": [ 1.0, 2.0, 4.0, 6.0, 6.0 ]
                    },
                    "long":
                    {
                        "shutter": [ 1000, 30000, 60000, 90000, 120000 ],
                        "gain": [ 1.0, 2.0, 4.0, 6.0, 12.0 ]
                    }
                },
                "constraint_modes":
                {
                    "normal": [
leighghunt commented 1 year ago

Now 20 second exposures are working.

Before: 18_2023-08-10_211136

After: 18_2023-08-10_213619