A module to read GPMF data embedded in GoPro video files. Modernized fork with Python 3.9+ and Windows support.
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)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pygpmf_oz-0.2.0.tar.gz.
File metadata
- Download URL: pygpmf_oz-0.2.0.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9be5c44225f44c7426688f7271a55cfa401bfd6fba00b9d19227d61617067a14
|
|
| MD5 |
06f27d8b7fe7282fcd321f8019d78d1f
|
|
| BLAKE2b-256 |
35c388fbf7a3bded853b444f74b03b1734d859dd415d58a47fe42f3b21a7e496
|
File details
Details for the file pygpmf_oz-0.2.0-py3-none-any.whl.
File metadata
- Download URL: pygpmf_oz-0.2.0-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88d9c7ab5260f633f89a5e43d50b9715e99f2c63355f1b16d8dd09b905de0198
|
|
| MD5 |
55ef175eb5630b43a48e7ab1d4b98d62
|
|
| BLAKE2b-256 |
ff4a09fcef8879fa7a6a087eebe45894aa2a087bea467baa4bf157399634674d
|