Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Removed temporary partial movie file in scenefilewriter (#817)

farahasha67f358683fb
diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst
index 1a091a612..2e18c49d2 100644
--- a/docs/source/changelog.rst
+++ b/docs/source/changelog.rst
@@ -26,6 +26,10 @@ Bugfixes
- There is nothing here yet, check back later.
+Other Changes
+=============
+
+#. Removed temp partial movie file from SceneFileWriter (ffmpeg directly renders partial movie files instead of temp files)
******
v0.1.1
@@ -206,4 +210,4 @@ Other Changes
#. Cleanup 3b1b Specific Files
#. Rename package from manimlib to manim
#. Move all imports to :code:`__init__`, so :code:`from manim import *` replaces :code:`from manimlib.imports import *`
-#. Global dir variable handling has been removed. Instead :code:`initialize_directories`, if needed, overrides the values from the cfg files at runtime.
+#. Global dir variable handling has been removed. Instead :code:`initialize_directories`, if needed, overrides the values from the cfg files at runtime.
\ No newline at end of file
diff --git a/manim/scene/scene_file_writer.py b/manim/scene/scene_file_writer.py
index 2783e5854..a8bfe4019 100644
--- a/manim/scene/scene_file_writer.py
+++ b/manim/scene/scene_file_writer.py
@@ -340,13 +340,7 @@ class SceneFileWriter(object):
buffer.
"""
file_path = self.partial_movie_files[self.renderer.num_plays]
-
- # TODO #486 Why does ffmpeg need temp files ?
- temp_file_path = (
- os.path.splitext(file_path)[0] + "_temp" + config["movie_file_extension"]
- )
self.partial_movie_file_path = file_path
- self.temp_partial_movie_file_path = temp_file_path
fps = config["frame_rate"]
height = config["pixel_height"]
@@ -373,21 +367,16 @@ class SceneFileWriter(object):
command += ["-vcodec", "qtrle"]
else:
command += ["-vcodec", "libx264", "-pix_fmt", "yuv420p"]
- command += [temp_file_path]
+ command += [file_path]
self.writing_process = subprocess.Popen(command, stdin=subprocess.PIPE)
def close_movie_pipe(self):
"""
- Used internally by Manim to gracefully stop writing to FFMPEG's
- input buffer, and move the temporary files into their permananant
- locations
+ Used internally by Manim to gracefully stop writing to FFMPEG's input buffer
"""
self.writing_process.stdin.close()
self.writing_process.wait()
- shutil.move(
- self.temp_partial_movie_file_path,
- self.partial_movie_file_path,
- )
+
logger.info(
f"Animation {self.renderer.num_plays} : Partial movie file written in %(path)s",
{"path": {self.partial_movie_file_path}},