init repo

This commit is contained in:
HugoPoi 2021-01-31 13:57:01 +01:00
commit 0c5b9b5464
5 changed files with 3240 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
node_modules

12
add_speed_overlay.sh Executable file
View File

@ -0,0 +1,12 @@
#!/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

34
gopro-telemetry-exporter Executable file
View File

@ -0,0 +1,34 @@
#!/bin/node
const gpmfExtract = require('gpmf-extract');
const goproTelemetry = require(`gopro-telemetry`);
const fs = require('fs');
const minimist = require('minimist');
const _ = require('lodash');
async function main(options) {
const res = await gpmfExtract(bufferAppender(options.input, 10 * 1024 * 1024));
function bufferAppender(path, chunkSize) {
return function (mp4boxFile) {
var stream = fs.createReadStream(path, { highWaterMark: chunkSize });
var bytesRead = 0;
stream.on('end', () => {
mp4boxFile.flush();
});
stream.on('data', chunk => {
var arrayBuffer = new Uint8Array(chunk).buffer;
arrayBuffer.fileStart = bytesRead;
mp4boxFile.appendBuffer(arrayBuffer);
bytesRead += chunk.length;
});
stream.resume();
};
}
goproTelemetry(res, _.omit(options, ['_', 'input', 'output']), telemetry => {
fs.writeFileSync(options.output, telemetry);
});
}
main(minimist(process.argv.slice(2)));

3175
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

18
package.json Normal file
View File

@ -0,0 +1,18 @@
{
"name": "gopro-extract",
"version": "1.0.0",
"description": "",
"main": "gpx-extract.js",
"dependencies": {
"gopro-telemetry": "^1.1.34",
"gpmf-extract": "^0.1.21",
"lodash": "^4.17.20",
"minimist": "^1.2.5"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}