字幕v4.0.216
🌐 Captionv4.0.216
这是一个用于字幕的简单数据结构。
🌐 This is a simple data structure for a caption.
import type {Caption } from '@remotion/captions';通过建立一个标准数据结构,我们允许许多涉及字幕的操作能够互操作:
🌐 By establishing a standard data structure, we allow many operations that involve captions to be interoperable:
- 转录:使用
@remotion/install-whisper-cpp或@remotion/openai-whisper包 - 格式:例如,使用
createTikTokStyleCaptions()创建页面 - 解析:使用
parseSrt()函数 - 序列化:例如使用
serializeSrt()到.srt文件
字段
🌐 Fields
text
字幕的文字。
🌐 The text of the caption.
startMs
字幕的开始时间(毫秒)。
🌐 The start time of the caption in milliseconds.
endMs
字幕的结束时间(毫秒)。
🌐 The end time of the caption in milliseconds.
timestampMs
字幕的时间戳作为单一的毫秒时间戳。
在使用 @remotion/install-whisper-cpp 时,这是 t_dtw 值。
否则,它未定义,但可能是开始和结束时间戳的平均值。
🌐 The timestamp of the caption as a singular timestamp in milliseconds.
When using @remotion/install-whisper-cpp, this the t_dtw value.
Otherwise, it is not defined, but may be the average of the start and end timestamps.
confidence
介于0和1之间的数字,表示转录的置信度。
🌐 A number between 0 and 1 that indicates how confident the transcription is.
空白符敏感
🌐 Whitespace sensitivity
text 字段对空格敏感。你应该在其中包含空格,最好在每个单词前加空格。
🌐 The text field is whitespace sensitive. You should include spaces in it, ideally before each word.
在渲染时,将 white-space: pre CSS 属性应用于标题的容器,以确保空格被保留。
🌐 While rendering, apply the white-space: pre CSS property to the container of the caption to ensure that the spaces are preserved.
另请参阅
🌐 See also