tl;dr;
Install ffmpeg using Homebrew and then drop the folder containing your GoPro chapters onto the Automator application StitchGoProSession.appThe details:
There are a few moving parts, the most important is to have ffmpeg installed. I did this using Homebrew and the bash script in the Automator application depends on that path. It's easy enough to change in the script, which is listed below.Essentially the StitchGoProSession automator application is a wrapper round the bash script, but the first step is 'GetFolderContents', which produces a list of the files in the folder, which are then passed through to the script.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
firstFile='GOPR' | |
otherFiles='GP' | |
workingDir=${1%/*} | |
cd "$workingDir" | |
for f in "$@" | |
do | |
if [[ $f == *$firstFile* ]]; then | |
headFile=${f##*/} | |
sessionId=${headFile:4:4} | |
stitchfile='stitchfile'$sessionId'.txt' | |
echo -e "#new stitch file for GOPRO $sessionId session\n" > "$stitchfile" | |
echo "file '$headFile'" >> "$stitchfile" | |
fileCount=1 | |
while [ $fileCount -gt 0 ] | |
do | |
printf -v j "%02d" $fileCount | |
fileToTest='GP'$j$sessionId'.MP4' | |
if test -f "$fileToTest"; then | |
echo "file '"$fileToTest"'" >> "$stitchfile" | |
fileCount=$((fileCount+1)) | |
else | |
fileCount=0 | |
fi | |
done | |
# /usr/local/bin/ is the place Homebrew uses to install to | |
# could have added that to $PATH, but if ffmpeg has been installed some other way then it might not work | |
/usr/local/bin/ffmpeg -f concat -i $stitchfile -c copy session$sessionId.MP4 | |
fi | |
done |