🐛 fix(av1-transfer): catch FileNotFoundError in get_duration when ffprobe is missing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
FlintyLemming
2026-02-28 11:05:11 +08:00
parent bf98b6d002
commit c31a459f36

View File

@@ -75,6 +75,7 @@ def _set_proc_title(title: str) -> None:
def get_duration(input_path):
"""用 ffprobe 获取视频时长(秒),失败返回 None"""
try:
result = subprocess.run(
[
"ffprobe", "-v", "error",
@@ -85,9 +86,8 @@ def get_duration(input_path):
capture_output=True,
text=True,
)
try:
return float(result.stdout.strip())
except (ValueError, AttributeError):
except Exception:
return None