Board logo

标题: 【已解决】求助提取文本时间码生成srt字幕 [打印本页]

作者: baibat    时间: 2023-3-22 17:32     标题: 【已解决】求助提取文本时间码生成srt字幕

本帖最后由 baibat 于 2023-3-24 11:26 编辑



具体报酬:50元
支付方式:支付宝
联系方式:QQ2624491596
有效期限:2023年4月2日之前。


需求描述:

我有一些分行后的txt文本,每个文本使用语音标注工具生成了对应的textgrid文件(可以用notepad等文本编辑器打开),txt文本和textgrid均为utf-8编码。
textgrid文件里包含一个或多个item项,其中item [1]中包含了与txt文本对应的单个字符串和时间码intervals范围(以xmin和xmax标注)。

目的:
参照txt文本,从对应textgrid的 Item[1] 中提取与txt文件每行文字首和尾字串对应的时间码,并将该行文本转换成srt字幕格式。

-----------------------------------------------------------------------------------
说明:

1. textgrid中将标点符号一般标记为空字符 "" ,即text = "",另有些不规范的字符也会被标记为空字符 "" ;

2. 由于语音标注工具不能100%识别所有字符和字串,有些txt文本字串在textgrid被标记为 "<unk>"或者空字符 ""。很可能 "<unk>"或者空字符 ""位于对应txt文本句子的开头或结尾位置的字串上。
比如,”Miss Baker had mentioned him ......“这句前两个字串"Miss" "Baker"在textgrid文件中分别被识别为"<unk>"和空字符 "",这句只有从第三个字串”had“...开始才在textgrid中被识别,那就获取textgrid中这句的”had“之前2字串即"<unk>"的xmin的时间作为全句的起始时间码。
如果句子结尾字符也出现这样的情况也类推,比如句子结尾“......and he knew Maecenas.”,倒数第二个字符串“Maecenas”被识别为 "<unk>",而倒数第三个字符串“knew”能被识别,则取textgrid中这个 “knew”的下两位(也就是句点位置)的xmax标记的时间码作为该语句的结束时间码。
(如果觉得这样的方式取时间不方便,因句子中标点符号在textgrid中空字符占位,即text = "",所占据的时间极短,每句末尾标点符号时间也可以不计,影响不大。)

3. textgrid时间码通常以秒.毫秒(s.ms)表示,但在textgrid文件中,小数点后面的毫秒数字长度从0~16位不等。比如“xmin = 0,xmax = 2.030” 、“ xmin = 5.4944923317085435,xmax = 5.878026678806222” 或者 “xmin = 4.58,xmax = 6.4944923317085435” 。需要转换为srt字幕的时间码“00:00:04,580 --> 00:00:06,494” 这样的格式。

素材:
http://www.fileconvoy.com/dfl.php?id=ga2f58937b2cb7dd9100048485707e779521f2e3b0f


哪位大佬可以帮忙,先行谢过!



作者: newswan    时间: 2023-3-22 20:21

此帖仅作者可见
作者: jyswjjgdwtdtj    时间: 2023-3-22 20:25

此帖仅作者可见
作者: jyswjjgdwtdtj    时间: 2023-3-22 20:37

此帖仅作者可见
作者: baibat    时间: 2023-3-22 21:11

此帖仅作者可见
作者: baibat    时间: 2023-3-22 21:18

此帖仅作者可见
作者: jyswjjgdwtdtj    时间: 2023-3-22 21:47

此帖仅作者可见
作者: baibat    时间: 2023-3-22 22:37

此帖仅作者可见
作者: newswan    时间: 2023-3-23 09:56

此帖仅作者可见
作者: newswan    时间: 2023-3-23 10:01

此帖仅作者可见
作者: baibat    时间: 2023-3-23 11:58

此帖仅作者可见
作者: newswan    时间: 2023-3-23 13:20

此帖仅作者可见
作者: newswan    时间: 2023-3-23 13:55

此帖仅作者可见
作者: baibat    时间: 2023-3-23 14:59

此帖仅作者可见
作者: newswan    时间: 2023-3-23 15:36

此帖仅作者可见
作者: baibat    时间: 2023-3-23 15:38

此帖仅作者可见
作者: newswan    时间: 2023-3-23 16:08

此帖仅作者可见
作者: newswan    时间: 2023-3-23 16:13

此帖仅作者可见
作者: newswan    时间: 2023-3-23 16:22

此帖仅作者可见
作者: newswan    时间: 2023-3-23 16:24

此帖仅作者可见
作者: baibat    时间: 2023-3-23 17:00

此帖仅作者可见
作者: baibat    时间: 2023-3-23 17:09

此帖仅作者可见
作者: newswan    时间: 2023-3-23 17:19

此帖仅作者可见
作者: baibat    时间: 2023-3-23 17:27

此帖仅作者可见
作者: baibat    时间: 2023-3-23 17:34

此帖仅作者可见
作者: newswan    时间: 2023-3-23 22:30

此帖仅作者可见
作者: baibat    时间: 2023-3-24 08:29

此帖仅作者可见
作者: baibat    时间: 2023-3-24 09:35

此帖仅作者可见
作者: newswan    时间: 2023-3-24 10:50

此帖仅作者可见
作者: newswan    时间: 2023-3-25 11:10

此帖仅作者可见




欢迎光临 批处理之家 (http://www.bathome.net/) Powered by Discuz! 7.2