@remotion/install-whisper-cpp
Version:
Helpers for installing and using Whisper.cpp
22 lines (21 loc) • 708 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.toCaptions = void 0;
const toCaptions = (input) => {
const { transcription } = input.whisperCppOutput;
const captions = [];
for (const item of transcription) {
if (item.text === '') {
continue;
}
captions.push({
text: captions.length === 0 ? item.text.trimStart() : item.text,
startMs: item.offsets.from,
endMs: item.offsets.to,
timestampMs: item.tokens[0].t_dtw === -1 ? null : item.tokens[0].t_dtw * 10,
confidence: item.tokens[0].p,
});
}
return { captions };
};
exports.toCaptions = toCaptions;
;