Skip to content

Commit

Permalink
add gpx extraction exiftool formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
breunigs committed Oct 10, 2024
1 parent 5413ad4 commit c3dd961
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
28 changes: 28 additions & 0 deletions data/gpx_extended.fmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# example usage:
# exiftool -extractEmbedded -ignoreMinorErrors -printFormat <THIS_FILE> -binary -textOut gpx <VIDEO1> <VIDEO2> …
#
#[HEAD]<?xml version="1.0" encoding="utf-8"?>
#[HEAD]<gpx version="1.0"
#[HEAD] xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
#[HEAD] xmlns="http://www.topografix.com/GPX/1/0"
#[HEAD] xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd"
#[HEAD] creator="ExifTool $ExifToolVersion with extended veloroute.hamburg format">
#[HEAD]<metadata>
#[HEAD] <name>$filename#</name>
#[HEAD] <desc>$duration# sec runtime @ @ $rate# real time</desc>
#[HEAD] <author>$model @ $firmwareversion</author>
#[HEAD]</metadata>
#[HEAD]<trk>
#[HEAD]<trkseg>
#[IF] $gpslatitude $gpslongitude $gpsdatetime
#[BODY]<trkpt lat="$gpslatitude#" lon="$gpslongitude#">
#[BODY] <time>${gpsdatetime#;my ($ss)=/\.\d+/g;DateFmt("%Y-%m-%dT%H:%M:%SZ");s/Z/${ss}Z/ if $ss}</time>
#[BODY] <ele>$gpsaltitude#</ele>
#[BODY] <hdop>$GPSHPositioningError#</hdop>
#[BODY] <accel z="${accelerometer;$_=(split ' ')[0]}" x="${accelerometer;$_=(split ' ')[1]}" y="${accelerometer;$_=(split ' ')[2]}"/>
#[BODY] <gyro z="${gyroscope;$_=(split ' ')[0]}" x="${gyroscope;$_=(split ' ')[1]}" y="${gyroscope;$_=(split ' ')[2]}"/>
#[BODY] <speed gps2dkmh="${gpsspeed#;$_=3.6*$_}" gps3dkmh="${gpsspeed3d#;$_=3.6*$_}">$gpsspeed3d#</speed>
#[BODY]</trkpt>
#[TAIL]</trkseg>
#[TAIL]</trk>
#[TAIL]</gpx>
2 changes: 1 addition & 1 deletion lib/video/source.ex
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ defmodule Video.Source do
@spec timed_points_with_gpx(t()) :: [Video.TimedPoint.t()] | {:error, binary()}
def timed_points_with_gpx(%__MODULE__{source: source, available_gpx: false}) do
{:error,
"#{Video.Path.source_base_with_ending(source)} has no GPX file available to extract time range from, try `gopro2gpx -s #{Video.Path.source(source)}`?"}
"#{Video.Path.source_base_with_ending(source)} has no GPX file available to extract time range from, try `exiftool -extractEmbedded -ignoreMinorErrors -printFormat data/gpx_extended.fmt -binary -textOut gpx #{Video.Path.source(source)}`?"}
end

def timed_points_with_gpx(%__MODULE__{} = self) do
Expand Down

0 comments on commit c3dd961

Please sign in to comment.