#9109 声画变速对齐阶段 出错了 argument out of rangeTraceback (most recent call last):

211.97**7 Posted at: 14 minutes ago

声画变速对齐阶段 出错了 argument out of range
Traceback (most recent call last):
File "videotrans\task\only_one.py", line 175, in run
File "videotrans\task\_stage_align.py", line 44, in align
File "videotrans\task\_rate.py", line 388, in run
File "videotrans\task\_rate.py", line 709, in _concat_audio_aligned
File "videotrans\task\_rate.py", line 762, in _create_silen_file
File "pydub\audio_segment.py", line 895, in export
File "wave.py", line 426, in writeframesraw
File "wave.py", line 467, in _ensure_header_written
File "wave.py", line 479, in _write_header
struct.error: argument out of range

trk=翻译视频 单视频模式
选择音视频文件: E:/zl/Rust/rust-complete-course/Learn Rust Programming - Complete Course [BpPEoZW5IiY].webm,
输出目录: E:/zl/Rust/rust-complete-course/_video_out/Learn Rust Programming - Complete Course [BpPEoZW5IiY]-webm,
self.cfg.cache_folder='E:/software/win-pyvideotrans-v4.19/tmp/21936/aaa801e2cb'
未选 清理已生成, 已选 启用硬件加速
语音识别:faster-whisper(内置), large-v3-turbo, 发音语言: 英语
最长语音持续(秒): 5s
最短语音持续(毫秒): 3000ms
静音分割持续毫秒: 600ms
语音阈值: 0.45
选择VAD: silero
计算数据类型:default
识别准确度beam_size:5
识别准确度best_of:5
启用上下文感知:False
重复惩罚:1.0
文本压缩率:2.4
翻译渠道:Google(免费),发音语言:英语,目标语言:简体中文
传统翻译渠道每批字幕行数: 5
配音渠道:Edge-TTS(免费), 配音角色:Yunjian(Male/CN), 目标语言:简体中文
Volume:+0%, Speed:+0%, 已选 配音加速, 未选 视频慢速
已选 移除每条字幕配音开头结尾静音缓冲
静音移除力度: default
嵌入硬字幕
中日韩字幕单行字符数:60, 其他语言字幕单行字符数:60
video duration:50349317ms
video information:{'video_fps': 23.979292493528906, 'r_frame_rate': 23.979292493528906, 'video_codec_name': 'vp9', 'audio_codec_name': 'opus', 'width': 1920, 'height': 1080, 'time': 50349321, 'streams_len': 2, 'streams_audio': 1, 'video_streams': 1, 'color': 'yuv420p'}
self.cfg=TaskCfgVTT(uuid='aaa801e2cb', name='E:/zl/Rust/rust-complete-course/Learn Rust Programming - Complete Course [BpPEoZW5IiY].webm', dirname='E:/zl/Rust/rust-complete-course', noextname='Learn Rust Programming - Complete Course [BpPEoZW5IiY]', basename='Learn Rust Programming - Complete Course [BpPEoZW5IiY].webm', ext='webm', target_dir='E:/zl/Rust/rust-complete-course/_video_out/Learn Rust Programming - Complete Course [BpPEoZW5IiY]-webm', cache_folder='E:/software/win-pyvideotrans-v4.19/tmp/21936/aaa801e2cb', is_cuda=True, source_language='英语', source_language_code='en', source_sub='E:/zl/Rust/rust-complete-course/_video_out/Learn Rust Programming - Complete Course [BpPEoZW5IiY]-webm/en.srt', source_wav='E:/software/win-pyvideotrans-v4.19/tmp/21936/aaa801e2cb/en.wav', source_wav_output='E:/zl/Rust/rust-complete-course/_video_out/Learn Rust Programming - Complete Course [BpPEoZW5IiY]-webm/en.m4a', target_language='简体中文', target_language_code='zh-cn', target_sub='E:/zl/Rust/rust-complete-course/_video_out/Learn Rust Programming - Complete Course [BpPEoZW5IiY]-webm/zh-cn.srt', target_wav='E:/software/win-pyvideotrans-v4.19/tmp/21936/aaa801e2cb/target.wav', target_wav_output='E:/zl/Rust/rust-complete-course/_video_out/Learn Rust Programming - Complete Course [BpPEoZW5IiY]-webm/zh-cn.m4a', translate_type=0, tts_type=0, volume='+0%', pitch='+0Hz', voice_rate='+0%', voice_role='Yunjian(Male/CN)', voice_autorate=True, video_autorate=False, remove_silent_mid=False, align_sub_audio=True, tts_model_name=None, detect_language='en', recogn_type=0, model_name='large-v3-turbo', shibie_audio=None, remove_noise=False, enable_diariz=False, nums_diariz=0, rephrase=False, fix_punc=0, app_mode='biaozhun', subtitle_language=None, targetdir_mp4='E:/zl/Rust/rust-complete-course/_video_out/Learn Rust Programming - Complete Course [BpPEoZW5IiY]-webm/Learn Rust Programming - Complete Course [BpPEoZW5IiY].mp4', novoice_mp4='E:/software/win-pyvideotrans-v4.19/tmp/21936/aaa801e2cb/novoice.mp4', is_separate=False, embed_bgm=False, instrument='E:/software/win-pyvideotrans-v4.19/tmp/21936/aaa801e2cb/instrument.wav', vocal='E:/software/win-pyvideotrans-v4.19/tmp/21936/aaa801e2cb/vocal.wav', clear_cache=False, background_music='', subtitle_type=1, only_out_mp4=False, recogn2pass=False, output_srt=0, copysrt_rawvideo=False, loop_backaudio=1, backaudio_volume=0.8, batch=False)
video_duration_ms=50349321


=
system:Windows-10-10.0.26300-SP0
version:v4.19
frozen:True
language:zh_CN
root_dir:E:/software/win-pyvideotrans-v4.19

1 Replies

#1 DeepSeek reply at 14 minutes ago

根据堆栈 _create_silen_file → pydub export → wave._write_header → struct.error: argument out of range,报错发生在生成静音缓冲 WAV 时写入文件头。核心原因是源视频过长:日志中 video duration: 50349317ms(约 14 小时),对齐阶段生成的 WAV 音频数据量超过 WAV/PCM 格式 4GB 上限(48kHz 立体声 16bit 下约 6 小时即到顶),wave 模块写头部时数值溢出,抛出 argument out of range。知识库中没有该错误码的直接记录,此判断来自报错堆栈与视频时长。

处理建议:

  1. 分段处理该视频(最有效)。用 ffmpeg 按时间切分为若干段(建议每段不超过 2~3 小时),例如:

    ffmpeg -i input.webm -c copy -f segment -segment_time 3600 -reset_timestamps 1 part_%03d.webm

    然后对每段分别翻译,最后合并。

  2. 或使用软件菜单 工具/选项 → 按字幕剪辑视频,把长视频按字幕切成多个短片后分别翻译。
  3. 如果必须整段处理,可尝试先转为标准 mp4(H.264/AAC)再导入,减小重复编码与临时文件压力,但不能突破 WAV 4GB 的物理上限。
  4. 处理前建议将视频重命名为简短英文名,并放在浅层目录(如 E:/rust/),当前路径含空格和方括号,虽非本次报错原因,但易引发其他 ffmpeg 错误。

如果你的视频实际时长并非约 14 小时,或分段后仍报同样错误,请提供 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