#9063 Audio/Video Speed Sync Stage An Error Occurred argument out of rangeTraceback (most recent call last):

2a0c**d4e3 Posted at: 21 hours ago

Audio/Video Speed Sync Stage An Error Occurred 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=Translation V/A 单视频模式
Select Media File: C:/Users/bouch/Downloads/P1_【1-10季】枯骨登仙录!_1-6_720P.mp4,
Output Directory: C:/Users/bouch/Videos/2/P1_【1-10季】枯骨登仙录!_1-6_720P-mp4,
self.cfg.cache_folder='C:/Users/bouch/Downloads/win-pyvideotrans-v4.19/tmp/6548/410a842d3b'
Selected Clear Output, Selected Enable accelerator
STT Service:faster-whisper(Built-in), large-v3-turbo, Spoken: Simplified Chinese
Max Speech Duration (s): 5s
Min Speech Duration (ms): 3000ms
Min Silence Duration for Split (ms): 600ms
VAD Speech Threshold: 0.45
VAD Engine: silero
Compute Type:default
Beam Size:5
Best Of:5
Condition on Previous Text:False
Repetition Penalty:1.0
Compression Ratio Threshold:2.4
TranslateSrt:Google Translate (Free),Spoken:Simplified Chinese,Target:Arabic
Traditional Translation Batch Size (Lines): 5
TTS Service:Edge-TTS (Free), Voices:Saleh(Male/YE), Target:Arabic
Volume:+0%, Speed:+0%, Selected TTS Speedup, Not-Selected Slow Video
Selected Trim Start/End Silence in Dubbed Segments
Silence Removal Intensity: default
No Subtitles
video duration:30457833ms
video information:{'video_fps': 30.0, 'r_frame_rate': 30.0, 'video_codec_name': 'h264', 'audio_codec_name': 'aac', 'width': 1280, 'height': 720, 'time': 30457833, 'streams_len': 2, 'streams_audio': 1, 'video_streams': 1, 'color': 'yuv420p'}
self.cfg=TaskCfgVTT(uuid='410a842d3b', name='C:/Users/bouch/Downloads/P1_【1-10季】枯骨登仙录!_1-6_720P.mp4', dirname='C:/Users/bouch/Downloads', noextname='P1_【1-10季】枯骨登仙录!_1-6_720P', basename='P1_【1-10季】枯骨登仙录!_1-6_720P.mp4', ext='mp4', target_dir='C:/Users/bouch/Videos/2/P1_【1-10季】枯骨登仙录!_1-6_720P-mp4', cache_folder='C:/Users/bouch/Downloads/win-pyvideotrans-v4.19/tmp/6548/410a842d3b', is_cuda=True, source_language='Simplified Chinese', source_language_code='zh-cn', source_sub='C:/Users/bouch/Videos/2/P1_【1-10季】枯骨登仙录!_1-6_720P-mp4/zh-cn.srt', source_wav='C:/Users/bouch/Downloads/win-pyvideotrans-v4.19/tmp/6548/410a842d3b/zh-cn.wav', source_wav_output='C:/Users/bouch/Videos/2/P1_【1-10季】枯骨登仙录!_1-6_720P-mp4/zh-cn.m4a', target_language='Arabic', target_language_code='ar', target_sub='C:/Users/bouch/Videos/2/P1_【1-10季】枯骨登仙录!_1-6_720P-mp4/ar.srt', target_wav='C:/Users/bouch/Downloads/win-pyvideotrans-v4.19/tmp/6548/410a842d3b/target.wav', target_wav_output='C:/Users/bouch/Videos/2/P1_【1-10季】枯骨登仙录!_1-6_720P-mp4/ar.m4a', translate_type=0, tts_type=0, volume='+0%', pitch='+0Hz', voice_rate='+0%', voice_role='Saleh(Male/YE)', voice_autorate=True, video_autorate=False, remove_silent_mid=False, align_sub_audio=True, tts_model_name=None, detect_language='zh', 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='C:/Users/bouch/Videos/2/P1_【1-10季】枯骨登仙录!_1-6_720P-mp4/P1_【1-10季】枯骨登仙录!_1-6_720P.mp4', novoice_mp4='C:/Users/bouch/Downloads/win-pyvideotrans-v4.19/tmp/6548/410a842d3b/novoice.mp4', is_separate=False, embed_bgm=True, instrument='C:/Users/bouch/Downloads/win-pyvideotrans-v4.19/tmp/6548/410a842d3b/instrument.wav', vocal='C:/Users/bouch/Downloads/win-pyvideotrans-v4.19/tmp/6548/410a842d3b/vocal.wav', clear_cache=True, background_music='', subtitle_type=0, only_out_mp4=False, recogn2pass=False, output_srt=0, copysrt_rawvideo=False, loop_backaudio=1, backaudio_volume=0.8, batch=False)
video_duration_ms=30457833


=
system:Windows-10-10.0.26200-SP0
version:v4.19
frozen:True
language:en_US
root_dir:C:/Users/bouch/Downloads/win-pyvideotrans-v4.19

1 Replies

#1 DeepSeek reply at 21 hours ago

Core cause: The source video is extremely long (video duration: 30,457,833 ms ≈ 8.46 hours). In the A/V sync stage, _create_silen_file uses pydub to generate a silent filler WAV. The WAV header uses a 32-bit integer to record the data length, so a single WAV cannot exceed about 4GB. Mismatched or abnormally large subtitle timestamps will generate a silence slice that exceeds this limit, which makes wave.py throw struct.error: argument out of range when writing the header. This is a length/timestamp overflow, not a TTS or translation problem.

Solution (in this order):

  1. Split the video before translating. Merge V/A/Srt or A/V Sync needs to write a complete audio track at once for an 8.5-hour source. Cut it into several segments, each under 2 hours, and translate them separately. You can use Menu → Tools → Trim Video by Subtitles, or a third-party tool such as ffmpeg or ShanaEncoder.
  2. Normalize the file name and path. The current name contains 【】! and brackets. Rename it to a short English or digit name (for example p1.mp4) and put it in a shallow directory (for example D:/video/). The underlying ffmpeg and pydub calls have poor compatibility with these characters.
  3. Clear the leftover cache: empty the tmp/ folder under the software root directory. Then re-run the task with Clear Output checked.
  4. Update the version: the current version is v4.19; the latest is v4.20, which includes several fixes to alignment and silence-writing logic. After replacing it, keep your videotrans/params.json and cfg.json to preserve the configuration.
  5. Optionally try turning off TTS Speedup first. If the task completes, the problem is confirmed to be the overflow of accelerated audio and silent filler; you can then enable it per segment.

If it still fails after splitting the video: the specific cause cannot be determined right now. Please provide the last about 30 lines of the latest log file in the logs/ folder under the software installation directory (the lines containing the stack trace), plus the duration of the current segment, so that it can be analyzed further.

Please refer to the related documentation:

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