A community-maintained Python framework for creating mathematical animations.
Merge remote-tracking branch 'fork/master' into verbose
azarzadavila7c1c11b41536
diff --cc manim/config.pyindex 1efa6da29,a6584a49d..e9216deff--- a/manim/config.py+++ b/manim/config.py@@@ -88,9 -88,11 +88,12 @@@ def _parse_config(config_parser, args)args, config_parser, file_writer_config, successfully_read_files = _run_config()+logger.setLevel(file_writer_config["verbose"])if _from_command_line():- logger.info(f"Read configuration files: {os.path.abspath(successfully_read_files[-1])}")- _init_dirs(file_writer_config)+ logger.info(+ f"Read configuration files: {[os.path.abspath(cfgfile) for cfgfile in successfully_read_files]}"+ )+ if not (hasattr(args, "subcommands")):+ _init_dirs(file_writer_config)config = _parse_config(config_parser, args)camera_config = configdiff --cc manim/constants.pyindex 82782a7b0,e9f41a79f..81674b220--- a/manim/constants.py+++ b/manim/constants.py@@@ -143,16 -143,12 +143,20 @@@ COLOR_MAP ="GREEN_SCREEN": "#00FF00","ORANGE": "#FF862F",}- COLOR_MAP.update({name.replace("_C", ""): COLOR_MAP[name]- for name in COLOR_MAP- if name.endswith("_C")})+ COLOR_MAP.update(+ {+ name.replace("_C", ""): COLOR_MAP[name]+ for name in COLOR_MAP+ if name.endswith("_C")+ }+ )PALETTE = list(COLOR_MAP.values())locals().update(COLOR_MAP)+VERBOSE_FFMPEG_MAP = {+ "DEBUG": "error",+ "INFO": "error",+ "WARNING": "error",+ "ERROR": "error",+ "CRITICAL": "fatal",+}+VERBOSE_CHOICES = VERBOSE_FFMPEG_MAP.keys()diff --cc manim/scene/scene.pyindex 8d2d83147,2985b4bdd..70ba5bc4e--- a/manim/scene/scene.py+++ b/manim/scene/scene.py@@@ -681,10 -677,10 +677,11 @@@ class Scene(Container)step = 1 / self.camera.frame_ratetimes = np.arange(0, run_time, step)time_progression = ProgressDisplay(- times, total=n_iterations,- leave=file_writer_config['leave_progress_bars'],- ascii=True if platform.system() == 'Windows' else None,+ times,+ total=n_iterations,+ leave=file_writer_config["leave_progress_bars"],+ ascii=True if platform.system() == "Windows" else None,+ disable=not file_writer_config["progress_bar"],)return time_progressiondiff --cc manim/scene/scene_file_writer.pyindex d2ad20d2b,10168e00c..4a616dd9b--- a/manim/scene/scene_file_writer.py+++ b/manim/scene/scene_file_writer.py@@@ -384,14 -376,20 +376,20 @@@ class SceneFileWriter(object)command = [FFMPEG_BIN,- '-y', # overwrite output file if it exists- '-f', 'rawvideo',- '-s', '%dx%d' % (width, height), # size of one frame- '-pix_fmt', 'rgba',- '-r', str(fps), # frames per second- '-i', '-', # The imput comes from a pipe- '-an', # Tells FFMPEG not to expect any audio- '-loglevel', file_writer_config["ffmpeg_loglevel"],+ "-y", # overwrite output file if it exists+ "-f",+ "rawvideo",+ "-s",+ "%dx%d" % (width, height), # size of one frame+ "-pix_fmt",+ "rgba",+ "-r",+ str(fps), # frames per second+ "-i",+ "-", # The imput comes from a pipe+ "-an", # Tells FFMPEG not to expect any audio+ "-loglevel",- "error",++ file_writer_config["ffmpeg_loglevel"],]# TODO, the test for a transparent background should not be based on# the file extension.@@@ -468,11 -466,15 +466,15 @@@movie_file_path = self.get_movie_file_path()commands = [FFMPEG_BIN,- '-y', # overwrite output file if it exists- '-f', 'concat',- '-safe', '0',- '-i', file_list,- '-loglevel', file_writer_config["ffmpeg_loglevel"],+ "-y", # overwrite output file if it exists+ "-f",+ "concat",+ "-safe",+ "0",+ "-i",+ file_list,+ "-loglevel",- "error",++ file_writer_config["ffmpeg_loglevel"],]if self.write_to_movie:@@@ -504,17 -500,25 +500,25 @@@temp_file_path = movie_file_path.replace(".", "_temp.")commands = [FFMPEG_BIN,- "-i", movie_file_path,- "-i", sound_file_path,- '-y', # overwrite output file if it exists- "-c:v", "copy",- "-c:a", "aac",- "-b:a", "320k",+ "-i",+ movie_file_path,+ "-i",+ sound_file_path,+ "-y", # overwrite output file if it exists+ "-c:v",+ "copy",+ "-c:a",+ "aac",+ "-b:a",+ "320k",# select video stream from first file- "-map", "0:v:0",+ "-map",+ "0:v:0",# select audio stream from second file- "-map", "1:a:0",- '-loglevel', file_writer_config["ffmpeg_loglevel"],+ "-map",+ "1:a:0",+ "-loglevel",- "error",++ file_writer_config["ffmpeg_loglevel"],# "-shortest",temp_file_path,]diff --cc manim/utils/config_utils.pyindex 00fdc2fa5,4d310edf6..16304a3e3--- a/manim/utils/config_utils.py+++ b/manim/utils/config_utils.py@@@ -323,28 -350,17 +360,40 @@@ def _parse_cli(arg_list, input=True)parser.add_argument("--config_file", help="Specify the configuration file",)+++ # Specify the verbosity+ parser.add_argument(+ "-v", "--verbose",+ type=str,+ help="Verbosity level. Also changes the ffmpeg log level unless the latter is specified in the config",+ choices=constants.VERBOSE_CHOICES,+ )+++ # Specify if the progress bar should be displayed+ def _str2bool(s):+ if s == "True":+ return True+ elif s == "False":+ return False+ else:+ raise argparse.ArgumentTypeError("True or False expected")+ parser.add_argument(+ "--progress_bar",+ type=_str2bool,+ help="Display the progress bar",+ metavar="True/False",+ )- return parser.parse_args(arg_list)+ parsed = parser.parse_args(arg_list)+ if hasattr(parsed, "subcommands"):+ setattr(+ parsed,+ "cfg_subcommand",+ cfg_related.parse_args(+ sys.argv[min_argvs - (0 if min_argvs == 2 else 1) :]+ ).cfg_subcommand,+ )++ return parseddef _init_dirs(config):