https://github.com/noviceiii/timelapse
Script and config to create timelapse videos with text overlay on a raspberry pi.
https://github.com/noviceiii/timelapse
ffmpeg netatmo raspberrypi timelapse youtube
Last synced: 4 months ago
JSON representation
Script and config to create timelapse videos with text overlay on a raspberry pi.
- Host: GitHub
- URL: https://github.com/noviceiii/timelapse
- Owner: noviceiii
- Created: 2024-12-11T21:17:27.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-10T21:38:38.000Z (over 1 year ago)
- Last Synced: 2025-02-18T21:01:57.841Z (over 1 year ago)
- Topics: ffmpeg, netatmo, raspberrypi, timelapse, youtube
- Language: Shell
- Homepage: https://www.youtube.com/playlist?list=PLcnGcU-Z-RJ1uRxLbBiHb2feVr6tQzJVj
- Size: 193 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Raspi Time Lapse Script
This Bash script automates the process of creating a time-lapse video from sunrise to sunset, adding a text overlay with various information, backing up the video to a remote server, and uploading it to YouTube. Absolutely no warranty for anything given.
## Features
- **Time-Lapse Capture**: Uses libcamera for capturing images.
- **Config File**: Includes a config file for clean settings.
- **Placeholders**: Certain strings can be set by placeholders and dynamically updated, e.g., for a YouTube description or title.
- **Text Overlay**: Adds date, time, sunrise/sunset times, weather conditions, and system temperature to each image.
- **Dynamic Timing**: Starts capturing images based on sunrise with an offset and stops after sunset with an offset.
- **Fixes Timing**: Set start or end date according to events on certain days, recuring dates or fixed schedules.
- **Remote Backup**: Optionally uploads the video to a Linux server via SCP.
- **Netatmo Integration**: Optionally reads weather information from a weather text file: Netatmo Weather.
- **YouTube Integration**: Optionally uploads the video to YouTube with custom title and description placeholders: YouTube Upload.
- **Time Override**: Overrides start and end times based on configurations in config.cfg, including descriptive text for overrides.
## Prerequisites
- Raspberry Pi with Bash shell
- libcamera installed for image capture
- A font file for the text overlay
- hdate for calculating sunrise/sunset times
- ffmpeg for video creation and text overlay
- Netatmo script for weather lookups (if enabled)
- Python and the youtube-upload script for YouTube uploads (if enabled)
## Configuration
- **config.example.cfg**: Contains all configurable parameters for the script. Rename to **config.cfg**
- **DEBUG**:
- `debug`: Enables debug mode, which limits the number of pictures taken.
- `z`: Number of pictures to take in debug mode.
- `FORCE_SCP_UPLOAD` and `FORCE_YT_UPLOAD`: Forces uploads in debug mode.
- **SCRIPT SETTINGS**:
- `INTERVAL`: Time interval between captures.
- `offSTART`, `offEND`: Time offset for starting before sunrise and ending after sunset.
- `RESW`, `RESH`: Image resolution.
- `DT`: Display time for each image in the video.
- `vidpref`: Prefix for the video file name.
- `LONG`, `LAT`, `TIZO`: Location settings for time calculations. TIZO is the hour offset of your UTC time. E.g., 1 for UTC+1.
- `TDIR`: Temporary directory for image storage.
- `FPATH`: Path to the font file for the text overlay.
Get the longitude and latitude from [here](https://latitudelongitude.org/map-address-latlong) in decimal format.
- **WEATHER**: Optionally include weather information in the overlay generated by this script: Netatmo Weather.
- **LOCAL SERVER PATH**: SCP settings for remote backup (optional).
- **YOUTUBE**: Optional. Settings for YouTube upload, including placeholders for dynamic content in titles and descriptions. Use this script for uploads: YouTube Upload.
- **Override Times**:
- `override_times`: An array of strings to override start and end times with additional descriptive text.
## Placeholders for YouTube Title, Description, and Script Text
- `[SUNRISE]`: Replaced with the time of the sunrise (`$tsunrise`).
- `[FIRSTLIGHT]`: Replaced with the time of the first light (`$first_light`).
- `[START-OFFSET]`: Replaced with the time of the offset to the sunrise or first light (`$offSTART`).
- `[SUNSET]`: Replaced with the time of the sunset (`$tsunset`).
- `[SUNSET-OFFSET]`: Replaced with the time of the offset to the sunset (`$offEND`).
- `[IMAGE-COUNT]`: Number of images created (`$i`).
- `[IMAGE-COUNT-FORMATED]`: Number of images created with leading zero (`$formatted_i`).
- `[INTERVAL]`: Interval at which pictures are taken (`$INTERVAL`).
- `[HEIGHT]`: The height of the image (`$RESH`).
- `[WIDTH]`: The width of the image (`$RESW`) - Note: in the code, this is referred to as LENGTH.
- `[FRAMERATE]`: The framerate used (`$fr`).
- `[FORMATTED_DATE]`: Formatted date as dd.mm.yyyy (`$tsfriendly`).
- `[FORMATED_DATETIME]`: Replaced with the value of the variable ts (`$tsoverlay`).
- `[INT-TEMP]`: Internal Temperature of device (`$obrdtmp`).
- `[WEATHER]`: Weather information if enabled (`$weather`).
- `[LATITUDE]`: Latitude of the location (`$LAT`).
- `[LONGITUDE]`: Longitude of the location (`$LONG`).
- `[PLAYLIST]`: YouTube playlist name or ID (`$PLAYLIST`).
- `[YOUTUBE-CATEGORY]`: YouTube video category (`$YOUTUBE_CATEGORY`).
- `[YOUTUBE-LANGUAGE]`: Language of the YouTube video (`$YOUTUBE_LANGUAGE`).
- `[YOUTUBE-PRIVACY]`: Privacy status for the YouTube video (`$YOUTUBE_PRIVACY`).
- `[YOUTUBE-TAGS]`: Tags for the YouTube video (`$YOUTUBE_TAGS`).
- `[EVENT-DESCRIPTION]`: Description text for time override events (`$description`).
## Usage
### Setup
1. Adjust the `config.cfg` according to your environment and preferences. Rename the example `config.example.cfg` to `config.cfg` to start with.
2. Ensure all necessary software is installed.
### Run the Script
```bash
./pilapse.sh
```
### Output
- Images are stored in a timestamped folder in `/tmp`.
- A video is created from these images with a text overlay.
- Optionally, the video is uploaded to a server or YouTube.
## Troubleshooting
If the script fails to start or operate, check if `config.cfg` exists at the correct path. Ensure all permissions are set correctly for script execution and file writing.
## Acknowledgments
Thanks to the authors of libcamera, ffmpeg, hdate, and the youtube-upload script for their contributions to open-source software.