Skip to content

timelapse

Pragmatismo edited this page Mar 3, 2024 · 12 revisions

Timelapse tools

Video guide on the timelapse tools - https://www.youtube.com/watch?v=nElWSF5i3jc

The Timelapse Tab

Image Path

Allows you to load an image set.

'open caps folder' will open the currently connected Pigrow's local caps folder.

'select caps set' opens all images in the selected file that start with the same name, for example selection caps_.jpg will open all images starting with caps_.

select caps folder' opens all images in the same folder, this will combine sets starting the the alphabetically first set - note if image sets have different image resolutions you will not be able to render a video, though you might be able to use other tools.

Frame Select

Use Every - allows you to skip frames to speed up the rate the video plays, using every 3rd frame for example will skip two frames out of every three. The frame selection mode allows you how to select which frame out of the group to use, this can help remove bad or erratic frames to cut down flickering.

strict            - uses every Nth frame 
average           - uses the frame that's filesize is closest to the average file size.
rolling average   - uses the frame that's filesize is most average within each set of every N frames. 

This is a modular tool, for information on writing your own script see lower on the page.

Last - Allows you to set a time limit on the frames, limiting to the last hours, days, weeks, etc.

Min File Size - Limits to only files larger than the given size, this can be useful for removing bad or black frames as they generally contain far less data so have a significantly lower filesize. To determine the ideal value the set analyse tool 'filesize' can be useful, it creates a graph of each image in the set's filesize.

Clip Before - don't include any image before the given time, this can be useful if the lamp is timed to come on at 8am for example. Note if the lamp doesn't turn off until 1am then these pictures will also be removed so using min file size or another method would be better.

Clip After - same as clip before but removes any images taken every day after the given time.

Video Settings

Audio - Select an audio file to include in the rendered video.

Credits - Creates a list of extra frames to add to the end of the timelapse, the box next to it sets the time in seconds to show the credits which results in FPS x Seconds extra frames being added.

Some file formats like mp4 might miss the final frames in a video so to ensure it shows the last moments it can be useful to freeze the final frame for a second or two. 'Freeze' will do this, for more complex options see the explanation of writing your own module later on this page.

Render

FPS - the frame rate of the output video, common values are 24, 30, or 60 but for shorter videos where you want to linger on each frame longer 15, 10, 7, etc can be effective.

Outfile - The full path to the desire output file, the extension determines the type of file rendered; .mp4 .gif .avi and others are available check the mpv or ffmpeg documentation for more information.

Render - This uses MPV to render the selected images into a video.

Play - Uses MPV to play the video file, MPV is a great lightweight video player with a huge amount of control mostly through keyboard shortcuts. Crtl-l for example will set it to loop the current playing video, < and > (without shift so actually , and .) will advance or rewind a paused video one frame at a time.

Analyse Set

This is a tool that takes the current set of selected images after the frame select options have been applied and performs the selected analysis which is output as a single image and displayed below the control (click to open it or load where it's saved at .../frompigrow//temp/results_image.png)

This is a modular tool and the default tools will soon be upgraded, for more information on how to edit and create your own modules to analyse the image set details are provided later in this document.

Create Image Set

Overlay Image Set - Allows you to overlay one image set or animated graph / dial onto the current image set, a third image set will be created at the given folder path using the same timestring. Each frame's timestring is read from the filename for both sets and the frame from the overlay set with the closest time to the main set is selected, you can choose to use the closest frame from before the time of the main set's frame, the closest time after the frame or simply the smallest time difference.

Stylise Set - Takes the current set of selected images similar to analyse set but creates an alternate set of modified images saved into the provided folder, these are named with the same datetime as the original set making it easy to overlay as a picture in picture image using the overlay image set tool.

This is a modular tool and the example scripts will be upgraded and added to, information on creating your own stylise set tools is located later in the document.

Capture

In the Camera tab are tools to capture either a short timelapse with a delay between frames less than a minuet or long-duration timelapse using cron.

Creating Modular Tools

Several of the tools are modular and import a simple python function to perform the task, these scripts are found in the timelapse_modules folder. The GUI will automatically read the scripts in this folder using a set naming structure consisting of the type of module followed by an underscore then the module name without any space or special characters, it must saved as a .py file.

.../timelapse_modules/analyse_time.py

for example is loaded into the 'Image Set Analyse' tool drop-down as 'time', this is handed the currently selected set of timelapse images from which it reads the timestamp stored in the file name and creates a graph of how many seconds have elapsed since the first image was taken. The graph is then saved to the output location provided.

While primarily designed to work in the timelapse tab of the gui the tools are also designed to work in the datawall system and other display features so should output an image file rather than display using a gui tool such as matplotlib.show() - though when making a custom script for personal use doing this can work and provide useful functionality.

Timelapse Set Analysis Tools

Reads the currently selected image set and performs some form of analysis then creates a single image which displays the results.

Module naming structure;

.../timelapse_modules/analyse_<name>.py 

Timelapse Stylize Set

This takes a timelapse image set and processes each frame to create another set of images which have gone through some form of processing or stylization.

Module naming structure;

.../timelapse_modules/stylize_<name>.py 

Frame Select Mode

The intended use for this is to remove flickering or bad frames, it can also be used for more complex or obscure frame selection requirements.

Module naming structure;

.../timelapse_modules/selmode_<name>.py 

Credits

Creates frames to extend the rendered video with a frozen last frame or procedurally generated frames.

Module naming structure;

.../timelapse_modules/credits_<name>.py