Skip to main content

Extract GPS and sensor telemetry from dashcam videos

Project description

dashcam-telemetry

Extract GPS and sensor telemetry from dashcam videos.

PyPI version Python 3.10+ License: MIT

Features

  • Extract GPS data from dashcam MP4 videos
  • Multiple export formats: GPX, GeoJSON, KML, CSV
  • Auto-detection of dashcam format
  • Synchronized video/map viewer for verification
  • Python API for integration into other projects

Supported Dashcams

Brand Format Status
REDTIGER YOUQINGGPS  Supported
WolfBox YOUQINGGPS  Supported
Other YOUQING-based YOUQINGGPS  Supported

Installation

pip install dashcam-telemetry

Or with uv:

uv add dashcam-telemetry

Quick Start

Command Line

# Extract GPS to GPX (default)
dashcam-telemetry extract video.mp4 -o track.gpx

# Extract to GeoJSON
dashcam-telemetry extract video.mp4 --format geojson -o track.json

# Show file info
dashcam-telemetry info video.mp4

# Batch processing
dashcam-telemetry extract *.mp4 --output-dir ./tracks/

# Launch synchronized video/map viewer
dashcam-telemetry view video.mp4

Python API

from dashcam_telemetry import extract_telemetry

# Extract GPS data
track = extract_telemetry("dashcam_video.mp4")
print(f"Found {len(track)} GPS points")

# Export to various formats
track.to_gpx("output.gpx")
track.to_geojson("output.json")
track.to_kml("output.kml")
track.to_csv("output.csv")

# Access individual points
for point in track:
    print(f"{point.timestamp}: {point.latitude}, {point.longitude}")

# Get track metadata
print(f"Duration: {track.duration} seconds")
print(f"Bounds: {track.bounds}")

With pandas

pip install dashcam-telemetry[pandas]
from dashcam_telemetry import extract_telemetry

track = extract_telemetry("video.mp4")
df = track.to_dataframe()

# Now you can use pandas for analysis
print(df.describe())
df.to_parquet("telemetry.parquet")

Export Formats

Format Extension Use Case
GPX .gpx Strava, Garmin, Komoot, most GPS apps
GeoJSON .json Leaflet, Mapbox, PostGIS, web mapping
KML .kml Google Earth, Google Maps
CSV .csv Spreadsheets, data analysis

CLI Reference

dashcam-telemetry <command> [options]

Commands:
  extract    Extract GPS data from video files
  info       Show information about a video file
  formats    List supported formats
  view       Launch synchronized video/map viewer

Extract options:
  -o, --output      Output file path
  -f, --format      Output format: gpx, geojson, kml, csv (default: gpx)
  --output-dir      Output directory for batch mode
  -v, --verbose     Verbose output
  --skip-invalid    Skip invalid GPS points

Data Model

@dataclass
class GPSPoint:
    latitude: float       # Decimal degrees
    longitude: float      # Decimal degrees
    timestamp: datetime   # UTC timestamp
    speed: float          # km/h
    heading: float        # Degrees from north
    altitude: float       # Meters (optional)
    fix_quality: int      # 0=invalid, 1=GPS, 2=DGPS
    gsensor_x: float      # Accelerometer X (optional)
    gsensor_y: float      # Accelerometer Y (optional)
    gsensor_z: float      # Accelerometer Z (optional)

@dataclass
class GPSTrack:
    points: list[GPSPoint]
    source_file: str
    device_info: dict

Development

# Clone repository
git clone https://github.com/oldhero5/dashcam-telemetry
cd dashcam-telemetry

# Install with dev dependencies
uv sync --dev

# Run tests
uv run pytest

# Run linter
uv run ruff check src/

# Type check
uv run mypy src/

Adding New Parsers

To add support for a new dashcam format:

  1. Create a new parser in src/dashcam_telemetry/parsers/
  2. Inherit from BaseParser
  3. Implement can_parse() and parse() methods
  4. Register in parsers/__init__.py
from dashcam_telemetry.parsers.base import BaseParser
from dashcam_telemetry.models import GPSTrack

class MyDashcamParser(BaseParser):
    @property
    def name(self) -> str:
        return "MyDashcam"

    @property
    def formats(self) -> list[str]:
        return ["MyDashcam", "BrandX"]

    def can_parse(self, filepath: Path) -> bool:
        # Check if file contains your format's markers
        ...

    def parse(self, filepath: Path) -> GPSTrack:
        # Extract GPS data
        ...

License

MIT License - see LICENSE for details.

Contributing

Contributions welcome! Please open an issue or PR.

Acknowledgments

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

dashcam_telemetry-0.1.0.tar.gz (76.1 kB view details)

Uploaded Source

Built Distribution

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

dashcam_telemetry-0.1.0-py3-none-any.whl (24.1 kB view details)

Uploaded Python 3

File details

Details for the file dashcam_telemetry-0.1.0.tar.gz.

File metadata

  • Download URL: dashcam_telemetry-0.1.0.tar.gz
  • Upload date:
  • Size: 76.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dashcam_telemetry-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a5bff84dc452da753a7d2959f2fd576678fb1cd5c144738ad753c5a1838e79c2
MD5 3ab7b24ec4091ef549b4c28161773e22
BLAKE2b-256 11c9881d456c5e007164fd0a740000b66bfd98107dbfabda38e61688a01c45fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for dashcam_telemetry-0.1.0.tar.gz:

Publisher: publish.yml on oldhero5/dashcam-telemetry

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dashcam_telemetry-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for dashcam_telemetry-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e9e7997346b8e97fa97bbafd64958d30b8d3db9db9b649576c866e130a21ff3c
MD5 c58422a261bb1684956097598788621e
BLAKE2b-256 265c4e06910b45865a409986411bbeb145ee7e87b421acc93820c6d8486777b3

See more details on using hashes here.

Provenance

The following attestation bundles were made for dashcam_telemetry-0.1.0-py3-none-any.whl:

Publisher: publish.yml on oldhero5/dashcam-telemetry

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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