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)
Release files for gpmf 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gpmf-0.1.tar.gz | 9.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gpmf-0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.2 kB
Release files / gpmf-0.1.tar.gz
| Download URL | gpmf-0.1.tar.gz |
|---|---|
| Size | 9.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
033403643f60cba3ff8bb3382afb5d06b2d566b438c57486ddbac538ca44373b
|
|
BLAKE2b-256 checksum How to use checksums |
0e23f64b9fa8faae79127263f1d7190ce5b239b8778d56e34c8e25c3dca20847
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / gpmf-0.1-py3-none-any.whl
| Download URL | gpmf-0.1-py3-none-any.whl |
|---|---|
| Size | 16.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bf497aa0d3650b3dd3b58a0f15d2166ee5fcdd1708e3404706309bf653b1d447
|
|
BLAKE2b-256 checksum How to use checksums |
7d43cf34920c74b169167d686f9e5a315c42316dde8a50d28abac6cff2a154c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|