mirror of
https://github.com/jeertmans/manim-slides.git
synced 2025-08-06 14:19:52 +08:00
fix(lib): check if reversed file exist (#231)
This fixes a bug that would block the process forever because FFMPEG was asking if it could overwrite or not.
This commit is contained in:
@ -37,7 +37,7 @@ from .manim import (
|
|||||||
|
|
||||||
def reverse_video_file(src: Path, dst: Path) -> None:
|
def reverse_video_file(src: Path, dst: Path) -> None:
|
||||||
"""Reverses a video file, writting the result to `dst`."""
|
"""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))
|
logger.debug(" ".join(command))
|
||||||
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
output, error = process.communicate()
|
output, error = process.communicate()
|
||||||
@ -520,6 +520,7 @@ class Slide(Scene): # type:ignore
|
|||||||
old_animation_files.remove(rev_filename)
|
old_animation_files.remove(rev_filename)
|
||||||
else:
|
else:
|
||||||
rev_file = scene_files_folder / rev_filename
|
rev_file = scene_files_folder / rev_filename
|
||||||
|
if not rev_file.exists():
|
||||||
reverse_video_file(src_file, rev_file)
|
reverse_video_file(src_file, rev_file)
|
||||||
|
|
||||||
files.append(dst_file)
|
files.append(dst_file)
|
||||||
|
Reference in New Issue
Block a user