This commit is contained in:
shikong 2024-03-19 08:51:25 +08:00
parent 33185bdc1f
commit db293c8430

21
test/merge.py Normal file
View File

@ -0,0 +1,21 @@
import subprocess
import os
ffmpeg_path = "ffmpeg"
cmd = f"{ffmpeg_path} -y -loglevel error -f concat -safe 0 -i %s -c copy test.mp4"
tmp_merge_file = "merge.tmp"
with open(tmp_merge_file, mode="w", encoding="utf8") as f:
f.write("file './72439149X00E26C681B09_20240311000015_20240311000030.mp4'\n")
# f.write("file ./72439149X00E26C681B09_20240311001015_20240311001030.mp4")
proc = subprocess.Popen(
cmd % tmp_merge_file,
stdin=subprocess.PIPE,
stdout=None,
shell=True
)
proc.communicate()
os.remove(tmp_merge_file)