首先,SRT 是一种主流格式的字幕文件。它以 SubRip
格式存储,扩展名为. srt
。
而且,SRT字幕文件格式简单、清晰,可以直接使用文本编辑器阅读、编辑。
1
00:01:38,665 --> 00:01:40,189
<i>[Woman]</i>
<i>*Every night and day *</i>
2
00:01:40,266 --> 00:01:42,757
- [Bell Ringing]
<i>- *And I never lost one minute of sleepin'*</i>
3
00:01:42,836 --> 00:01:45,771
<i>* Worryin' 'bout the way</i>
<i>things might have been *</i>
4
00:01:45,839 --> 00:01:48,967
<i>*Big wheel keep on turnin'*</i>
5
00:01:49,042 --> 00:01:52,978
[Chattering]
<i>*Proud Mary keep on burnin'*</i>
6
00:01:53,046 --> 00:01:55,844
<i>*</i> Rollin', rollin' <i>*</i>
每个字幕文件由多个字幕段构成。
每个字幕段由四部分构成:
hours:minutes:seconds,milliseconds
<b>...</b>
<i>...</i>
<u>...</u>
<font color='color name or #color_name'>...</font>
如果你想用程序解析 SRT 格式字幕,开源社区有很多优秀的实现,我们也不需要重新造轮子。
例如,Java 平台下,我们可以使用开源社区的 SRTParser 帮我们完成 SRT 格式字幕文件的解析。
感谢开源社区😄。