Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Change ffmpeg loglevel to a string

azarzadavila624b6ab38a06
diff --git a/manim/constants.py b/manim/constants.py
index ce981915d..d5ad0affc 100644
--- a/manim/constants.py
+++ b/manim/constants.py
@@ -150,9 +150,9 @@ PALETTE = list(COLOR_MAP.values())
locals().update(COLOR_MAP)
VERBOSE_CHOICES = ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]
VERBOSE_FFMPEG_MAP = {
- "DEBUG": 16,
- "INFO": 16,
- "WARNING": 16,
- "ERROR": 16,
- "CRITICAL": 8,
+ "DEBUG": "error",
+ "INFO": "error",
+ "WARNING": "error",
+ "ERROR": "error",
+ "CRITICAL": "fatal",
}
diff --git a/manim/scene/scene_file_writer.py b/manim/scene/scene_file_writer.py
index 6cbf53a52..6fba3cd9b 100644
--- a/manim/scene/scene_file_writer.py
+++ b/manim/scene/scene_file_writer.py
@@ -391,7 +391,7 @@ class SceneFileWriter(object):
'-r', str(fps), # frames per second
'-i', '-', # The imput comes from a pipe
'-an', # Tells FFMPEG not to expect any audio
- '-loglevel', str(file_writer_config["ffmpeg"]),
+ '-loglevel', file_writer_config["ffmpeg"],
]
# TODO, the test for a transparent background should not be based on
# the file extension.
@@ -472,7 +472,7 @@ class SceneFileWriter(object):
'-f', 'concat',
'-safe', '0',
'-i', file_list,
- '-loglevel', str(file_writer_config["ffmpeg"]),
+ '-loglevel', file_writer_config["ffmpeg"],
]
if self.write_to_movie:
@@ -514,7 +514,7 @@ class SceneFileWriter(object):
"-map", "0:v:0",
# select audio stream from second file
"-map", "1:a:0",
- '-loglevel', str(file_writer_config["ffmpeg"]),
+ '-loglevel', file_writer_config["ffmpeg"],
# "-shortest",
temp_file_path,
]
diff --git a/manim/utils/config_utils.py b/manim/utils/config_utils.py
index 4791ac821..8d14786e5 100644
--- a/manim/utils/config_utils.py
+++ b/manim/utils/config_utils.py
@@ -130,8 +130,7 @@ def _parse_file_writer_config(config_parser, args):
verbose = default["verbose"] if verbose is None else verbose
fw_config["verbose"] = verbose
ffmpeg = getattr(args, "ffmpeg")
- if ffmpeg is None and default.getint("ffmpeg", None) is not None:
- ffmpeg = default.getint("ffmpeg")
+ ffmpeg = default.get("ffmpeg", None) if ffmpeg is None else ffmpeg
fw_config["ffmpeg"] = constants.VERBOSE_FFMPEG_MAP[verbose] if ffmpeg is None else ffmpeg
if verbose in ["DEBUG", "INFO"]:
progress_bar_v = True
@@ -346,10 +345,11 @@ def _parse_cli(arg_list, input=True):
)
parser.add_argument(
"-L", "--ffmpeg",
- type=int,
+ type=str,
help="Log level for ffmpeg",
metavar="loglevel",
- choices=[-8, 0, 8, 16, 24, 32, 40, 48, 56],
+ choices=["-8", "0", "8", "16", "24", "32", "40", "48", "56",
+ "quiet", "panic", "fatal", "error", "warning", "info", "verbose", "debug", "trace"],
)
parser.add_argument(
"--progress_bar",