#4273 KeyError: 'duration'

107.173* Posted at: 2 hours ago 👁8

处理数据时缺少必需的键:'duration'
Traceback (most recent call last):
File "videotrans\util\help_ffmpeg.py", line 350, in get_video_info
KeyError: 'duration'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "videotrans\task\_only_one.py", line 42, in run
File "videotrans\task\trans_create.py", line 173, in prepare
File "videotrans\util\help_ffmpeg.py", line 354, in get_video_info
KeyError: 'duration'


=
system:Windows-10-10.0.19045-SP0
version:v3.99
frozen:True
language:zh
root_dir:M:/GAME_M/AI/PyVideoTrans/win-pyvideotrans-v3.99-420

1 Replies

这是ffmpeg无法读取视频信息导致的,通常由文件损坏、路径过长或含特殊符号引起。

  1. 检查视频文件:确保视频能正常播放,未被损坏。
  2. 简化路径和文件名

    • 将视频移动到短目录(如 D:\test)。
    • 重命名为不含中文、空格、特殊符号的简短英文名(例如 1.mp4)。
  3. 检查编码格式:建议使用 H.264 编码的 MP4 文件,兼容性最好。

如果以上均无效,请提供软件目录下 logs/ 文件夹中最新日志的底部约 30 行内容,以便进一步定位。

请查阅相关文档:

Post Your Reply
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.

Related resource