Closed leematthewshome closed 3 years ago
Using seconds
is based on the bitrate and duration specified to create a size - https://github.com/waveform80/picamera/blob/master/picamera/streams.py#L696
You've not set the bitrate, so it's at the default of 17Mbit/s. 17Mbit/s at VGA is never going to happen even with the quantisation turned all the way down - it's more sensible for 1080p30. But it means that the computed size is going to cover a longer duration than expected.
Set the bitrate sensibly.
OK. I see from the code it simply does the following:
if seconds is not None:
size = bitrate * seconds // 8
I think it would help to illustrate that bitrate needs to be set in the code examples. Otherwise they are quite misleading. Thanks for your help.
The PiCameraCircularIO object does not truncate based on the number of seconds provided as a limit.
I have pretty much taken the exact code from here: https://picamera.readthedocs.io/en/release-1.10/recipes2.html#splitting-to-from-a-circular-stream but am finding that the PiCameraCircularIO does not truncate based on the number of seconds provided as a limit.
My code is below - slightly modified from the example so that every 60 seconds it will write the data to a file. As I understand it the PiCameraCircularIO SHOULD only hold 10 seconds of video, as I have defined it using
stream = picamera.PiCameraCircularIO(camera, seconds=10)
but whenever the file is created it contains the full 60 seconds of video.Note however that if I use
stream = picamera.PiCameraCircularIO(camera, size=2000000)
I do reliably get a file size that is around 1900Kb and about 30 seconds long. So size is working, but seconds is not.