Skip to main content

boltseeker

boltseeker is a command-line tool that detects and extracts frames containing lightning bolts from storm videos. It uses frame differencing and blob detection to identify sudden, spatially coherent brightness changes while ignoring persistent light sources like house lights and street lamps that don't change between frames.

How it works

For each consecutive frame pair, boltseeker computes an absolute difference image and thresholds it to isolate changed pixels. Morphological dilation merges nearby changes into coherent regions (blobs). A frame is flagged when at least one blob meets two conditions: its area exceeds a minimum size (ruling out raindrops and noise), and the mean luminance within the blob's contour in the current frame exceeds a minimum value (ruling out dark blobs from cloud or rain movement).

Installation

pip install boltseeker

Usage

usage: boltseeker [-h] [-o OUTPUT_DIR] [-d DIFF_THRESHOLD] [-a MIN_BLOB_AREA] [-l LUMINANCE_THRESHOLD] [-p PADDING] [--no-save]
                  video

Detect and extract lightning frames from a storm video.

positional arguments:
  video                 Path to the input video file.

options:
  -h, --help            show this help message and exit
  -o OUTPUT_DIR, --output-dir OUTPUT_DIR
                        Directory to save extracted frames. (default: lightning_frames)
  -d DIFF_THRESHOLD, --diff-threshold DIFF_THRESHOLD
                        Minimum per-pixel absolute difference (0-254) between consecutive frames to count a pixel as changed.
                        Raise this to ignore gradual changes like slow cloud movement or rain. (default: 25)
  -a MIN_BLOB_AREA, --min-blob-area MIN_BLOB_AREA
                        Minimum area in pixels of a connected changed region to consider. Raise this to filter out small
                        transient changes like raindrops or noise. (default: 500)
  -l LUMINANCE_THRESHOLD, --luminance-threshold LUMINANCE_THRESHOLD
                        Minimum mean luminance (0-254) within a blob's contour mask in the current frame. Filters out dark blobs
                        caused by cloud or rain movement. (default: 80)
  -p PADDING, --padding PADDING
                        Extra frames to save before/after each hit (>= 0). Ignored with --no-save. (default: 1)
  --no-save             Detect only; do not write any image files. (default: False)

Examples

# Basic usage
boltseeker storm.mp4

# Save to a custom directory
boltseeker storm.mp4 -o ~/bolts

# Detect only, no output files
boltseeker storm.mp4 --no-save

# More sensitive detection
boltseeker storm.mp4 -d 15 -l 60

# Less sensitive detection
boltseeker storm.mp4 -d 40 -a 1000

Output

Detected frames are saved as JPEG files named frame_NNNNNN_lightning.jpg. Padding frames saved around each hit are named frame_NNNNNN_padding.jpg. The terminal output lists each flagged frame with its index and timestamp as the video is scanned.

Tuning

Run with --no-save first to see which frames are flagged and at what timestamps before committing to saving files. The three detection parameters are independent:

  • If dark frames from cloud movement are being saved, raise --luminance-threshold.
  • If small rain or noise artefacts trigger false positives, raise --min-blob-area.
  • If slow-moving clouds cause false positives, raise --diff-threshold.
  • If faint or distant bolts are being missed, lower --diff-threshold or --luminance-threshold.

Metadata

Release files for boltseeker 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for boltseeker 0.1.0
File Size Uploaded Provenance Actions
boltseeker-0.1.0.tar.gz 9.8 kB Without provenance Details for boltseeker-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for boltseeker 0.1.0
File Interpreter ABI Platform Actions
boltseeker-0.1.0-py3-none-any.whl Python 3 none any Details for boltseeker-0.1.0-py3-none-any.whl

Total release size: 17.4 kB

Release files / boltseeker-0.1.0.tar.gz

Download URL boltseeker-0.1.0.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
7a15cab0a4c2009fd85389dcd433c4179a84ad898fac99d605d4aad0686754b2
BLAKE2b-256 checksum
How to use checksums
12e9a0943f9520780f2fd4cc01be0557ac4583e65cc217a4617b3dfdc185b17b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Hatch/1.17.0 {"ci":null,"cpu":"x86_64","distro":{"id":"noble","libc":{"lib":"glibc","version":"2.39"},"name":"Ubuntu","version":"24.04"},"implementation":{"name":"CPython","version":"3.12.3"},"installer":{"name":"hatch","version":"1.17.0"},"openssl_version":"OpenSSL 3.0.13 30 Jan 2024","python":"3.12.3","system":{"name":"Linux","release":"6.8.0-124-generic"}} HTTPX2/2.3.0

Release files / boltseeker-0.1.0-py3-none-any.whl

Download URL boltseeker-0.1.0-py3-none-any.whl
Size 7.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3678d4995a257b7996338e45295fcbdb50ccbc5bd64ab45eac5409166b54072c
BLAKE2b-256 checksum
How to use checksums
056ec3d7e236e96e4ff302f1ab246ff16020dab03648a8de99c490cb3faa8d08
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Hatch/1.17.0 {"ci":null,"cpu":"x86_64","distro":{"id":"noble","libc":{"lib":"glibc","version":"2.39"},"name":"Ubuntu","version":"24.04"},"implementation":{"name":"CPython","version":"3.12.3"},"installer":{"name":"hatch","version":"1.17.0"},"openssl_version":"OpenSSL 3.0.13 30 Jan 2024","python":"3.12.3","system":{"name":"Linux","release":"6.8.0-124-generic"}} HTTPX2/2.3.0

Security for boltseeker 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page