### Install Deepgram Captions Package Source: https://github.com/deepgram/deepgram-js-captions/blob/main/README.md Install the package using npm or yarn. ```bash npm install @deepgram/captions # - or - # yarn add @deepgram/captions ``` -------------------------------- ### Use a Custom Converter with SRT Source: https://github.com/deepgram/deepgram-js-captions/blob/main/README.md Instantiate your custom converter with transcription data and pass it to the `srt` function. ```typescript import { srt } from "@deepgram/captions"; const result = srt(new GenericConverter(transcription_result)); ``` -------------------------------- ### Create a Generic Transcription Converter Source: https://github.com/deepgram/deepgram-js-captions/blob/main/README.md Implement the `IConverter` interface to handle custom transcription formats. The `getLines` method should return words grouped into lines. ```typescript import { chunkArray, WordBase, IConverter } from "@deepgram/captions"; export class GenericConverter implements IConverter { constructor(public transcriptionData: any) {} getLines(lineLength: number = 8): WordBase[][] { const results = this.transcriptionData; let content: WordBase[][] = []; results.paragraphs.forEach((paragraph) => { if (paragraph.words.length > lineLength) { content.push(...chunkArray(paragraph.words, lineLength)); } else { content.push(paragraph.words); } }); return content; } } ``` -------------------------------- ### Generate WebVTT using AssemblyAI Converter Source: https://github.com/deepgram/deepgram-js-captions/blob/main/README.md Utilize the `AssemblyAiConverter` to format AssemblyAI transcription results into WebVTT format. ```typescript import { webvtt, AssemblyAiConverter } from "@deepgram/captions"; const result = webvtt(new AssemblyAiConverter(assembly_result)); ``` -------------------------------- ### Generate WebVTT Output Source: https://github.com/deepgram/deepgram-js-captions/blob/main/README.md Use the `webvtt` function from `@deepgram/captions` to convert a Deepgram transcription result into WebVTT format. This is useful for creating subtitle files for video players. ```typescript import { webvtt } from "@deepgram/captions"; const result = webvtt(deepgram_transcription_result); console.log(result); ``` -------------------------------- ### Generate WebVTT from Deepgram Transcription Source: https://github.com/deepgram/deepgram-js-captions/blob/main/README.md Use the `webvtt` function to convert a Deepgram transcription result into a WebVTT formatted string. ```typescript import { webvtt } from "@deepgram/captions"; const result = webvtt(deepgram_transcription_result); ``` -------------------------------- ### Generate SRT from Deepgram Transcription Source: https://github.com/deepgram/deepgram-js-captions/blob/main/README.md Use the `srt` function to convert a Deepgram transcription result into an SRT formatted string. ```typescript import { srt } from "@deepgram/captions"; const result = srt(deepgram_transcription_result); ``` -------------------------------- ### Generate SRT Output Source: https://github.com/deepgram/deepgram-js-captions/blob/main/README.md Use the `srt` function from `@deepgram/captions` to convert a Deepgram transcription result into SRT format. SRT is a widely compatible subtitle format for various media players. ```typescript import { srt } from "@deepgram/captions"; const result = srt(deepgram_transcription_result); console.log(result); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.