Skip to content

Instantly share code, notes, and snippets.

@dhardy92
Last active May 15, 2019 17:21
Show Gist options
  • Save dhardy92/7726c4ffb02a93c68ca11f18fa7744dd to your computer and use it in GitHub Desktop.
Save dhardy92/7726c4ffb02a93c68ca11f18fa7744dd to your computer and use it in GitHub Desktop.
Create a SRT subtitle file with extrapolated speed from Garin activity
.activityDetailMetrics[0].metrics[3] as $startime |
.activityDetailMetrics[] |
[ (((.metrics[3] - $startime) / 1000) | strftime("%H:%M:%S")), ((.metrics[10]//0)*3.6)] |
@tsv
BEGIN{
speed=0;last="00:00:00";
}
{
printf ("%d\n%s,000 --> %s,000\n%02d km/h\n\n",NR,last,$1,speed);
last=$1;
speed=$2
}
END{
printf ("%d\n%s,000 --> %s,000\n%02d km/h\n\n",NR,last,"30:00:00",speed);
}
#Max time is 30min here
@dhardy92
Copy link
Author

Download from https://connect.garmin.com/modern/proxy/activity-service/activity//details? where is ID of Your activity. Store in activity.json then run :
jq -r -f GarminSpeed.jq < activity.json | awk -f speedsrt.awk
This can then be used to create video of your ride with encrusted Speed as text.

Here is an extract of the result :

[...]
155
00:21:57,000 --> 00:22:03,000
25 km/h

156
00:22:03,000 --> 00:22:05,000
26 km/h

157
00:22:05,000 --> 00:22:15,000
22 km/h

158
00:22:15,000 --> 00:22:26,000
21 km/h

159
00:22:26,000 --> 00:22:28,000
06 km/h

160
00:22:28,000 --> 00:22:33,000
09 km/h

160
00:22:33,000 --> 30:00:00,000
00 km/h

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment