UNPKG

@omnimedia/omnitool

Version:

open source video processing tools

44 lines (43 loc) 1.51 kB
import type { Item } from "./item.js"; import { TextStyleOptions } from "pixi.js"; import { Vec2 } from "../types.js"; import { Transcription, TranscriptSegment } from "../../features/speech/transcribe/types.js"; export type CaptionOptions = { label?: string; enabled?: boolean; itemId?: Item.Caption["itemId"]; start?: number; duration?: number; styles?: TextStyleOptions; maxChars?: number; maxDuration?: number; maxSilence?: number; }; export declare const captionPresets: { default: { styles: { fontFamily: string; fontSize: number; fill: string; align: "center"; wordWrap: true; wordWrapWidth: number; }; transform: { position: Vec2; }; }; }; export type CaptionPreset = (typeof captionPresets)[keyof typeof captionPresets]; export type CaptionSourceItem = Item.Video | Item.Audio; export type CaptionAction = { (item: CaptionSourceItem, transcript: Transcription, options?: CaptionOptions): Item.Stack; make: (transcript: Transcription, options?: CaptionOptions) => Item.Caption; }; export type CaptionActions = CaptionAction & { presets: { [TName in keyof typeof captionPresets]: CaptionAction; }; }; export declare function segmentTranscript(transcript: Transcription, options?: CaptionOptions): TranscriptSegment[]; export declare function captionDuration(transcript: Transcription, options?: CaptionOptions): number;