#!/bin/bash for videoFile in "$@" do echo "Extracting gpx for $videoFile" ./gopro-telemetry-exporter --input $videoFile --output "${videoFile%.*}.gpx" --GPS5Fix 3 --preset gpx --groupTimes 200 gpsbabel -i gpx -f "${videoFile%.*}.gpx" -x track,speed -o subrip -F - | grep -v Lat > "${videoFile%.*}.srt" ffmpeg -i "${videoFile%.*}.srt" "${videoFile%.*}.ass" sed -i 's/^Style: .*/Style: Default,SquareFont,12,\&Hffffff,\&Hffffff,\&H0,\&H0,0,0,0,0,100,100,0,0,1,1,0,1,10,10,10,0/' "${videoFile%.*}.ass" ffmpeg -i $videoFile -vcodec h264_nvenc -vf subtitles="${videoFile%.*}.ass" -preset bd -b:v 20M "${videoFile%.*}.with_speed_overlay.mp4" done