gopro-telemetry-exporter/examples/add_speed_overlay.sh
2021-02-19 23:32:56 +01:00

13 lines
662 B
Bash
Executable File

#!/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