Skip to content

Commit df8cefe

Browse files
Fixed .gif related issues (#2494)
* fix-order of operations * Use ffplay to preview gifs * typo * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 35e1a42 commit df8cefe

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

manim/scene/scene_file_writer.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,12 @@ def init_output_directories(self, scene_name):
144144
if is_gif_format():
145145
self.gif_file_path = os.path.join(
146146
movie_dir,
147-
add_extension_if_not_present(self.output_name, GIF_FILE_EXTENSION),
147+
add_version_before_extension(
148+
add_extension_if_not_present(
149+
self.output_name,
150+
GIF_FILE_EXTENSION,
151+
),
152+
),
148153
)
149154

150155
self.partial_movie_directory = guarantee_existence(
@@ -606,7 +611,7 @@ def combine_to_movie(self):
606611
# determine output path
607612
movie_file_path = self.movie_file_path
608613
if is_gif_format() and not config["output_file"]:
609-
movie_file_path = str(add_version_before_extension(self.gif_file_path))
614+
movie_file_path = self.gif_file_path
610615
logger.info("Combining to Movie file.")
611616
self.combine_files(
612617
partial_movie_files,

manim/utils/file_ops.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,10 @@ def open_file(file_path, in_browser=False):
178178
commands = ["cygstart"]
179179
file_path = file_path if not in_browser else os.path.dirname(file_path)
180180
elif current_os == "Darwin":
181-
commands = ["open"] if not in_browser else ["open", "-R"]
181+
if is_gif_format():
182+
commands = ["ffplay", "-loglevel", config["ffmpeg_loglevel"].lower()]
183+
else:
184+
commands = ["open"] if not in_browser else ["open", "-R"]
182185
else:
183186
raise OSError("Unable to identify your operating system...")
184187
commands.append(file_path)

0 commit comments

Comments
 (0)