This Timelapse PowerShell Script is an automated solution for capturing images from a PC and webcam at set intervals and turning them into a timelapse video. It runs in the background, manages files automatically, and even restarts itself if necessary. For Windows 10/11
- Takes pictures at set intervals (seconds or minutes).
- Works with most webcams at high resolutions.
- Captures PNG lossless quality images for the best output.
- Converts captured images into MP4 video using FFmpeg after each recording session.
- Automatically removes dark/black frames for better quality.
- Adjustable sensitivity setting from 0 to 255:
- 0: No images are removed.
- 1: Removes the darkest images.
- 20: A good starting point for most users.
- Increasing the number makes it more sensitive, removing progressively lighter dark images.
- Useful for plant timelapses, removing night-time images for a cleaner final video.
- Helps eliminate accidental black frames that can appear during a capture session.
- If enabled, the script will automatically restart if it crashes or is accidentally closed, and it will immediately resume recording.
- If your computer reboots, the script will start itself and begin recording automatically with no user input required.
- Ensures continuous operation without manual intervention.
- If enabled, merges multiple videos into a master video once a set limit is reached.
- Can be set to automatically restart after a specified amount of time (minutes, hours, or days) to ensure uninterrupted operation.
- Live camera preview with a fullscreen preview option.
- All necessary controls including:
- Start/Stop recording.
- Set camera resolution.
- Configure capture intervals.
- Adjust final video framerate.
- Additional customizable settings.
- Estimates the total number of frames captured based on the selected capture interval and capture duration.
- Displays the estimated final video duration based on the chosen framerate.
- Displays the estimated final video size.
- Helps users plan their time-lapse sessions efficiently.
Parameter | Value |
---|---|
Capture Interval | 10 seconds |
Capture Duration | 2 hours (7200 seconds) |
Total Frames Captured | 720 frames |
Final Video Framerate | 30 FPS |
Final Video Duration | 24 seconds |
Estimated Video Size | ~XX MB (based on resolution and compression settings) |
Explanation:
- The script captures an image every 10 seconds.
- Over a 2-hour duration, there are 7200 seconds.
- The total frames captured would be 7200 seconds / 10 seconds = 720 frames.
- If the final video is set to 30 frames per second (FPS), the resulting time-lapse video will be 720 frames / 30 FPS = 24 seconds long.
- The estimated file size depends on resolution, quality, and compression settings.
- Keeps a log of all actions for troubleshooting and review.
- FFmpeg: Must be installed and added to the system PATH.
- AForge.NET Framework: Required for webcam functionality.
- PowerShell: Version 5.1 and 7 or later.
- Webcam: Any compatible webcam.
- The window may appear unresponsive during video creation and video merging. This is a normal temporary freeze until the process completes.
- Avoid capturing more than 2000 images per video to prevent excessive memory usage and potential script crashes.
- Keep the number of merged videos low to avoid script instability.
- Auto Restart and Auto Merge Video options can help manage large files efficiently.
- Currently working on improving stability for handling larger image and video sets.
- Click the green "Code" button on the repository page and download the .zip file.
- Your browser may flag the file as "Not Trusted." If this happens:
- Click Keep when prompted.
- Then, select Keep Anyway to allow the download.
- Extract the Files:
- Locate the downloaded .zip file and extract it to your desired location.
- Run the Installer:
- Find Masterlapse Installer.exe inside the extracted folder.
- Double-click to launch it.
- Follow all prompts—no changes are necessary during installation.
- Open the Application via Desktop Shortcut.
- You can Delete the downloaded ".zip" and "extracted" folders now.
- Ensures it is running in Windows PowerShell 5.1.
- Requests Administrator privileges if needed.
- Installs FFmpeg if not already installed.
- Installs PowerShell 7 if not already installed.
- Installs AForge.NET Framework (2.2.5) if not already installed.
- Creates and configures scheduled tasks to ensure auto-restart functionality.
- Adds a Desktop Shortcut for quick access.
-
Install PowerShell 7
winget install Microsoft.Powershell --silent
-
Install FFmpeg
winget install ffmpeg
-
Install AForge.NET Framework
- Download AForge.NET Framework from the official AForge.NET Downloads page.
- Install version 2.2.5 using the provided installer.
- Note: Use the default installation path.
-
Ensure Folder Placement
- Place the Timelapse folder (which contains Images, Videos, Logs Folders, and a .ICO) in:
C:\Users\User
- Replace "User" with your actual Windows username and delete the DELETE.txt files inside each Images, Videos, and Logs Folder.
- Place the Timelapse folder (which contains Images, Videos, Logs Folders, and a .ICO) in:
-
Ensure Folder Placement
- Copy the Timelapse folder from Step 4 and paste it in:
C:\Program Files (x86)
- Delete the Images, Videos, and Logs folders. This folder should only contain a .ico image.
- Copy the Timelapse folder from Step 4 and paste it in:
-
Ensure Script Placement
- Place
TimeLapse-v1.0.0.ps1
in:C:\Program Files (x86)\Timelapse
- Place
-
Start the Script Manually
cd "C:\Program Files (x86)\Timelapse" .\TimeLapse-v1.0.0.ps1
- No Webcam Detected: Ensure your webcam is connected and recognized by the system. Verify AForge.NET is properly installed.
- FFmpeg Not Found: Confirm FFmpeg is installed and added to the system PATH.
- Permissions Error: Run PowerShell as Administrator to ensure proper access.
- Camera Not Switching: Ensure the selected device is not in use by another application.
This project is licensed under the MIT License.
- AForge.NET Framework for camera handling.
- FFmpeg for video encoding.
Author: x1HANDEDBILLS - For questions or support, please open an issue or contact me via GitHub.