Skip to content

Commit

Permalink
fix(lib): check if reversed file exist (#231)
Browse files Browse the repository at this point in the history
This fixes a bug that would block the process forever because FFMPEG was asking if it could overwrite or not.
  • Loading branch information
jeertmans authored Aug 2, 2023
1 parent 98fa534 commit 1e96789
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions manim_slides/slide.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

def reverse_video_file(src: Path, dst: Path) -> None:
"""Reverses a video file, writting the result to `dst`."""
command = [str(FFMPEG_BIN), "-i", str(src), "-vf", "reverse", str(dst)]
command = [str(FFMPEG_BIN), "-y", "-i", str(src), "-vf", "reverse", str(dst)]
logger.debug(" ".join(command))
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output, error = process.communicate()
Expand Down Expand Up @@ -520,7 +520,8 @@ def __save_slides(self, use_cache: bool = True) -> None:
old_animation_files.remove(rev_filename)
else:
rev_file = scene_files_folder / rev_filename
reverse_video_file(src_file, rev_file)
if not rev_file.exists():
reverse_video_file(src_file, rev_file)

files.append(dst_file)

Expand Down

0 comments on commit 1e96789

Please sign in to comment.