Capítulo 754 de 988

Chapter 754: toCaptions()

Core Idea

Converts the output from transcribe() into an array of Caption objects, so you can use the functions from @remotion/captions.

Key Concepts

  • See also

Code Examples

const file = new File([], 'audio.wav');

const channelWaveform = await resampleTo16Khz({
  file,
});

const whisperWebOutput = await transcribe({
  channelWaveform,
  model: 'tiny.en',
});

const {captions} = toCaptions({
  whisperWebOutput,
});

console.log(captions); /*
 [
    {
      text: "William",
      startMs: 40,
      endMs: 420,
      timestampMs: 240,
      confidence: 0.813602,
    }, {
      text: " just",
      startMs: 420,
      endMs: 650,
      timestampMs: 480,
      confidence: 0.990905,
    }, {
      text: " hit",
      startMs: 650,
      endMs: 810,
      timestampMs: 700,
      confidence: 0.981798,
    }
  ]
*/
  • What it demonstrates: Usage pattern for toCaptions() from the official docs.

Key Takeaways

  1. Understand see also when working with toCaptions().

Connects To

  • Convert to Captions: related page in the Whisper Web (@remotion/whisper-web) section.
  • Download Whisper Model: related page in the Whisper Web (@remotion/whisper-web) section.
  • Install Whisper cpp: related page in the Whisper Web (@remotion/whisper-web) section.