```

def get_video_duration(filename: str) -> float:

"""

获取音视频的时长

:param filename:

:return:

"""

try:

result = subprocess.run(["ffprobe", "-v", "error", "-show_entries",

"format=duration", "-of",

"default=noprint_wrappers=1:nokey=1", filename],

stdout=subprocess.PIPE,

stderr=subprocess.STDOUT)

return float(result.stdout)

except:

return 0

```