Skip to content

noviceiii/timelapse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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.
  • 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.

Prerequisites

  • Raspberry Pi with Bash shell
  • libcamera installed for image capture
  • font you need 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.cfg: Contains all configurable parameters for the script.

  • 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.
    • TDIR: Temporary directory for image storage.
    • FPATH: Path to the font file for the text overlay.
  • 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.

Placeholders for YouTube Title and Description

  • [SUNRISE]: Replaced with the time of the sunrise ($tsunrise).
  • [SUNRISE-OFFSET]: Replaced with the time of the offset to the sunrise ($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 ($INTERVALL).
  • [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 ($LATITUDE).
  • [LONGITUDE]: Longitude of the location ($LONGITUDE).
  • [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).

Usage

  1. Setup:

    • Adjust the config.cfg according to your environment and preferences. Rename the example config.example.cfg to config.cfg to start with.
    • Ensure all necessary software is installed.
  2. Run the Script:

    ./pilapse.sh
  3. 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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages