Skip to main content

A module to read GPMF data embedded in GoPro video files.

Project description

pygpmf

A python Module to extract GPMF information from Videos

More information on the format is available on the GoPro GitHub page.

The primay aim of this project was to be able to extract GPS tracks from GoPro video files, so the GPS part is more tested.

We use python-ffmpeg to extract the GPMF stream from video files.

import gpmf

# Read the binary stream from the file
stream = gpmf.io.extract_gpmf_stream(my_file)

# Extract GPS low level data from the stream
gps_blocks = gpmf.gps.extract_gps_blocks(stream)

# Parse low level data into more usable format
gps_data = list(map(gpmf.gps.parse_gps_block, gps_blocks))

We rely on gpxpy to easily convert GPS data into GPX segments:

import gpxpy

gpx = gpxpy.gpx.GPX()
gpx_track = gpxpy.gpx.GPXTrack()
gpx.tracks.append(gpx_track)
gpx_track.segments.append(gpmf.gps.make_pgx_segment(gps_data))

print(gpx.to_xml())
<?xml version="1.0" encoding="UTF-8"?>
<gpx xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd" version="1.1" creator="gpx.py -- https://github.com/tkrajina/gpxpy">
  <trk>
    <trkseg>
      <trkpt lat="44.1287283" lon="5.427715">
        <ele>833.759</ele>
        <time>2020-07-03T12:36:56.940000Z</time>
        <sym>Square</sym>
        <fix>3d</fix>
        <pdop>1.82</pdop>
        <extensions>
          <speed_2d>
            <value>9.221</value>
            <unit>m/s</unit>
          </speed_2d>
          <speed_3d>
            <value>9.25</value>
            <unit>m/s</unit>
          </speed_3d>
        </extensions>
      </trkpt>
      ...
    </trkseg>
  </trk>
</gpx>

You can also make an image from you gps track:

import gpmf

# Read the binary stream from the file
stream = gpmf.io.extract_gpmf_stream(my_file)
gpmf.gps_plot.plot_gps_trace_from_stream(stream)

GPS Track Image

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

gpmf-0.1.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

gpmf-0.1-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

Details for the file gpmf-0.1.tar.gz.

File metadata

  • Download URL: gpmf-0.1.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.2

File hashes

Hashes for gpmf-0.1.tar.gz
Algorithm Hash digest
SHA256 033403643f60cba3ff8bb3382afb5d06b2d566b438c57486ddbac538ca44373b
MD5 4b185f0f3f0934789fbaf94c08f81756
BLAKE2b-256 0e23f64b9fa8faae79127263f1d7190ce5b239b8778d56e34c8e25c3dca20847

See more details on using hashes here.

File details

Details for the file gpmf-0.1-py3-none-any.whl.

File metadata

  • Download URL: gpmf-0.1-py3-none-any.whl
  • Upload date:
  • Size: 16.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.2

File hashes

Hashes for gpmf-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bf497aa0d3650b3dd3b58a0f15d2166ee5fcdd1708e3404706309bf653b1d447
MD5 7cc0a58ce120834f10ab69c77b899cdb
BLAKE2b-256 7d43cf34920c74b169167d686f9e5a315c42316dde8a50d28abac6cff2a154c1

See more details on using hashes here.

Supported by

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