2021-01-26 14:57:05 +08:00
CLI flags and configuration
===========================
Command Line Interface
----------------------
2021-02-08 12:04:29 +08:00
To run manim, you need to enter the directory at the same level as `` manimlib/ ``
2021-01-26 14:57:05 +08:00
and enter the command in the following format into terminal:
.. code-block :: sh
2021-02-08 12:04:29 +08:00
manimgl <code>.py <Scene> <flags>
# or
manim-render <code>.py <Scene> <flags>
2021-01-26 14:57:05 +08:00
2021-02-08 12:04:29 +08:00
- `` <code>.py `` : The python file you wrote. Needs to be at the same level as `` manimlib/ `` , otherwise you need to use an absolute path or a relative path.
2021-01-26 14:57:05 +08:00
- `` <Scene> `` : The scene you want to render here. If it is not written or written incorrectly, it will list all for you to choose. And if there is only one `` Scene `` in the file, this class will be rendered directly.
- `` <flags> `` : CLI flags.
Some useful flags
^^^^^^^^^^^^^^^^^
- `` -w `` to write the scene to a file.
- `` -o `` to write the scene to a file and open the result.
- `` -s `` to skip to the end and just show the final frame.
2021-01-31 21:37:53 +08:00
2021-01-31 22:29:19 +08:00
- `` -so `` will save the final frame to an image and show it.
2021-01-26 14:57:05 +08:00
- `` -n <number> `` to skip ahead to the `` n ` ` \ ’ th animation of a scene.
- `` -f `` to make the playback window fullscreen.
All supported flags
^^^^^^^^^^^^^^^^^^^
2022-06-28 09:13:41 +08:00
========================================================== ====== =====================================================================================================================================================================================================
2021-01-26 14:57:05 +08:00
flag abbr function
2022-06-28 09:13:41 +08:00
========================================================== ====== =====================================================================================================================================================================================================
2021-01-26 14:57:05 +08:00
`` --help `` `` -h `` Show the help message and exit
2022-06-28 09:13:41 +08:00
`` --version `` `` -v `` Display the version of manimgl
2021-01-26 14:57:05 +08:00
`` --write_file `` `` -w `` Render the scene as a movie file
`` --skip_animations `` `` -s `` Skip to the last frame
`` --low_quality `` `` -l `` Render at a low quality (for faster rendering)
`` --medium_quality `` `` -m `` Render at a medium quality
`` --hd `` Render at a 1080p quality
`` --uhd `` Render at a 4k quality
`` --full_screen `` `` -f `` Show window in full screen
2022-02-14 19:50:30 +08:00
`` --presenter_mode `` `` -p `` Scene will stay paused during wait calls until space bar or right arrow is hit, like a slide show
2021-01-26 14:57:05 +08:00
`` --save_pngs `` `` -g `` Save each frame as a png
2022-06-28 09:13:41 +08:00
`` --gif `` `` -i `` Save the video as gif
2021-01-26 14:57:05 +08:00
`` --transparent `` `` -t `` Render to a movie file with an alpha channel
`` --quiet `` `` -q ``
`` --write_all `` `` -a `` Write all the scenes from a file
`` --open `` `` -o `` Automatically open the saved file once its done
`` --finder `` Show the output file in finder
2021-02-08 12:04:29 +08:00
`` --config `` Guide for automatic configuration
2021-01-26 14:57:05 +08:00
`` --file_name FILE_NAME `` Name for the movie or image file
2021-08-07 22:25:26 +07:00
`` --start_at_animation_number START_AT_ANIMATION_NUMBER `` `` -n `` Start rendering not from the first animation, but from another, specified by its index. If you passing two comma separated values, e.g. "3,6", it will end the rendering at the second value.
2022-06-28 09:13:41 +08:00
`` --embed [EMBED] `` `` -e `` Creates a new file where the line `` self.embed `` is inserted into the Scenes construct method. If a string is passed in, the line will be inserted below the last line of code including that string.
2021-01-26 14:57:05 +08:00
`` --resolution RESOLUTION `` `` -r `` Resolution, passed as "WxH", e.g. "1920x1080"
2022-06-28 09:13:41 +08:00
`` --fps FPS `` Frame rate, as an integer
2021-01-26 14:57:05 +08:00
`` --color COLOR `` `` -c `` Background color
`` --leave_progress_bars `` Leave progress bars displayed in terminal
2022-02-14 19:50:30 +08:00
`` --video_dir VIDEO_DIR `` Directory to write video
2021-06-14 16:36:16 +08:00
`` --config_file CONFIG_FILE `` Path to the custom configuration file
2022-06-28 09:13:41 +08:00
`` --log-level LOG_LEVEL `` Level of messages to Display, can be DEBUG / INFO / WARNING / ERROR / CRITICAL
2024-12-12 08:52:03 -06:00
`` --autoreload `` Automatically reload Python modules to pick up code changes across different files
2022-06-28 09:13:41 +08:00
========================================================== ====== =====================================================================================================================================================================================================
2021-01-26 14:57:05 +08:00
2021-02-08 12:04:29 +08:00
custom_config
2021-01-26 14:57:05 +08:00
--------------
In order to perform more configuration (about directories, etc.) and permanently
change the default value (you don't have to add flags to the command every time),
2021-02-08 12:04:29 +08:00
you can modify `` custom_config.yml `` . The meaning of each option is in
page :doc: `../documentation/custom_config` .
2021-01-26 14:57:05 +08:00
2021-02-08 12:04:29 +08:00
You can also use different `` custom_config.yml `` for different directories, such as
2021-01-26 14:57:05 +08:00
following the directory structure:
.. code-block :: text
manim/
├── manimlib/
│ ├── animation/
│ ├── ...
2021-02-08 12:04:29 +08:00
│ ├── default_config.yml
2021-01-26 14:57:05 +08:00
│ └── window.py
├── project/
│ ├── code.py
2021-02-08 12:04:29 +08:00
│ └── custom_config.yml
└── custom_config.yml
2021-01-26 14:57:05 +08:00
2021-02-08 12:04:29 +08:00
When you enter the `` project/ `` folder and run `` manimgl code.py <Scene> `` ,
2021-06-14 13:30:37 +08:00
it will overwrite `` manim/default_config.yml `` with `` custom_config.yml ``
2021-06-14 16:36:16 +08:00
in the `` project `` folder.
Alternatively, you can use `` --config_file `` flag in CLI to specify configuration file manually.
.. code-block :: sh
manimgl project/code.py --config_file /path/to/custom_config.yml