🐛 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,19 +75,19 @@ def _set_proc_title(title: str) -> None:
|
|||||||
|
|
||||||
def get_duration(input_path):
|
def get_duration(input_path):
|
||||||
"""用 ffprobe 获取视频时长(秒),失败返回 None"""
|
"""用 ffprobe 获取视频时长(秒),失败返回 None"""
|
||||||
result = subprocess.run(
|
|
||||||
[
|
|
||||||
"ffprobe", "-v", "error",
|
|
||||||
"-show_entries", "format=duration",
|
|
||||||
"-of", "default=noprint_wrappers=1:nokey=1",
|
|
||||||
str(input_path),
|
|
||||||
],
|
|
||||||
capture_output=True,
|
|
||||||
text=True,
|
|
||||||
)
|
|
||||||
try:
|
try:
|
||||||
|
result = subprocess.run(
|
||||||
|
[
|
||||||
|
"ffprobe", "-v", "error",
|
||||||
|
"-show_entries", "format=duration",
|
||||||
|
"-of", "default=noprint_wrappers=1:nokey=1",
|
||||||
|
str(input_path),
|
||||||
|
],
|
||||||
|
capture_output=True,
|
||||||
|
text=True,
|
||||||
|
)
|
||||||
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