以KeyFrame切割

This commit is contained in:
Jerry Yan 2022-03-29 16:56:29 +08:00
parent 124cae105e
commit a43b47c0b8

View File

@ -11,7 +11,7 @@ OVERFLOW_SEC = 4
def get_video_real_duration(filename):
ffmpeg_process = subprocess.Popen([
"ffmpeg", "-i", filename, "-c", "copy", "-f", "null", "-"
"ffmpeg", "-hide_banner", "-i", filename, "-c", "copy", "-f", "null", "-"
], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
result = "0:0:0.0"
for line in ffmpeg_process.stderr.readlines():
@ -44,9 +44,9 @@ if __name__ == '__main__':
print("BIAS_T", current_sec)
split_process = subprocess.Popen([
"ffmpeg", "-y", "-hide_banner", "-progress", "-", "-v", "0",
"-ss", str(current_sec),
"-i", input_file, "-c", "copy", "-f", "mp4",
"-t", str(EACH_SEC + OVERFLOW_SEC),
"-ss", str(current_sec),
"{}.mp4".format(current_dt)
])
split_process.wait()