While extracting the telemetry data from the GoPro is reasonably well documented I have found some gaps for getting the extracting utilities installed and when extracting and combining data from multiple files. These notes are for a Debian/Ubuntu installation in a BASH Shell.
Installing the gopro-utils
As I couldn’t find any straightforward instructions for installation, I’ll be going through everything I needed to do to get it working, you may have some of these packages installed already.
1 2 3 |
sudo apt update sudo apt upgrade sudo apt install ffmpeg golang gpsbabel git |
Now to get the gopro-utils and install them, I’m placing the source files into my Downloads directory, as well as the GPS data extractor we’ll be adding the other telemetry tools too, this is all a bit long winded.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
cd ~/Downloads git clone https://github.com/JuanIrache/gopro-utils cd gopro-utils go get github.com/JuanIrache/gopro-utils/telemetry go get github.com/mlouielu/gpxgo/gpx cd bin/gopro2gpx go build gopro2gpx.go sudo cp gopro2gpx /usr/local/bin/ cd ../bin/gopro2geojson/ go build gopro2geojson.go sudo cp gopro2geojson /usr/local/bin/ cd ../gopro2json/ go build gopro2json.go sudo cp gopro2json /usr/local/bin/ cd ../gpmd2csv/ go build gpmd2csv.go sudo cp gpmd2csv /usr/local/bin/ cd ../gpmd2info/ go build gpmd2info.go sudo cp gpmd2info /usr/local/bin/ cd ../gps2kml/ go build gps2kml.go sudo cp gps2kml /usr/local/bin/ |
Extracting the Data
You will need to find which stream in the video recording the data has been saved to, to find this use ffprobe to examine the recording and look for the stream that contains GoPro MET, for example:
1 2 3 4 5 6 7 |
$ ffprobe GX090155.MP4 [snip] Stream #0:3(eng): Data: none (gpmd / 0x646D7067), 40 kb/s (default) Metadata: creation_time : 2019-07-28T11:09:25.000000Z handler_name : GoPro MET [snip] |
You can see that what we are wanting is on stream 3, as far as I can tell this stays the same every time, I don’t know if it is different for other GoPro models.
This bash script extracts the GPS data in GPX format from all the GoPro GX recordings in the directory, other options have been commented out, if you are using Garmin VIRB edit there is also an option for use with that. The script creates two files, one that contains the raw data and another with the desired GPS data, the GPS output file has the same name as the recording, but in lowercase with a .gpx extension.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
#!/bin/bash FILES="GX*.MP4" STREAM="0:3" for MP4FILE in $FILES; do OUTFILE=$(basename "$MP4FILE" | cut -d. -f1) OUTFILE=$(echo "$OUTFILE" | tr '[:upper:]' '[:lower:]') BINFILE="$OUTFILE.bin" ffmpeg -y -i "$MP4FILE" -codec copy -map $STREAM -f rawvideo "$BINFILE" #gpmd2csv -i "$BINFILE" -o "$OUTFILE.csv" gopro2gpx -i "$BINFILE" -a 500 -f 2 -o "$OUTFILE.gpx" #gopro2gpx -i "$BINFILE" -a 200 -f 3 -o "$OUTFILE-virb.gpx" #gopro2json -i "$BINFILE" -o "$OUTFILE.json" done |
Merging GPX files
As the GoPro splits recordings into 4GB blocks, when extracting you will get a single GPX file for each recording. Many pages found by Google say that to create a single track from these all you need to do is append the files into one big file. This is wrong, what you end up with is a single file with many short tracks, when what you are after is one long track covering the entire journey. This bash script uses gpsbabel to create single merged file from the extracted GPX data, it creates a file called “gpsoutput.gpx”.
1 2 3 4 5 6 7 |
#!/bin/bash FILES="gx*.gpx" ff="" for f in $FILES; do ff="$ff -f $f" done gpsbabel -t -i gpx $ff -o gpx -x track,merge,title="GOPRO COMBINED LOG" -F gpsoutpt.gpx |
The next stage will be to write a script that combines all these and completes the job in one easy process.
Links and Sources
- Web Page to extract GoPro data: https://tailorandwayne.com/gopro-telemetry-extractor/ Easy to use for individual files
- https://github.com/JuanIrache/gopro-utils
- GoPro Forum Extracting the metadata in a useful format
- GPSBabel, Free software for GPS data conversion and transfer: https://www.gpsbabel.org/