Skip to content

Customizing stills pictures directories to better optimize external automation of compiling timelapse videos #1497

@LucidEye

Description

@LucidEye

I use Mycodo for automating the capture of still images to later be compiled into time lapse videos. I use both directly-attached Raspberry Pi camera modules, as well as external network IP cameras for shooting outdoor grows.
I don't believe the existing Time Lapse option in the Camera Function offers the kind of customization or flexibility I require for capturing image sequences, or automating the video compilation process. And the built-in Time Lapse feature in Mycodo simply takes too long to compile, and can compromise system stability especially when trying to compile large image sequences... there is also no adjustment for frame-duration or playback frame rate... which leaves the finished videos rather "jerky" and lacking in quality.

Typically, I shoot time lapse sequences continuously through the entire duration of a grow, which can be as long as 5 months.
I usually download image sequences covering a span of the previous 24 hours from the Pi to my PC and compile them into "daily" clips using a video editor like KDENLive, or running an automation script that uses ffmpeg.
I can later compile these daily clips into a full length movie of the entire grow from seed to harvest.
I also use the daily time lapse clips to observe plant conditions and adjust watering intervals and feed ratios as needed to avoid any plant droop or wilting between watering cycles.

It would be extremely useful to be able to have a time lapse option which could be set as "open-ended", meaning you just set a frame-grab interval, and let it go until you tell it to stop. The current Time Lapse option only allows for setting a pre-determined number of frames, instead set a Span Time for each daily image sequence. Time Lapse is about capturing an event that happens over a long period of time... you don't shoot by calculate for number of frames beforehand, you calculate for how long the event being observed takes place and set a length of time (or a span) and then you decide what your frame interval will be based on what your final playback framerate will be to determine the speed of the final timelapse effect.

An example of how the Span Time would work would be to have a Start and Finish time and Frame Interval in seconds.
When a Span interval starts, a new sub-folder is created in the "stills" parent folder and is named using the start date and time of that Span using a naming format like stills for 11/23/2025_08:00:00
Setting spans allows for shooting only during lights-on periods as well as shooting in consecutive 24-hr loops.
When that Span Interval ends, no more images are written to that sub-folder.
When the next Span Interval starts, it creates a new sub-folder with the start date/time of that Span, and so on and so forth.
This way all of the images for each span are automatically organized into folders which are easier to DL from a remote system using cron or python or whatever automation means you choose.

Currently, the only option for shooting stills is that they all get dumped into one folder, so if you shoot daily spans, you have to manually select thousands of files and copy them in a file manager... it would be so much more faster and efficient to have the option of "daily" image sequence folders.

Currently, my workflow looks something like this:
Setup a samba share on the Mycodo Pi to the /home directory and mount the share on my desktop PC
Use a GUI file manager to manually copy all of the images from the past 24 hours from smb://mycodo.local/root/home/pi/Mycodo/cameras/IPCam/stills to a local working folder on my desktop PC.
Then I perform a batch process using a python script that takes the filename timestamp data from each image and overlays it on the image as a visible timestamp.
Then I take all of the timestamped images and compile them into a timelapse video using a GUI video editor.
Once I have the video, I delete all of the images from the Raspberry Pi's still directory as well as from my PC.
This whole manual process can take as long as 45 minutes, every day.

I now have a Berry script running on the Tasmota IP camera that overlays a timestamp on the captured images, so I've eliminated the need to batch process 6000 images every day just to add a timestamp.

Now I am currently working to completely automate the rest of the process... this is how I would like it to work:
Every day at about 5 minutes after 8am, my PC will run a cron job which calls a python script which will mount the samba share on the Pi and automatically copy only the previous day's image sequence (every image from 8am yesterday to 8 am today) into a local working directory labeled something like "stills MM-DD-YY".
(I know I could use other file copy methods besides samba, like shutil, and am looking into that as well)
It will then verify all the files copied. When verified, it will delete only that image sequence from the Raspberry Pi.
When the copy script has finished, it will call another Python script which will then run an ffmpeg operation on that image sequence, compile it into a time lapse video, and save it into a pre-determined archive directory.
Once I watch the video and make sure it compiled ok... I'll manually delete the remaining image sequence from the PC
This will cut down my hands-on time by almost an hour every day.

However, it would be so much easier to automate this if Mycodo had more capability to pre-organize these daily image sequences into nice neat folders. :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions