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

2402**c36d Posted at: 8 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/PC/Downloads/Video/26352160274-1-192.mp4,
Output Directory: C:/video douyin/FDown.vn_douyin_downloader_9ebc-mp4/26352160274-1-192-mp4,
self.cfg.cache_folder='C:/win-pyvideotrans-v4.20/tmp/16320/0f27d6d1a5'
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:Vietnamese
Traditional Translation Batch Size (Lines): 5
TTS Service:Edge-TTS (Free), Voices:HoaiMy(Female/VN), Target:Vietnamese
Volume:+0%, Speed:+0%, Selected TTS Speedup, Not-Selected Slow Video
Selected Trim Start/End Silence in Dubbed Segments
Silence Removal Intensity: default
Hard Subtitles
Max Line Length (CJK Characters):15, Max Line Length (Non-CJK):40
video duration:33791799ms
video information:{'video_fps': 30.0, 'r_frame_rate': 30.0, 'video_codec_name': 'h264', 'audio_codec_name': 'aac', 'width': 1280, 'height': 720, 'time': 33791799, 'streams_len': 2, 'streams_audio': 1, 'video_streams': 1, 'color': 'yuv420p'}
self.cfg=TaskCfgVTT(uuid='0f27d6d1a5', name='C:/Users/PC/Downloads/Video/26352160274-1-192.mp4', dirname='C:/Users/PC/Downloads/Video', noextname='26352160274-1-192', basename='26352160274-1-192.mp4', ext='mp4', target_dir='C:/video douyin/FDown.vn_douyin_downloader_9ebc-mp4/26352160274-1-192-mp4', cache_folder='C:/win-pyvideotrans-v4.20/tmp/16320/0f27d6d1a5', is_cuda=True, source_language='Simplified Chinese', source_language_code='zh-cn', source_sub='C:/video douyin/FDown.vn_douyin_downloader_9ebc-mp4/26352160274-1-192-mp4/zh-cn.srt', source_wav='C:/win-pyvideotrans-v4.20/tmp/16320/0f27d6d1a5/zh-cn.wav', source_wav_output='C:/video douyin/FDown.vn_douyin_downloader_9ebc-mp4/26352160274-1-192-mp4/zh-cn.m4a', target_language='Vietnamese', target_language_code='vi', target_sub='C:/video douyin/FDown.vn_douyin_downloader_9ebc-mp4/26352160274-1-192-mp4/vi.srt', target_wav='C:/win-pyvideotrans-v4.20/tmp/16320/0f27d6d1a5/target.wav', target_wav_output='C:/video douyin/FDown.vn_douyin_downloader_9ebc-mp4/26352160274-1-192-mp4/vi.m4a', translate_type=0, tts_type=0, volume='+0%', pitch='+0Hz', voice_rate='+0%', voice_role='HoaiMy(Female/VN)', 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:/video douyin/FDown.vn_douyin_downloader_9ebc-mp4/26352160274-1-192-mp4/26352160274-1-192.mp4', novoice_mp4='C:/win-pyvideotrans-v4.20/tmp/16320/0f27d6d1a5/novoice.mp4', is_separate=False, embed_bgm=True, instrument='C:/win-pyvideotrans-v4.20/tmp/16320/0f27d6d1a5/instrument.wav', vocal='C:/win-pyvideotrans-v4.20/tmp/16320/0f27d6d1a5/vocal.wav', clear_cache=True, 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=33791799


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

1 Replies

#1 DeepSeek reply at 8 hours ago

This is not a translation or dubbing error. It occurs in the alignment stage, where the software must write a silent WAV placeholder covering the full duration of the video, and that file exceeds the 4GB upper limit of the WAV (RIFF) format. The header field overflows, so wave.py throws struct.error: argument out of range. For reference, the duration that the log reads is video_duration_ms=33791799, which is about 9.4 hours. At 48kHz stereo this is roughly 6.5GB, so the error is inevitable.

Your video file 26352160274-1-192.mp4 is clearly a Douyin short video, so this 9.4-hour duration is almost certainly a wrong value/abnormal metadata in the original file, not the real length.

Do the following in order:

  1. First check the real duration: play the video in a player and compare it with 33.8 seconds. If the player shows only tens of seconds, the container duration is wrong.
  2. Remux the file to repair the metadata: run ffmpeg -i "26352160274-1-192.mp4" -c copy fixed.mp4, then import fixed.mp4 and retry. If remuxing does not work, re-encode: run ffmpeg -i "26352160274-1-192.mp4" -c:v libx264 -crf 20 -c:a aac fixed.mp4.
  3. Put the repaired file in a short pure-English path without spaces and rename it to something simple, e.g. D:/videos/1.mp4. Your current paths, C:/video douyin/... and C:/win-pyvideotrans-v4.20/tmp/..., contain spaces, which increases the risk of unrelated ffmpeg errors.
  4. If the video really is several hours long, then this is a hard limitation of the current alignment engine. Split the video into segments of no more than about 2 hours each with a tool, then translate them one by one; otherwise the silent placeholder will always exceed the 4GB limit of WAV.
  5. When retrying, make sure Clear Output is checked and clear the leftover files from the previous failure under tmp/.

If after repairing the file the log still shows an abnormally long video_duration_ms, please provide the last 30 lines of the error information from the logs/ directory under the software installation directory for further judgment.

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