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