Skip to main content

Python CLI tool for generating depth tracking overlays for your dive footage from exported dive computer logs.

Project description

depthviz: Transform your freediving footage with depth tracking

PyPI - Version License GitHub Actions Workflow Status Coveralls PyPI - Status

[!NOTE] This project is in active development. Feel free to open an issue for any feedback or feature requests.

depthviz makes it easy to add dynamic depth tracking, giving your viewers a deeper understanding of your underwater sensation. It is a command-line tool for generating depth overlay videos from the data recorded by your dive computer. It processes your dive log and creates a video that visualizes the depth over time.

depthviz DEMO

This allows you to create more informative and engaging dive videos, enriching the storytelling experience for both yourself and your audience. Click here to watch a sample video.

[!TIP] For performance freedivers, you can incorporate depthviz into your dive analysis. By visualizing your dive profile, you can identify areas for improvement and track your progress over time.

Installation

Prerequisites:

  • Python (3.9 or higher) installed on your system.
  • pipx for installing Python CLI tools.

Installation:

pipx install depthviz

Usage

1. Download Your Data:

Export your dive log data from your dive computer or diving application. See the source options below for supported formats.

2. Generate the Overlay:

depthviz -i <input_file> -s <source> -o <output_video.mp4>

Arguments:

  • -i, --input <input_file>: Path to your file containing your dive log.
  • -s, --source <source>: Source of the dive computer data. See the table below for supported sources.
  • -o, --output <output_video.mp4>: Path or filename for the generated video with the depth overlay. The output file format must be .mp4.

Source Options:

Source Description File type Development Status
apnealizer Data exported from Apnealizer, logging and analyzing application. CSV :white_check_mark: Supported
shearwater Data exported from Shearwater dive computers. XML :white_check_mark: Supported
garmin Data exported from Garmin dive computers. - :x: Sample data needed :rotating_light:
suunto Data exported from Suunto dive computers. - :x: Sample data needed :rotating_light:
manual Manually input the dive data, for those who don't have a dive computer. - :construction: Under development

Example:

Example of generating a depth overlay video named depth_overlay.mp4 using data from my_dive.xml exported from Shearwater dive computers (source: shearwater).

depthviz -i my_dive.xml -s shearwater -o depth_overlay.mp4

3. Integrate with Your Footage:

Import the generated overlay video into your preferred video editing software and combine it with your original dive footage. Adjust the blending and position of the overlay to suit your video style.

Watch this tutorial on how to import an overlay video in CapCut Desktop.

How It Works

depthviz works by parsing dive log data exported from various dive computers and generating an overlay video that displays depth information.

Dive computers typically record either depth directly or pressure data. If the data is recorded as pressure, it is in the form of absolute pressure, which includes both atmospheric pressure and the pressure exerted by the water itself (hydrostatic pressure).

To determine the depth, depthviz uses the following approach:

  1. If the dive log contains depth data directly: depthviz uses this data directly.
  2. If the dive log contains pressure data:
    • First, the hydrostatic pressure is calculated by subtracting atmospheric pressure (collected during the surface interval or dive start) from the absolute pressure:


    • Then, the fluid pressure formula is used to calculate the depth:

      Where:
      • $P$ is the fluid pressure,
      • $\rho$ is the density of the fluid (water),
      • $g$ is the acceleration due to gravity (9.80665 m/s²),
      • $h$ is the height (or depth) of the fluid column (what we want to calculate).
    • Rearranging the formula to solve for depth ($h$):


Currently, depthviz uses a water density ($\rho$) according to the EN13319 standard, a European CE standard for dive computers, which assumes a water density of 1019.7 kg/m³.

The water density can vary depending on the type of water (e.g., freshwater, saltwater). Even different locations in the ocean can have varying densities. This variability can affect the accuracy of depth calculations. For more precise measurements, users may need to adjust the density value based on their specific diving environment. Especially for freshwater diving, the water density is lower than the standard value, which can lead to depth overestimation. We will add support for custom water density in future releases.

[!NOTE] The EN13319 standard ensures the accuracy and reliability of depth measurements in dive computers. For more information, you can refer to the EN13319 standard.

The steps involved in generating the depth overlay video are as follows:

  1. Parse Dive Log Data: The dive log data is parsed to extract time and either depth or pressure information.
  2. Calculate Depth (if necessary): If the dive log contains pressure data, the depth is calculated using the hydrostatic pressure equation and the fluid pressure formula with the EN13319 water density standard.
  3. Generate Overlay Video: An overlay video is generated that displays the depth information at the corresponding times.

Contribution

We welcome contributions to the depthviz project! If you have any ideas for improvement, bug fixes, or feature suggestions, feel free to open an issue to discuss or submit a pull request.

Help Us Expand Dive Computer Support!

Missing your dive computer? Help us add support! Submit a Dive Computer Support Request issue with your dive log file and export source.

By providing this information, you'll be helping us understand the specific format of your dive computer's exported data. This allows us to implement the necessary parsing logic and add support for your device in a future release.

License

This project is licensed under the Apache License 2.0. See the LICENSE file for details.

CycloneDX SBOM

This project provides a CycloneDX Software Bill of Materials (SBOM) in JSON format. The SBOM is generated by the GitHub Actions workflow and is available as an artifact for each release. The SBOM is generated using the cyclonedx-python library.

Contact

For any inquiries, please open an issue. We'd love to hear from you!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

depthviz-0.3.0a1.tar.gz (3.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

depthviz-0.3.0a1-py3-none-any.whl (3.7 MB view details)

Uploaded Python 3

File details

Details for the file depthviz-0.3.0a1.tar.gz.

File metadata

  • Download URL: depthviz-0.3.0a1.tar.gz
  • Upload date:
  • Size: 3.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.0 CPython/3.10.15 Linux/6.8.0-1017-azure

File hashes

Hashes for depthviz-0.3.0a1.tar.gz
Algorithm Hash digest
SHA256 14d557aaef2d992a68031fe3a5ab62554a9a7842275e021a7da4cacfd7c1e449
MD5 72c2744d2bdffecc5e37f5b1047cc002
BLAKE2b-256 ad6095f114c8ca990362ceca880acc80bd5531430d2b67e27adda2e3f2939ceb

See more details on using hashes here.

File details

Details for the file depthviz-0.3.0a1-py3-none-any.whl.

File metadata

  • Download URL: depthviz-0.3.0a1-py3-none-any.whl
  • Upload date:
  • Size: 3.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.0 CPython/3.10.15 Linux/6.8.0-1017-azure

File hashes

Hashes for depthviz-0.3.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 cc60c82e92b5fd54663329e6bb5972f6aab60069e5bc3ead7dcce0f614d08344
MD5 b52908bd8093f4637421125e75b90174
BLAKE2b-256 082d0c7fce562550eede30fc63e6aec479a06ac872f5cf58730b779befdc86a6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page