Skip to content

Instantly share code, notes, and snippets.

@zacharyneveu
Created June 11, 2024 12:22
Show Gist options
  • Save zacharyneveu/bece56a430edc688c199de73e3f9cace to your computer and use it in GitHub Desktop.
Save zacharyneveu/bece56a430edc688c199de73e3f9cace to your computer and use it in GitHub Desktop.
Combine all GoPro videos in a folder into a single file and export GPS metadata to a separate GPX file.
#! /bin/sh
#
# merge-and-export-gps.sh
# Copyright (C) 2023 zach <zach@Zach-Desktop>
#
# Distributed under terms of the MIT license.
#
#! /bin/sh
#
# merge-and-export-gps.sh
# Copyright (C) 2023 zach <zach@Zach-Desktop>
#
# Distributed under terms of the MIT license.
#
cwd=$(pwd)
cd "$1"
echo -n '' > merge.txt
# Create list of files to merge - gopro files sorted by name should also be in date order
# Leave `merge.txt` around just in case
for file in *.MP4; do
echo "file ${file}" >> merge.txt
done
# Merge videos
ffmpeg.exe -f concat -i merge.txt -c copy -map 0:v -map 0:a -map 0:3 -copy_unknown -tag:2 gpmd combined.mp4
# Create combined GPS track
gopro2gpx.exe combined.mp4
cd "${cwd}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment