380cc
V2EX  ›  问与答

求助 Gemini api 对 srt 翻译后造成时间轴错乱的解决方法

  •  
  •   380cc · 8h 36m ago · 427 views

    想请教个问题,

    我尝试用 AI 比如 Gemini api 把日语 srt 翻译成英语 srt, 但发觉 gemini 老是把 srt 的时间轴弄的乱七八糟的,和原来的不一样,有什么好的办法纠正这个毛病吗? 每次手动纠正 srt 弄了老半天。。。 目前为了省事,直接 google translate, 但结果好像又没有 gemini flash 那么准确。 不知道有什么好办法。 求助。

    5 replies    2026-07-12 16:02:22 +08:00
    Maxwe11
        1
    Maxwe11  
       8h 12m ago
    还是要有个约束,单纯对话不太能保持一致性。

    腾讯推那个 workbuddy ,给送了一堆积分,我打开试了试发现不太好用,但是觉得积分浪费了可惜,就开 agent 做字幕翻译。

    我是希望翻译成中英文字幕,因为其中有很多老英剧,有时代和语言习惯上的差异,所以先开了 skill 让翻译前先调用 douban 和 imdb 去充分了解背景信息,然后制定规定,要求人名地名等不需要翻译保留,另外先读取整部剧集,纳入上下文信息,统一先制定标准,然后再分子 agent 去批量处理。

    生成内容是有严格约束(包括时间戳),我看 agent 具体实现的方法是按照前面的标准,然后批量抽取字幕到 json ,再先把有统一标准的内容快速翻译一下,一轮一轮抽取翻译,直到完全翻译完,再开启质量校验 agent 做质量核查,完成基本可用。

    就是前面说的,因为有要求时间戳的严格约束,所以遇到一些长句,字幕翻译会过长,需要手动修正一下,但是大体上批量做完,几乎 95%可用。
    neteroster
        2
    neteroster  
       8h 9m ago via Android
    这些都有成熟工具了,LinguaGacha AiNiee 之类的可以看看
    Maxwe11
        3
    Maxwe11  
       8h 7m ago
    '''
    {
    "Father Ted - S02E01 - Hell": {
    "filename": "Father Ted - S02E01 - Hell.srt",
    "encoding": "us-ascii",
    "blocks": [
    {
    "idx": 1,
    "timecode": "00:00:36,771 --> 00:00:40,238",
    "english": "Now, Tom, this is the first time\nyou've been trusted"
    },
    {
    "idx": 2,
    "timecode": "00:00:40,328 --> 00:00:42,999",
    "english": "with such a large consignment\nof raw sewage."
    },
    {
    "idx": 3,
    "timecode": "00:00:43,086 --> 00:00:47,201",
    "english": "- Are you sure you'll be all right?\n- Don't worry about me at all."
    },
    '''

    '''
    {
    "Father Ted - S02E01 - Hell": {
    "filename": "Father Ted - S02E01 - Hell.srt",
    "encoding": "us-ascii",
    "blocks": [
    {
    "idx": 1,
    "timecode": "00:00:36,771 --> 00:00:40,238",
    "english": "Now, Tom, this is the first time\nyou've been trusted",
    "chinese": ""
    },
    {
    "idx": 2,
    "timecode": "00:00:40,328 --> 00:00:42,999",
    "english": "with such a large consignment\nof raw sewage.",
    "chinese": ""
    },
    {
    "idx": 3,
    "timecode": "00:00:43,086 --> 00:00:47,201",
    "english": "- Are you sure you'll be all right?\n- Don't worry about me at all.",
    "chinese": ""
    },
    '''

    大概过程,AI 先抽取,然后每句都有一个唯一的 idx 编号,后面生成一个对应的中文空值位,先把最简单的和不需要翻译的(比如音乐)填充完,再抽取内容,一句一句翻译,翻译完后,填充到对应的中文位置,这样基本上就不会出现时间戳错位的问题了,检查完最后再按照格式生成回新的 srt 格式,作为最终交付物。
    lslqtz
        4
    lslqtz  
       5h 42m ago
    要求 ai 输出原文 - 译文,做对应关系。未对应上的,后续补查
    billlee
        5
    billlee  
       5h 7m ago
    不要让它处理时间轴啊,把内容提取出来,让它 translate each line
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2973 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 13:10 · PVG 21:10 · LAX 06:10 · JFK 09:10
    ♥ Do have faith in what you're doing.