# audio duration
def make_duration(file_path):
result = sp.run(["ffprobe", "-v", "error", "-show_entries",
"format=duration", "-of",
"default=noprint_wrappers=1:nokey=1", file_path],
stdout=sp.PIPE,
stderr=sp.STDOUT)
return float(result.stdout)
# cut video and audio
cmd_split_line = 'ffmpeg -loglevel quiet -ss {} -to {} -accurate_seek -i "{}" "{}" -y'.format(start_time, end_time, self.file_path, dst_mp4_path)
sp.check_call(cmd_split_line, shell=True, stderr=open(os.devnull, 'w'))
标签:cmd,ffmpeg,sp,音频视频,切分,file,duration,path
From: https://www.cnblogs.com/yunhgu/p/17652038.html