relative path

This commit is contained in:
Johannes Stelzer 2023-02-20 10:10:51 +01:00
parent 1f761f360b
commit 7f1eae9c66
1 changed files with 4 additions and 6 deletions

View File

@ -183,18 +183,16 @@ def concatenate_movies(fp_final: str, list_fp_movies: List[str]):
list_concat.append(f"""file '{fp_part}'""") list_concat.append(f"""file '{fp_part}'""")
# save this list # save this list
fp_list = fp_final[:-3] + "txt" fp_list = "tmp_move.txt"
with open(fp_list, "w") as fa: with open(fp_list, "w") as fa:
for item in list_concat: for item in list_concat:
fa.write("%s\n" % item) fa.write("%s\n" % item)
cmd = f'ffmpeg -f concat -safe 0 -i {fp_list} -c copy {fp_final}' cmd = f'ffmpeg -f concat -safe 0 -i {fp_list} -c copy {fp_final}'
dp_movie = os.path.split(fp_final)[0] dp_movie = os.path.split(fp_final)[0]
if len(dp_movie) > 0:
subprocess.call(cmd, shell=True, cwd=dp_movie)
else:
subprocess.call(cmd, shell=True) subprocess.call(cmd, shell=True)
os.remove(fp_list) os.remove(fp_list)
if os.path.isfile(fp_final):
print(f"concatenate_movies: success! Watch here: {fp_final}") print(f"concatenate_movies: success! Watch here: {fp_final}")