How to make .webm seekable in JS

118 views Asked by At

I am trying to create a program that records a chrome tab and save it using puppeteer and puppeteer-tab-recorder. The problem is that it saves the recording as .webm which is the only supported version for now. I need to make the .webm seekable so I searched and found ts-ebml library. I tried to use it but no luck as this package is published 6 years ago and I can't find good documentation on how to use it to make .webm seekable. I tried reading their documentation and it says clearly that it is capable of this task but with no examples. can someone help me ?

what I tried:

function segmentWebM(inputPath, outputPath) {
  const fileBuffer = fs.readFileSync(inputPath); // Load the WebM file
  const decoder = new ebml.Decoder();
  decoder.write(fileBuffer);
  decoder.end();
  const tree = ebml.tools.makeMetadataSeekable(decoder.metadatas);
  const seekableWebMBuffer = Buffer.from(
    ebml.tools.makeMetadataSeekable(tree, true)
  );
  fs.writeFileSync(outputPath, seekableWebMBuffer);
}

It says it can't find the function .write in the decoder. only decode function is available and the other are just set to private.

0

There are 0 answers