stantheman103
Posts: 1
Joined: Thu May 07, 2020 12:50 pm

Raspberry Pi High Quality Camera Long Exposures

Thu May 07, 2020 12:59 pm

Hi,

I noticed in the technical description of the "Official Raspberry Pi Camera Guide, that the frame rate is 0.005-10 fps. This would mean that 200s exposures should be possible. However using raspistill, I appear to only be able to achieve a maximum shutter speed of 10.2seconds.
Is this camera module capable of longer exposures?

Best regards,
Rob

User avatar
HermannSW
Posts: 2568
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Raspberry Pi High Quality Camera Long Exposures

Sat May 09, 2020 7:52 am

naushir did fix that 20 hours ago:
https://github.com/raspberrypi/userland ... 7628c587d7
raspistill: Adjust framerate limits on long exposures. (#622)
Need to reduce the min fps limit to 0.005 for 200s exposures
available in HQ cam.
Just sync userland, "cd userland" and do "time ./buildme dummy" (takes less than 2min on Pi4B) in order to not overwrite shipped raspivid/raspistill (you can run "buildme/bin/raspistill").
Building that you get new "--focus"/"-fw" option as well:
viewtopic.php?f=43&t=272658&p=1657764#p1657764
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264

User avatar
HermannSW
Posts: 2568
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Raspberry Pi High Quality Camera Long Exposures

Sat May 09, 2020 9:53 am

Either I don't use raspistill correctly for long exposures, or the fix is not good.

I did point HQ camera onto a smartphone analog clock with dark room (window shutters closed).
Then I executed this command -- regardless of parameters it takes always 104s:

Code: Select all

🍓 time userland/build/bin/raspistill --exposure verylong --shutter 15000000 -t 16000 -o tst.jpg

real	1m43.843s
user	0m0.000s
sys	0m0.090s
🍓
This is the result, only 11 second positions instead of 15:
tst.15%.jpg
tst.15%.jpg
tst.15%.jpg (199.9 KiB) Viewed 2234 times
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264

naushir
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 45
Joined: Mon Apr 25, 2016 10:21 am

Re: Raspberry Pi High Quality Camera Long Exposures

Sat May 09, 2020 11:27 am

This is the result, only 11 second positions instead of 15:
@HermannSW, can you please check what the EXIF data says about the shutter speed in your captured jpeg? I suspect your command line has not disabled AE fully and you are not getting the manual shutter speed you expect.

My testing was using the following command (for a 100s exposure):

Code: Select all

raspistill -t 10 -md 3  -ex off -ag 1 -ss 100000000 -o test.jpg
The command above takes a longggg time to complete because of the pre-captures the pipeline does (in the order of minutes, so just be patient!). I have confirmed that the system is programming the sensor up as it should, and the EXIF output matches the 100 seconds I requested. Given the limited resources right now, I have not verified that the sensors is exposing the frame for exactly 100 seconds with an LED box or similar. At some point I will log the framing events to see how long the sensor took to deliver the frame - which should give a good indication of the exposure time used.

ethanol100
Posts: 637
Joined: Wed Oct 02, 2013 12:28 pm

Re: Raspberry Pi High Quality Camera Long Exposures

Sat May 09, 2020 1:43 pm

The "-md 3" is the crucial parameter here. Without it, raspistill produces 10.2s exposures only.

User avatar
HermannSW
Posts: 2568
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Raspberry Pi High Quality Camera Long Exposures

Sat May 09, 2020 3:29 pm

ethanol100 wrote:
Sat May 09, 2020 1:43 pm
The "-md 3" is the crucial parameter here. Without it, raspistill produces 10.2s exposures only.
Thanks -- that made a difference, but not all is correct.

This is the (very dark) setup, HQ camera is on left side of analog clock on the photo (above in real):
imx477.analog.clock.30%.jpg
imx477.analog.clock.30%.jpg
imx477.analog.clock.30%.jpg (21.43 KiB) Viewed 2118 times

This is the command I executed -- took 7:30min!

Code: Select all

🍓 time userland/build/bin/raspistill --mode 3 --exposure verylong --shutter 55000000 -t 1000 -o tst.jpg

real	7m30.613s
user	0m0.012s
sys	0m0.043s
🍓

After several minutes preview window appeared, and that was correct !
It did show 55 positions for second hand, only area for 4 seconds was not covered.
And the window was super bright, although the scene is not, because it really had 55s exposure.

@naushir
The problem is that the stored image shows only 20 second hands, which corresponds to the "50" value you corrected to "5" in your commit:
tst.55_20.15%.jpg
tst.55_20.15%.jpg
tst.55_20.15%.jpg (114.23 KiB) Viewed 2118 times

Next I did run with your command options:

Code: Select all

🍓 time userland/build/bin/raspistill --mode 3 --exposure off -ag 1 --shutter 55000000 -t 10 -o tst.jpg

real	7m30.544s
user	0m0.019s
sys	0m0.072s
🍓 
But again only 20 second hands appear on written image:


Finally I executed my command again and waited several minutes for the preview window to appear.
In this photo of HDMI monitor you can see that preview really shows 55s exposure.
I copied the area with 5s not showing second hands in original size onto right side of the photo:
imx477.analog.clock.preview.30%.jpg
imx477.analog.clock.preview.30%.jpg
imx477.analog.clock.preview.30%.jpg (32.21 KiB) Viewed 2098 times
Please complete the fix, and make not only allowing preview window for more than 20s exposure, but the output file as well.
Installing analog clock and 55s exposure time is a simple test for verification (only it has to be dark).
You might want to make 200s exposure work for default mode 0 as well.
Last edited by HermannSW on Sat May 09, 2020 3:51 pm, edited 1 time in total.
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264

naushir
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 45
Joined: Mon Apr 25, 2016 10:21 am

Re: Raspberry Pi High Quality Camera Long Exposures

Sat May 09, 2020 3:47 pm

Could you check the exif tags in the captured image and let me know what shutter speed is recorded?

It's questionable what use long exposures would have for preview modes. Can you not just use the full rest mode for long exposures as frame rate and throughput don't matter.

ethanol100
Posts: 637
Joined: Wed Oct 02, 2013 12:28 pm

Re: Raspberry Pi High Quality Camera Long Exposures

Sat May 09, 2020 3:51 pm

I did try 25s, and it tells me it has created a 25s exposure. What does your image say?

Code: Select all

strings img.jpg | grep exp
Can you run it again, adding the -set parameter, to check the exposure while running?
Did you use your newly compiled raspistill version?

User avatar
HermannSW
Posts: 2568
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Raspberry Pi High Quality Camera Long Exposures

Sat May 09, 2020 3:59 pm

First, I added photo showing 55s exposure in preview window I think after you posted. please have a look at that in my previous posting:
naushir wrote:
Sat May 09, 2020 3:47 pm
Could you check the exif tags in the captured image and let me know what shutter speed is recorded?
I opened the written file tst.jpg with "eog" and then looked at metada.
Exposure time reported is 54s, but only 20 second hands can be seen:
imx477.55s.metadata.jpg
imx477.55s.metadata.jpg
imx477.55s.metadata.jpg (67.82 KiB) Viewed 2085 times
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264

User avatar
HermannSW
Posts: 2568
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Raspberry Pi High Quality Camera Long Exposures

Sat May 09, 2020 4:02 pm

ethanol100 wrote:
Sat May 09, 2020 3:51 pm
I did try 25s, and it tells me it has created a 25s exposure. What does your image say?

Code: Select all

strings img.jpg | grep exp
This:

Code: Select all

$ strings tst.jpg | grep exp
ev=-1 mlux=-1 exp=54999846 ag=320 focus=255 gain_r=1.804 gain_b=2.933 greenness=0 ccm=6700,-2562,-38,-846,5538,-592,468,-3844,7476,0,0,0 md=0 tg=265 265 oth=265 110 b=0 f=265 265 fi=0 ISP Build Date: Jan 22 2020, 17:24:17 VC_BUILD_ID_VERSION: acb03c7d18aa08f25f6419d696d0cc39761d3e62 (clean) VC_BUILD_ID_USER: dom VC_BUILD_ID_BRANCH: bcm2711_2 
$ 
Did you use your newly compiled raspistill version?
Yes, see my command from previous posting "time userland/build/bin/raspistill ...".
Without that new command I would not have seen 55s exposure in preview window.
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264

naushir
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 45
Joined: Mon Apr 25, 2016 10:21 am

Re: Raspberry Pi High Quality Camera Long Exposures

Sat May 09, 2020 4:23 pm

HermannSW wrote:
Sat May 09, 2020 3:59 pm
First, I added photo showing 55s exposure in preview window I think after you posted. please have a look at that in my previous posting:
naushir wrote:
Sat May 09, 2020 3:47 pm
Could you check the exif tags in the captured image and let me know what shutter speed is recorded?
I opened the written file tst.jpg with "eog" and then looked at metada.
Exposure time reported is 54s, but only 20 second hands can be seen:
imx477.55s.metadata.jpg
So it sounds like even though the exif is reporting the requested exposure, the sensors not using 55 seconds. I'll look into that.

naushir
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 45
Joined: Mon Apr 25, 2016 10:21 am

Re: Raspberry Pi High Quality Camera Long Exposures

Sat May 09, 2020 6:44 pm

So I seemed to miss the fact that raspistill had a different fps setup for preview and stills port. I have a PR in place to fix this: https://github.com/raspberrypi/userland/pull/623

@HermannSW, can you give this a try please?

User avatar
HermannSW
Posts: 2568
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Raspberry Pi High Quality Camera Long Exposures

Sat May 09, 2020 8:42 pm

naushir wrote:
Sat May 09, 2020 6:44 pm
@HermannSW, can you give this a try please?
Done -- that fixed the problem, thank you!

I did take the single line change in RaspiStill.c only and recompiled.
Then I executed my command, and this time it took even more than 9 minutes (on 4GB Pi4B):

Code: Select all

🍓 time userland/build/bin/raspistill --mode 3 --exposure verylong --shutter 55000000 -t 1000 -o tst.jpg

real	9m11.662s
user	0m0.001s
sys	0m0.064s
🍓
From the resulting tst.jpg I did cut out analog clock and scaled to 25%.
As can be seen the 55s exposure worked great, 55 second hands:
imx477.55s_exposure.jpg
imx477.55s_exposure.jpg
imx477.55s_exposure.jpg (40.87 KiB) Viewed 1968 times


Next I did try 195s exposure -- why does this take more than 32 minutes?!?

Code: Select all

🍓 time userland/build/bin/raspistill --mode 3 --exposure verylong --shutter 195000000 -t 1000 -o tst.jpg


real	32m31.823s
user	0m0.006s
sys	0m0.061s
🍓

Here is cut out analog clock scaled to 25% (because of the long exposure very bright):
imx477.195s_exposure.25%.jpg
imx477.195s_exposure.25%.jpg
imx477.195s_exposure.25%.jpg (39.65 KiB) Viewed 1968 times

I did cut out part from that at original size and increased brightness and contrast from 0 to 60 with gimp.
That way it is easy to see that minute hand really moved from 12 minutes to 15 minutes in 195s:
imx477.195s_exposure.cobr.jpg
imx477.195s_exposure.cobr.jpg
imx477.195s_exposure.cobr.jpg (7.99 KiB) Viewed 1968 times


Please submit the fix, although testing raspistillyuv, raspivid and raspividyuv is needed to be done as well.

Summary:
Now HQ camera can do up to 200s long exposure.
But that cannot be done "now", it takes far more than 20 minutes before the real capture takes place.
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264

bokser01
Posts: 10
Joined: Sat May 09, 2020 8:59 pm

Re: Raspberry Pi High Quality Camera Long Exposures

Sat May 09, 2020 9:02 pm

Exposure is exactly 21.3s I entered the command for 55s to test and the maximum is 21.3s Here is the photo https://gyazo.com/ba57681ee51c0562cfe1e49b9ec3bc41

naushir
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 45
Joined: Mon Apr 25, 2016 10:21 am

Re: Raspberry Pi High Quality Camera Long Exposures

Sat May 09, 2020 9:24 pm

But that cannot be done "now", it takes far more than 20 minutes before the real capture takes place.
The reason for this is due to what I mentioned earlier about running frames through the pipeline before the capture cycle. In order to prime the control algorithms, we need a few (around 5 if I recall) frames of preview to stabilise AEC/AWB and other algorithms. Now normally this happens during viewfinder running at 30fps, so is near instantaneous. With raspistill, when you choose a very long shutter speed, that shutter speed is used for these preview frames, hence it why it takes so long for a capture cycle to complete.

What I think should help is if raspistill has an option to apply the long shutter speed (and perhaps other parameters) only to captures frames - and allow viewfinder to run in "auto" mode at the normal rate. I do not really know this application, so I cannot comment on how feasible this change would be.

If anyone is feeling brave enough, please do give this a try!

User avatar
HermannSW
Posts: 2568
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Raspberry Pi High Quality Camera Long Exposures

Sat May 09, 2020 9:59 pm

bokser01 wrote:
Sat May 09, 2020 9:02 pm
Exposure is exactly 21.3s I entered the command for 55s to test and the maximum is 21.3s Here is the photo https://gyazo.com/ba57681ee51c0562cfe1e49b9ec3bc41
You need to sync userland and build as I described before, then you wil get 200s long exposure time:
https://github.com/raspberrypi/userland
It will take some time until this will be updated by a next "sudo apt-get update" for the system raspi[yuv](still|vid) tools.
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264

bokser01
Posts: 10
Joined: Sat May 09, 2020 8:59 pm

Re: Raspberry Pi High Quality Camera Long Exposures

Sun May 10, 2020 4:06 pm

Thanks is runinng :)

User avatar
HermannSW
Posts: 2568
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Raspberry Pi High Quality Camera Long Exposures

Thu May 14, 2020 1:10 am

Wow, I had 58mm ND2 and ND4 neutral density filters, but have not done anything useful with them.
ND4 means 0.0001 fractional transmittance, and reduces the amount of light entering the lens significantly:
https://en.wikipedia.org/wiki/Neutral-density_filter

Today I learned from jbeale and nicolap8 that a filter does not need to be screwed to the lens:
viewtopic.php?f=43&t=273820&p=1659839#p1659839

This is setup, 58mm diameter ND4 filter between HQ camera lens and smartphone analog clock app, hold by soldering 3rd hand:
ND4.jpg
ND4.jpg
ND4.jpg (39.37 KiB) Viewed 1629 times

Again I did shoot a 195s long exposure, but this time not overexposed !
And minute hand can be seen clearly having traveled for more than 3 minutes this time:

Code: Select all

$ userland/build/bin/raspistill --mode 3 --exposure verylong --shutter 195000000 -t 1000 -o tst.jpg
imx477.195s_exposure.15%.jpg
imx477.195s_exposure.15%.jpg
imx477.195s_exposure.15%.jpg (213.67 KiB) Viewed 1629 times
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264

r2k-in-the-vortex
Posts: 5
Joined: Fri May 15, 2020 1:48 pm

Re: Raspberry Pi High Quality Camera Long Exposures

Sat May 16, 2020 1:52 pm

There is this bit in host_applications/linux/apps/raspicam/RaspiStill.c main

Code: Select all

// There is a possibility that shutter needs to be set each loop.
if (mmal_status_to_int(mmal_port_parameter_set_uint32(state.camera_component->control, MMAL_PARAMETER_SHUTTER_SPEED, state.camera_parameters.shutter_speed)) != MMAL_SUCCESS)
	vcos_log_error("Unable to set shutter speed");
And what I found is that if raspistill is run with -s or -k then it's possible to do the first frame with auto shutter_speed, or with some other fast value and then for frames after that change it to anything up to 200s for all the consecutive frames. The first frame wants to run the whatever autoconfig pipeline it has, but for frames after that you can run with long shutter_speed, without triggering the half hour long config process.

So what I did was create an extra long_shutter_speed config flag and changed this bit so

Code: Select all

// There is a possibility that shutter needs to be set each loop.
if (state.long_shutter_speed == 0 || frame == 0)
{
  if (mmal_status_to_int(mmal_port_parameter_set_uint32(state.camera_component->control, MMAL_PARAMETER_SHUTTER_SPEED, state.camera_parameters.shutter_speed)) != MMAL_SUCCESS)
     vcos_log_error("Unable to set shutter speed");
}
else
{
  if (mmal_status_to_int(mmal_port_parameter_set_uint32(state.camera_component->control, MMAL_PARAMETER_SHUTTER_SPEED, state.long_shutter_speed)) != MMAL_SUCCESS)
     vcos_log_error("Unable to set shutter speed to still long capture");
}
and then I can run raspistill -v -o out%d.jpg -k --mode 3 -lss 200000000 -ss 20000 -ISO 200
with the -lss being the new flag for long shutter speed that will not be set before frame >= 1
using the existing frame variable probably isn't good idea though, it's also used for timestamping filenames and that screws this hackjob of a patch up.
I got some more testing to do, but in essence this approach seems to work, gets it ready to capture long exposures fairly fast

Maybe a better way to do this would be to add an ability to change the capture parameters on the fly when in signal/keypress mode. It can already parse enter and x, so it should be possible to add other options to adjust shutter speed and iso between captures, without reinitializing the camera.

here is my code as is https://github.com/r2k-in-the-vortex/us ... b3fe93bcb9

User avatar
HermannSW
Posts: 2568
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Raspberry Pi High Quality Camera Long Exposures

Sun May 17, 2020 7:12 am

@r2k-in-the-vortex
Your solution is toxic and brilliant ;-)

I did sync your repo and built it with "cd userland; time ./buildme dummy" in less than 2 minutes on Pi4B without overwriting system raspistill.


Why toxic?
I modified my command first and did run it:

Code: Select all

🍓 time userland/build/bin/raspistill --mode 3 --exposure verylong -lss 195000000 --shutter 100000 -t 1000 -o tst.jpg
^C
After more than an hour without completion, I tried CTRL-C, nothing happened.
In another ssh session I did "sudo reboot now", and nothing happened.
I had to power cycle the Pi4B.


Why brilliant?
With "-k" your fix just works!
I Added "-k" for my command, and automated the key presses needed for two frames by (input redirection to subshell):

Code: Select all

... < <(echo -e "\nX")
Since I am not interested in first frame I used a single output filename:

Code: Select all

🍓 time ( userland/build/bin/raspistill --mode 3 --exposure verylong --shutter 20000 -lss 195000000 -t 1000 -k -o tst.jpg < <(echo -e "\nX") )

real	4m23.206s
user	0m0.018s
sys	0m0.119s
🍓 
I have no explanation why taking 195s or 3:15min long exposure takes 4:23min in total, but that one more minute is acceptable for such a long exposure for me.


Just for completeness, this is completely overexposed frame captured, since I did not place ND4 filter between lens and scene this time as done above:
tst.15%.jpg
tst.15%.jpg
tst.15%.jpg (26.75 KiB) Viewed 1363 times
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264

r2k-in-the-vortex
Posts: 5
Joined: Fri May 15, 2020 1:48 pm

Re: Raspberry Pi High Quality Camera Long Exposures

Sun May 17, 2020 10:53 am

Huh, not sure why it hung up without -k, without some sort of capture repetition it should never get to the point where -lss is ever used.
I suspect this issue is something else, not related to my changes directly. The camera does weird things with long exposures.

Good idea about redirecting in that \nX

An unfortunate thing I found though. If shutter speed of first image is <1s, then -lss no matter how long will not actually expose over 1s. It'll take the appropriate time to capture image, it'll write -lss value to exif, but the actual exposure is only 1s.
Same thing if first image is up to 6 seconds, it'll do a 6s exposure just waste 195s to take it.

--shutter has to be over 6s for this to properly work, that however does make initialization and especially disposal slow.
Capture 0 takes 50 seconds,
Setting up for next capture takes 6 seconds
The actual 195s capture 1 takes 207 seconds
Closing down however takes 6-7 minutes for some odd reason, though the output file is available as soon as capture 1 is finished.

Here are my own efforts.
log of the executed command is as such

Code: Select all

pi@raspberrypi:~ time raspistill --mode 3 -ISO 20 -lss 195000000 --shutter 6000001 -t 1000 -o /run/shm/capture/tst.jpg -k -v < <(echo -e "\nX") 2>&1 | perl -pe 'use POSIX strftime; print strftime "[%Y-%m-%d %H:%M:%S] ", localtime'
[2020-05-17 11:34:43]
[2020-05-17 11:34:43] "raspistill" Camera App (commit 291f9cb826d5 Tainted)
[2020-05-17 11:34:43]
[2020-05-17 11:34:43] Camera Name testc
[2020-05-17 11:34:43] Width 4056, Height 3040, filename /run/shm/capture/tst.jpg
[2020-05-17 11:34:43] Using camera 0, sensor mode 3
[2020-05-17 11:34:43]
[2020-05-17 11:34:43] GPS output Disabled
[2020-05-17 11:34:43]
[2020-05-17 11:34:43] Quality 85, Raw no
[2020-05-17 11:34:43] Thumbnail enabled Yes, width 64, height 48, quality 35
[2020-05-17 11:34:43] Time delay 1000, Timelapse 0
[2020-05-17 11:34:43] Link to latest frame enabled  no
[2020-05-17 11:34:43] Full resolution preview No
[2020-05-17 11:34:43] Capture method : Capture on keypress
[2020-05-17 11:34:43]
[2020-05-17 11:34:43] Preview Yes, Full screen Yes
[2020-05-17 11:34:43] Preview window 0,0,1024,768
[2020-05-17 11:34:43] Opacity 255
[2020-05-17 11:34:43] Sharpness 0, Contrast 0, Brightness 50
[2020-05-17 11:34:43] Saturation 0, ISO 20, Video Stabilisation No, Exposure compensation 0
[2020-05-17 11:34:43] Exposure Mode 'auto', AWB Mode 'auto', Image Effect 'none'
[2020-05-17 11:34:43] Flicker Avoid Mode 'off'
[2020-05-17 11:34:43] Metering Mode 'average', Colour Effect Enabled No with U = 128, V = 128
[2020-05-17 11:34:43] Rotation 0, hflip No, vflip No
[2020-05-17 11:34:43] ROI x 0.000000, y 0.000000, w 1.000000 h 1.000000
[2020-05-17 11:34:43] Camera component done
[2020-05-17 11:34:43] Encoder component done
[2020-05-17 11:34:43] Starting component connection stage
[2020-05-17 11:34:43] Connecting camera preview port to video render.
[2020-05-17 11:34:43] Connecting camera stills port to encoder input port
[2020-05-17 11:34:43] Press Enter to capture, X then ENTER to exit
[2020-05-17 11:34:43] Opening output file /run/shm/capture/tst.jpg
[2020-05-17 11:34:43] ISO 20
[2020-05-17 11:34:43] Enabling encoder output port
[2020-05-17 11:34:43] Starting capture 0
[2020-05-17 11:35:33] Finished capture 0
[2020-05-17 11:35:33] Press Enter to capture, X then ENTER to exit
[2020-05-17 11:35:33] Opening output file /run/shm/capture/tst.jpg
[2020-05-17 11:35:33] ISO 20
[2020-05-17 11:35:39] Enabling encoder output port
[2020-05-17 11:35:39] Starting capture 1
[2020-05-17 11:39:06] Finished capture 1
[2020-05-17 11:39:06] Closing down
[2020-05-17 11:45:36] Close down completed, all components disconnected, disabled and destroyed
[2020-05-17 11:45:36]

real    10m53.689s
user    0m0.084s
sys     0m0.072s
pi@raspberrypi:~ $
edit: clearer image, it definitely works for 195 second exposure
Image

r2k-in-the-vortex
Posts: 5
Joined: Fri May 15, 2020 1:48 pm

Re: Raspberry Pi High Quality Camera Long Exposures

Sun May 17, 2020 1:07 pm

Right, to investigate why the heck closing down takes so long I made some changes and added more verbose printouts.
https://github.com/r2k-in-the-vortex/us ... 2a504d998c

Turns out disabling preview component takes 3 minutes and disabling camera component 3 more minutes.
--nopreview seems to have no effect.

I'm kind of stumped on that one, @naushir perhaps can offer some insight
I think I'll just keep the raspistill -k or -s running and trigger it when I wish to. A bit of a pain in the rear if capture parameters need changing, but if I have them dialed in I can just keep taking more captures ad nauseum without a problem and without any significant delay.

Code: Select all

[2020-05-17 15:42:07] Closing down
[2020-05-17 15:42:07] Check Disable port Video
[2020-05-17 15:42:07] Check Disable encoder output
[2020-05-17 15:42:07] Destroy preview connection
[2020-05-17 15:45:22] Destroy encoder connection
[2020-05-17 15:45:22] Disable encoder component
[2020-05-17 15:45:22] Disable preview component
[2020-05-17 15:45:22] Disable camera component
[2020-05-17 15:48:37] Destory encoder
[2020-05-17 15:48:37] Destory preview
[2020-05-17 15:48:37] Destory camera
[2020-05-17 15:48:37] Close down completed, all components disconnected, disabled and destroyed

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 8722
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Raspberry Pi High Quality Camera Long Exposures

Sun May 17, 2020 1:44 pm

If a capture has been requested from the camera stack, then it will complete that capture at whatever exposure time has been requested.
You've left the preview port active during your capture, therefore as soon as the capture is complete a preview frame will be requested.
Use burst mode to deactivate the automatic switch back to preview (the main use case was to make repeated captures without the switch back to preview, but it should work in your case too).
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

User avatar
HermannSW
Posts: 2568
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Raspberry Pi High Quality Camera Long Exposures

Sun May 17, 2020 3:27 pm

r2k-in-the-vortex wrote:
Sun May 17, 2020 10:53 am

--shutter has to be over 6s for this to properly work, that however does make initialization and especially disposal slow.
What do you mean with "properly work"?
I used 20ms and did only get 1min additional time.
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264

r2k-in-the-vortex
Posts: 5
Joined: Fri May 15, 2020 1:48 pm

Re: Raspberry Pi High Quality Camera Long Exposures

Sun May 17, 2020 4:03 pm

Burst mode kind of works as a fix for destroying preview component taking too long, if enabled it happens instantly.
However -lss stops working and it does the exposure at whatever the first image -ss was so that doesn't really help.
And disabling camera component still takes another 3 minutes.

Code: Select all

pi@raspberrypi:~/share/userland $ time raspistill --mode 3 -ISO 50 -lss 195000000 --shutter 6000001 -t 200 -o /run/shm/capture/tst.jpg -k -v -n -bm < <(echo -e "\nX") 2>&1 | perl -pe 'use POSIX strftime; print strftime "[%Y-%m-%d %H:%M:%S] ", localtime'
[2020-05-17 18:49:42]
[2020-05-17 18:49:42] "raspistill" Camera App (commit 291f9cb826d5 Tainted)
[2020-05-17 18:49:42]
[2020-05-17 18:49:42] Camera Name testc
[2020-05-17 18:49:42] Width 4056, Height 3040, filename /run/shm/capture/tst.jpg
[2020-05-17 18:49:42] Using camera 0, sensor mode 3
[2020-05-17 18:49:42]
[2020-05-17 18:49:42] GPS output Disabled
[2020-05-17 18:49:42]
[2020-05-17 18:49:42] Quality 85, Raw no
[2020-05-17 18:49:42] Thumbnail enabled Yes, width 64, height 48, quality 35
[2020-05-17 18:49:42] Time delay 200, Timelapse 0
[2020-05-17 18:49:42] Link to latest frame enabled  no
[2020-05-17 18:49:42] Full resolution preview No
[2020-05-17 18:49:42] Capture method : Capture on keypress
[2020-05-17 18:49:42]
[2020-05-17 18:49:42] Preview No, Full screen Yes
[2020-05-17 18:49:42] Preview window 0,0,1024,768
[2020-05-17 18:49:42] Opacity 255
[2020-05-17 18:49:42] Sharpness 0, Contrast 0, Brightness 50
[2020-05-17 18:49:42] Saturation 0, ISO 50, Video Stabilisation No, Exposure compensation 0
[2020-05-17 18:49:42] Exposure Mode 'auto', AWB Mode 'auto', Image Effect 'none'
[2020-05-17 18:49:42] Flicker Avoid Mode 'off'
[2020-05-17 18:49:42] Metering Mode 'average', Colour Effect Enabled No with U = 128, V = 128
[2020-05-17 18:49:42] Rotation 0, hflip No, vflip No
[2020-05-17 18:49:42] ROI x 0.000000, y 0.000000, w 1.000000 h 1.000000
[2020-05-17 18:49:42] Camera component done
[2020-05-17 18:49:42] Encoder component done
[2020-05-17 18:49:42] Starting component connection stage
[2020-05-17 18:49:42] Connecting camera preview port to video render.
[2020-05-17 18:49:42] Connecting camera stills port to encoder input port
[2020-05-17 18:49:42] Press Enter to capture, X then ENTER to exit
[2020-05-17 18:49:42] Opening output file /run/shm/capture/tst.jpg
[2020-05-17 18:49:42] Enabling encoder output port
[2020-05-17 18:49:42] Starting capture 0
[2020-05-17 18:50:32] Finished capture 0
[2020-05-17 18:50:32] Press Enter to capture, X then ENTER to exit
[2020-05-17 18:50:32] Opening output file /run/shm/capture/tst.jpg
[2020-05-17 18:50:32] Swapping to long shutter speed -lss = 195000000
[2020-05-17 18:50:32] Enabling encoder output port
[2020-05-17 18:50:32] Starting capture 1
[2020-05-17 18:50:39] Finished capture 1
[2020-05-17 18:50:39] Closing down
[2020-05-17 18:50:39] Check Disable port Video
[2020-05-17 18:50:39] Check Disable encoder output
[2020-05-17 18:50:39] Destroy preview connection
[2020-05-17 18:50:39] Destroy encoder connection
[2020-05-17 18:50:39] Disable encoder component
[2020-05-17 18:50:39] Disable preview component
[2020-05-17 18:50:39] Disable camera component
[2020-05-17 18:53:54] Destory encoder
[2020-05-17 18:53:54] Destory preview
[2020-05-17 18:53:54] Destory camera
[2020-05-17 18:53:54] Close down completed, all components disconnected, disabled and destroyed
[2020-05-17 18:53:54]

real    4m12.000s
user    0m0.074s
sys     0m0.068s
What I mean by not working with 20ms, is if you do the clock test you'll find the actual capture 1 was only 1s long, even though it took 195s and also wrote that to exif.

Return to “Camera board”