bugfix if in local dir

This commit is contained in:
Johannes Stelzer 2023-01-15 16:53:51 +01:00
parent 20147a17c6
commit 9861261592
1 changed files with 7 additions and 4 deletions

View File

@ -188,9 +188,12 @@ def concatenate_movies(fp_final: str, list_fp_movies: List[str]):
for item in list_concat:
fa.write("%s\n" % item)
dp_movie = os.path.split(fp_final)[0]
cmd = f'ffmpeg -f concat -safe 0 -i {fp_list} -c copy {fp_final}'
subprocess.call(cmd, shell=True, cwd=dp_movie)
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)
os.remove(fp_list)
print(f"concatenate_movies: success! Watch here: {fp_final}")
@ -221,7 +224,7 @@ if __name__ == "__main__":
fps=2
list_fp_movies = []
for k in range(4):
fp_movie = f"/tmp/my_random_movie_{k}.mkv"
fp_movie = f"/tmp/my_random_movie_{k}.mp4"
list_fp_movies.append(fp_movie)
ms = MovieSaver(fp_movie, fps=fps)
for fn in tqdm(range(30)):
@ -229,6 +232,6 @@ if __name__ == "__main__":
ms.write_frame(img)
ms.finalize()
fp_final = "/tmp/my_concatenated_movie.mkv"
fp_final = "/tmp/my_concatenated_movie.mp4"
concatenate_movies(fp_final, list_fp_movies)