Skip to main content

Python bindings for the gpmf-parser library using pybind

Project description

py-gpmf-parser

Python bindings for the GoPro Metadata Format (GPMF) parser, allowing for easy extraction of telemetry data from GoPro videos.

Overview

This repository offers a Pythonic interface to the GPMF parser, enabling users to extract sensor data like ACCL, GYRO, GPS5, GRAV, and more from GoPro videos.

It provides access to most of the low-level functions (have a look at the src/gpmf_bindings.cpp), but also includes a simple python class to extract the telemetry data. Extending it to more low-level stuff should be easy, just follow the structure that I used.

Installation

To install the package, navigate to the root directory of the repository and run:

git clone --recursive https://github.com/urbste/py-gpmf-parser/
pip install build
python -m build --wheel
pip install dist/*.whl

(Optional) Using uv

If you use uv for environment and dependency management:

uv run setup.py build_ext --inplace
uv sync

Usage

Either extract single streams

filepath 'gpmf-parser/samples/max-heromode.mp4'
from py_gpmf_parser.gopro_telemetry_extractor import GoProTelemetryExtractor
extractor = GoProTelemetryExtractor(filepath)
extractor.open_source()
accl, accl_t = extractor.extract_data("ACCL")
gps, gps_t = extractor.extract_data("GPS5")
extractor.close_source()

or write multiple of them to a json file

extractor = GoProTelemetryExtractor(filepath)
extractor.extract_data_to_json(os.path.basename(filepath)+".json", 
                                ["ACCL", "GYRO", "GPS5", "GRAV", "MAGN", "CORI", "IORI"])
extractor.close_source()

To-Do List

  • publish package
  • document

Acknowledgements

This is my first project using ChatGPT4 to create Python bindings for a C library. I learned a lot in the process. I do have some experience with pybind11, however, this C library was challenging due to the use of pointers (especially the GPMF_stream struct). ChatGPT4 was able to solve all the hurdles in the process. I had to iterate some prompts and also prompt with specific errors, but in the end we figured it out ;) It also created the pip-publish.yml file to automatically publish the wheel on PyPI. It took me about 6-7 hours to write the library, which I would say is probably half of the time it would have taken me without ChatGPT.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

py_gpmf_parser-0.1.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

py_gpmf_parser-0.1.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

py_gpmf_parser-0.1.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

py_gpmf_parser-0.1.1-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

File details

Details for the file py_gpmf_parser-0.1.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for py_gpmf_parser-0.1.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4388b321e5d3d85614bb31650b17bddcf858ebae0f86c7c4a0ea81ccdf1dd085
MD5 eaee32c83c2d582785bcf8d4ee48322d
BLAKE2b-256 9f8bc3d5ea5ff587bb84f5b2f6a896b0a7c7b42e49db763f3b4f882aa686e2f7

See more details on using hashes here.

File details

Details for the file py_gpmf_parser-0.1.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for py_gpmf_parser-0.1.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1d874a1c4925ab371ccc2a5375257478f39ed84a7c8cc3eb8994a2933d4b8693
MD5 f6a6661e57896ea9632671506defac49
BLAKE2b-256 4555b7d06b5fb83652479f95bd41468642b18b8c0614dd1791dd4f585fcf1af3

See more details on using hashes here.

File details

Details for the file py_gpmf_parser-0.1.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for py_gpmf_parser-0.1.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 993836967dc540f8419e69b94e23599944f71f70ffdc0b2c8ee1db037bd4cfbd
MD5 3ca973427f29a38394d41332c62be7e9
BLAKE2b-256 5e0b2a00e75a281c0de0839a1e210eebee566cc62c35d59264c8fe00b6c75df3

See more details on using hashes here.

File details

Details for the file py_gpmf_parser-0.1.1-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for py_gpmf_parser-0.1.1-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 707d2b8e7aa93ed054082bc84965e4d9ed7a20221a2b3e3c95b694fca4d83356
MD5 cac54fa4333468829d356150444866fa
BLAKE2b-256 e3ea63b4b71949417e3ef7bc0a57f4899f2a21b688daee75840a395d99218da4

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