#8960 合并阶段出错 The srt subtitles were not read. The file may be empty or the format does not conform to the SRT specification:sr

120.40**2 Posted at: 10 hours ago

合并阶段出错 The srt subtitles were not read. The file may be empty or the format does not conform to the SRT specification
:srtfile='C:/Users/Administrator/Documents/_video_out/福-mp4/zh-cn.srt'
content=''
Traceback (most recent call last):
File "videotrans\task\only_one.py", line 207, in run
File "videotrans\task\_stage_assemble.py", line 26, in assembling
File "videotrans\task\_stage_assemble.py", line 130, in _join_video_audio_srt
File "videotrans\task\_stage_subtitle.py", line 37, in _process_subtitles
File "videotrans\util\_srt_parse.py", line 205, in get_subtitle_from_srt
RuntimeError: The srt subtitles were not read. The file may be empty or the format does not conform to the SRT specification
:srtfile='C:/Users/Administrator/Documents/_video_out/福-mp4/zh-cn.srt'
content=''

trk=翻译视频 单视频模式
选择音视频文件: C:/Users/Administrator/Documents/福.mp4,
输出目录: C:/Users/Administrator/Documents/_video_out/福-mp4,
self.cfg.cache_folder='F:/BaiduNetdiskDownload/win-pyvideotrans-v4.19/tmp/7288/945ef700fb'
已选 清理已生成, 未选 启用硬件加速
已选 降噪,降噪模型:dpdfnet2.onnx
语音识别:faster-whisper(内置), tiny, 发音语言: 英语
最长语音持续(秒): 4s
最短语音持续(毫秒): 3000ms
静音分割持续毫秒: 200ms
语音阈值: 0.3
选择VAD: silero
计算数据类型:int8
识别准确度beam_size:3
识别准确度best_of:5
启用上下文感知:False
重复惩罚:1.0
文本压缩率:2.4
翻译渠道:Google(免费),发音语言:英语,目标语言:简体中文
传统翻译渠道每批字幕行数: 5
配音渠道:Edge-TTS(免费), 配音角色:Xiaoxiao(Female/CN), 目标语言:简体中文
Volume:+0%, Speed:+1%, 已选 配音加速, 已选 视频慢速
已选 移除每条字幕配音开头结尾静音缓冲
静音移除力度: max
已选: 二次语音识别, 二次识别所用模型: large-v3-turbo
二次识别最长语音持续(秒): 1.5s
二次识别最短语音持续(毫秒): 300ms
已选 识别说话人: 不限数量
说话人分离模型: ali_CAM
嵌入硬字幕
中日韩字幕单行字符数:15, 其他语言字幕单行字符数:40
已选 仅输出mp4
video duration:1929707ms
video information:{'video_fps': 18.18, 'r_frame_rate': 18.18, 'video_codec_name': 'h264', 'audio_codec_name': 'aac', 'width': 640, 'height': 368, 'time': 1899064, 'streams_len': 2, 'streams_audio': 1, 'video_streams': 1, 'color': 'yuv420p'}
self.cfg=TaskCfgVTT(uuid='945ef700fb', name='C:/Users/Administrator/Documents/福.mp4', dirname='C:/Users/Administrator/Documents', noextname='福', basename='福.mp4', ext='mp4', target_dir='C:/Users/Administrator/Documents/_video_out/福-mp4', cache_folder='F:/BaiduNetdiskDownload/win-pyvideotrans-v4.19/tmp/7288/945ef700fb', is_cuda=False, source_language='英语', source_language_code='en', source_sub='C:/Users/Administrator/Documents/_video_out/福-mp4/en.srt', source_wav='F:/BaiduNetdiskDownload/win-pyvideotrans-v4.19/tmp/7288/945ef700fb/remove_noise.wav', source_wav_output='C:/Users/Administrator/Documents/_video_out/福-mp4/en.m4a', target_language='简体中文', target_language_code='zh-cn', target_sub='C:/Users/Administrator/Documents/_video_out/福-mp4/zh-cn.srt', target_wav='F:/BaiduNetdiskDownload/win-pyvideotrans-v4.19/tmp/7288/945ef700fb/target.wav', target_wav_output='C:/Users/Administrator/Documents/_video_out/福-mp4/zh-cn.m4a', translate_type=0, tts_type=0, volume='+0%', pitch='+0Hz', voice_rate='+1%', voice_role='Xiaoxiao(Female/CN)', voice_autorate=True, video_autorate=True, remove_silent_mid=False, align_sub_audio=True, tts_model_name=None, detect_language='en', recogn_type=0, model_name='tiny', shibie_audio=None, remove_noise=True, enable_diariz=True, nums_diariz=0, rephrase=False, fix_punc=0, app_mode='biaozhun', subtitle_language=None, targetdir_mp4='C:/Users/Administrator/Documents/_video_out/福-mp4/福.mp4', novoice_mp4='F:/BaiduNetdiskDownload/win-pyvideotrans-v4.19/tmp/7288/945ef700fb/novoice.mp4', is_separate=False, embed_bgm=True, instrument='F:/BaiduNetdiskDownload/win-pyvideotrans-v4.19/tmp/7288/945ef700fb/instrument.wav', vocal='F:/BaiduNetdiskDownload/win-pyvideotrans-v4.19/tmp/7288/945ef700fb/vocal.wav', clear_cache=True, background_music='', subtitle_type=1, only_out_mp4=True, recogn2pass=True, output_srt=0, copysrt_rawvideo=False, loop_backaudio=1, backaudio_volume=0.8, batch=False)
video_duration_ms=1899064


=
system:Windows-10-10.0.19045-SP0
version:v4.19
frozen:True
language:zh_CN
root_dir:F:/BaiduNetdiskDownload/win-pyvideotrans-v4.19

1 Replies

#1 DeepSeek reply at 10 hours ago

核心原因:合并阶段读取到的目标语言字幕文件 zh-cn.srt 内容为空(content=''),即字幕翻译阶段没有生成有效译文,但流程仍继续进入合成,最终在解析 SRT 时报错。常见诱因是翻译渠道请求失败(Google 免费接口被限流 429 / 代理异常)、AI 翻译返回空或合并了字幕行,或路径/文件名含中文导致中间文件异常。

排查与解决步骤:

  1. 先打开 C:/Users/Administrator/Documents/_video_out/福-mp4/zh-cn.srt 确认是否 0 字节或不存在;同时查看 logs/ 下当天日志,搜索翻译阶段的报错(尤其 429、Client Error、代理相关)。
  2. 更换翻译渠道重试:将 Google(免费) 改为 Microsoft(免费) 或 DeepSeek,并重新勾选 清理已生成。Google 渠道在国内必须使用代理,且节点 IP 不干净时会被 429 拦截。
  3. 高级选项 → 字幕翻译:将 传统翻译渠道每批字幕行数 与 AI翻译渠道每批字幕行数 都先设为 1,避免模型合并相邻字幕导致行错位或空行。
  4. 逐项定位:先取消 二次语音识别、识别说话人,并将字幕嵌入改为 不嵌入字幕,只跑“识别→翻译→配音”验证是否能生成非空 zh-cn.srt;跑通后再逐项恢复。
  5. 规范文件与路径:当前文件名为 福.mp4、路径含中文,建议改为纯英文短名(如 fu.mp4),放在浅层目录(如 D:/videos/),重新勾选 清理已生成 后重试。
  6. 若上述操作后仍报同样错误,请提供 logs/ 目录下最新日志文件底部约 30 行(特别是翻译阶段与合并阶段前后的内容),以便进一步判断是翻译渠道失败还是字幕写入异常。

请查阅相关文档:

Thinking...
Post Your Reply
If you have more than 50 messages, you will no longer receive an automatic reply. Please ask a new question!
Open source and free maintenance is not easy. If this project is helpful to you, please consider making a small donation to help the project continue to maintain and update.

Dondate via ko-fi.com

Related resource