본문 바로가기

Programming/Manim Lectures

[03-5] Manim execution arguments

반응형

All execution arguments can be found by running 'python -m manim' in the Command Prompt window.

 

C:\now\manim>python -m manim
usage: manim.py [-h] [-p] [-w] [-s] [-l] [-m] [--high_quality] [-g] [-i] [-f]
                [-t] [-q] [-a] [-o FILE_NAME] [-n START_AT_ANIMATION_NUMBER]
                [-r RESOLUTION] [-c COLOR] [--sound] [--leave_progress_bars]
                [--media_dir MEDIA_DIR]
                [--video_dir VIDEO_DIR | --video_output_dir VIDEO_OUTPUT_DIR]
                [--tex_dir TEX_DIR] [--livestream] [--to-twitch]
                [--with-key TWITCH_KEY]
                [file] [scene_names [scene_names ...]]

positional arguments:
  file                  path to file holding the python code for the scene
  scene_names           Name of the Scene class you want to see

optional arguments:
  -h, --help            show this help message and exit
  -p, --preview         Automatically open the saved file once its done
  -w, --write_to_movie  Render the scene as a movie file
  -s, --save_last_frame
                        Save the last frame
  -l, --low_quality     Render at a low quality (for faster rendering)
  -m, --medium_quality  Render at a medium quality
  --high_quality        Render at a high quality
  -g, --save_pngs       Save each frame as a png
  -i, --save_as_gif     Save the video as gif
  -f, --show_file_in_finder
                        Show the output file in finder
  -t, --transparent     Render to a movie file with an alpha channel
  -q, --quiet
  -a, --write_all       Write all the scenes from a file
  -o FILE_NAME, --file_name FILE_NAME
                        Specify the name of the output file, ifit should be
                        different from the scene class name
  -n START_AT_ANIMATION_NUMBER, --start_at_animation_number START_AT_ANIMATION_NUMBER
                        Start rendering not from the first animation, butfrom
                        another, specified by its index. If you passin two
                        comma separated values, e.g. "3,6", it will endthe
                        rendering at the second value
  -r RESOLUTION, --resolution RESOLUTION
                        Resolution, passed as "height,width"
  -c COLOR, --color COLOR
                        Background color
  --sound               Play a success/failure sound
  --leave_progress_bars
                        Leave progress bars displayed in terminal
  --media_dir MEDIA_DIR
                        directory to write media
  --video_dir VIDEO_DIR
                        directory to write file tree for video
  --video_output_dir VIDEO_OUTPUT_DIR
                        directory to write video
  --tex_dir TEX_DIR     directory to write tex
  --livestream          Run in streaming mode
  --to-twitch           Stream to twitch
  --with-key TWITCH_KEY
                        Stream key for twitch

 

On this page I'll explain most frequently used arguments.

 

-ps

C:/now/manim>python -m manim exampel_scenes.py OpeningmanimExample -ps

Save the last frame as png file and show the picture after generating it.

It's convinent when you want to check your code works well or not quickly.


-pl, -pm, -p --high_quality

C:/now/manim>python -m manim exampel_scenes.py OpeningmanimExample -pl

C:/now/manim>python -m manim exampel_scenes.py OpeningmanimExample -pm

C:/now/manim>python -m manim exampel_scenes.py OpeningmanimExample -p --high_quality

C:/now/manim>python -m manim exampel_scenes.py OpeningmanimExample -l

C:/now/manim>python -m manim exampel_scenes.py OpeningmanimExample -m

C:/now/manim>python -m manim exampel_scenes.py OpeningmanimExample -- high_quality

 

'-pl' creates video with low quality and play the video file automatically after generation.

 

'-l' means low quality, '-m' is medium and '--high_quality' is high quality

 

Quality Level pixel_height pixel_width frame_rate
Low 480 854 15
Medium 720 1280 30
High 1080 1920 60

 

It's better to use '-pl' option during the development stage, and better to use '-pm' in the deployment stage.

 


--leave_progress_bars

This option shows the progress while rendering is performed. Therefore, we can catch up the number for certain animation and it's useful to use with '-n' option.

 


-n <start_number>, <end_number>

You can generate a video partially. 

 

The OpeningManimExample sample consists of 9 animations. (see above screen capture)

If you want to make video with Animation 0 to Animaion 4, you can do this:

 

 

If you want to generate from 6th animation to the end, the arguments will be '-n 6'

     

 

It's useful to make very big video file constist of many animations. 

If you want to check what you just made animation in the full animations, you can only generate the animations by specifying the animation number. It saves time compared to creating all animation frames.

 


Next: [03-6] Manim Components : Coordinate, Mobject, Animation)

 

[03-6] Manim Components : Coordinate, Mobject, Animation)

The process of creating a video in Manim can be said, "Create an object and animate it in the screen coordinate system." For example, if you consider the case of displaying a text object called 'Hel..

infograph.tistory.com

Go To: [99] Table of Contents

 

반응형