gopro-telemetry: RangeError [ERR_FS_FILE_TOO_LARGE]

Trying to get the GoPro telemetry data for a 4GB video using the sample code:

const gpmfExtract = require('gpmf-extract');
const goproTelemetry = require(`gopro-telemetry`);
const fs = require('fs');

const file = fs.readFileSync('path_to_your_file.mp4');

gpmfExtract(file)
  .then(extracted => {
    let telemetry = goproTelemetry(extracted);
    fs.writeFileSync('output_path.json', JSON.stringify(telemetry));
    console.log('Telemetry saved as JSON');
  })
  .catch(error => console.log(error));

Getting RangeError [ERR_FS_FILE_TOO_LARGE]: File size (4001043636) is greater than possible Buffer: 2147483647 bytes. Is there a way to extract the gpmf data without sync. reading the entire file?

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15 (6 by maintainers)

Most upvoted comments

Hi @MauriceMorrey . No, the above solutions are still recommended

@plouj that’s a pretty interesting approach. I hadn’t thought of combining both ffmpeg and gpmf-extract. Ideally there should be an all JS/Nodejs solution, though

Whoever is going with the approach of using ffmpeg to extract the gpmd steam can also downsample the video to make it fit into the 2GB size limitation in one go as a quick and dirty solution.

The following reduces HERO5 4k 60fps 60mbit video from 3.4GB down to 22MB:

ffmpeg.exe -i GOPR0001.MP4 -vf scale=320:-1 -map 0:0 -map 0:1 -map 0:3 -codec:v mpeg2video -codec:d copy -codec:a copy -y GOPR0001-small.MP4

and allows using gpmfExtract to extract both the telemetry (stream 0:3 in the above case) and the timing data in one go.