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.0-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.0-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.0-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.0-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.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for py_gpmf_parser-0.1.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 58024b887865fe1b2f02c4c122daf8a56254f989d612dafcc6297e299a181c09
MD5 459179054f44dea31981978ff9be1aae
BLAKE2b-256 21ca33436ce9885283816ec45ba1fb9b462118a26cf913f2e3ed7fdff2e9f15a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for py_gpmf_parser-0.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9859573d7f7018db91c0dc2999df7204ef2c2fd66718c87bedd8cb3e786003e7
MD5 c532b9a294c0b1fa5706ea3d131bea2f
BLAKE2b-256 6b013e622779fec8407ca10ef8607dd24ca06972545804cef16c38b95762f4a5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for py_gpmf_parser-0.1.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0065cd1875c3a48b35856f94a7aa7067af67b35a2ae870d394ebd4f71a8b59a3
MD5 21ae7e058a7322a006c1d0dfe31ed2ea
BLAKE2b-256 3005504707f14015f6151a976207a9b6b6ef93cbfb89887131e0d584ec12caec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for py_gpmf_parser-0.1.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 88c9b7e24e0779b8237b8d60156e0e6221bd35e1ff32902047c7fa058dba655d
MD5 e7d22266601e9f68c3f1835965c907c4
BLAKE2b-256 d40735420aabca14d36bca1c024c052d534d7aa555054b0078af14428fe0de3b

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