Command-Line Rendering

Answers to the most commonly asked Moho questions.

Moderator: Belgarath

Post Reply
User avatar
Lost Marble
Site Admin
Posts: 2347
Joined: Tue Aug 03, 2004 6:02 pm
Location: Scotts Valley, California, USA
Contact:

Command-Line Rendering

Post by Lost Marble »

Starting with version 5.1, Anime Studio now includes a command-line rendering mode. For many people, this may not be of much interest - just use the GUI-based batch rendering mode instead. If you are interested in command-line rendering, you know who you are, so keep reading.

To use Anime Studio for command-line rendering, all you need to do is type a simple command:

Anime\ Studio\ Pro -r infile.anme

This is the simplest way to invoke Anime Studio from the command-line. The command tells Anime Studio to render the file "infile.anme" and to produce a rendered output file (more on that below). It can be used directly from a command prompt, or can be integrated into whatever scripting environment you choose.

(Each platform - Windows, Mac OS, and Linux has some specific quirks when using Anime Studio this way. Be sure to read the posts below to learn about your particular platform.)

The following options are available:

-r filename.anme This is the only required command. It tells Anime Studio to render the given file and then quit. No GUI will be launched.

-v Runs the rendering job in "verbose" mode. In this mode, Anime Studio will print out messages about its status, including an estimate of the time remaining in the rendering job.

-q Runs the renderer in "quiet" mode. "quiet" mode disables all command-line output, both information and errors. "quiet" mode overrides "verbose" mode. This option was introduced in Anime Studio Pro 9.5.

-log logfile Specifies a log file for the render. Information and errors that are normally shown as command-line output are instead logged to the log file. This option was introduced in Anime Studio Pro 9.5.

-f format This tells Anime Studio what format to render the output as. Valid formats are QT (QuickTime - Windows and Mac only), JPEG, TGA, BMP, PNG, or SWF (Flash). The QT and SWF formats generate a single output file, while the other formats created numbered sequences of still images. If you don't specify a format, on Windows and Mac the default format is QT, on Linux the default is JPEG.

NOTE: Starting in Anime Studio Pro 9.5, the format type must be entered in lower case. Use jpeg instead of JPEG, png instead of PNG, etc.

-o outfile Specifies an output file. If you skip this option, the output file will have the same name as the input file, but with an extension matching the format you choose.

-outfolder folder Specifies an output folder for the render. The name of the output file will be named based on the file name of the document. For example, a document named MyAnimation.anme will create a movie in the output folder called MyAnimation.mov if the specified render format is QuickTime. Note that -outfolder folder overrides -o outfile. This option was introduced in Anime Studio Pro 9.5.

-start frame Specifies the starting frame to render. If omitted, Anime Studio will start rendering at the document's start frame (usually 1).

-end frame Specifies the last frame to render. If omitted, Anime Studio will render up through the last frame of the document.

The following options control rendering options, just like you see in the Export Animation dialog in Anime Studio, and can be turned on or off with a value of yes or no. The default value is marked with an asterisk.

-aa yes*/no Antialiased edges
-shapefx yes*/no Render shape effects
-layerfx yes*/no Render layer effects
-halfsize yes/no* Render at half size
-halffps yes/no* Render at half frame rate
-fewparticles yes/no* Use reduced particles
-extrasmooth yes/no* Extra-smooth images
-ntscsafe yes/no* NTSC safe colors
-premultiply yes*/no Premultiply alpha
-variablewidths yes/no* Variable line widths (only applies to SWF format)

Here are some examples:

Anime\ Studio\ Pro -r file.anme -o /movie/scene01/shot03/preview.mov -f QT -start 12 -aa no -halfsize yes

Reading the options left-to-right, the command above will render the file "file.anme", creating the result "/movie/scene01/shot03/preview.mov", in QuickTime format, starting at frame 12 (and continuing to the document's end frame), with no antialiasing and at half the file's normal pixel dimensions.

Anime\ Studio\ Pro -r lenny.anme -start 124 -end 124 -f PNG

The command above renders a single frame of the file "file.anme", frame 124 (the start and end frames are the same. The result is in PNG format. Since no output file is specified, the output file will be same as the input file, but with an appropriate extension for the format chosen - in this case the output file would be automatically named "lenny0124.png".

Anime\ Studio\ Pro -r file.anme

And of course, the most simple example. This command would produce the file "file.mov" in QuickTime format on Windows and Mac, or a sequence of JPEG still images on Linux.

Regarding QuickTime: When rendering from the command line, Anime Studio will use the codec and codec settings that you last used in Moho's GUI mode. So, to change the QuickTime settings used by the command line mode, you need to render a QuickTime movie (even a short, tiny one) in GUI mode, entering the settings you wish to use.

Finally, be sure to read the notes below regarding your particular operating system.

Let's build some Anime Studio render farms!

-------------------------------------------

Some new options were added with Anime Studio 10, but we neglected to document them here. Here are some new options that can be used from the command line:

-layercomp <comp name>
Render a specific layer comp. You can also specify 'All' (no quotes) and all layer comps will be exported through one run of the renderer. If 'All' is specified, the final documents will have a suffix added based on the layer comp name. For example, if the -output parameter specified is MyAnimation.mp4, the movie files would be named:

MyAnimation-LayerComp1.mp4
MyAnimation-LayerComp2.mp4
MyAnimation-LayerComp3.mp4
etc..

If you only specify one layer comp, the comp name will not be appended to the output file name. Layer comps that have spaces MUST be in double quotes. For example: -layercomp "My Background"

-videocodec <number>
The number is the fourcc value for the QuickTime codec. This option ONLY works with a format of quicktime (aka qt or mov). Here is a list of FOURCC codes, not all work with QuickTime:

http://www.fourcc.org/codecs.php

The FOURCC code must be converted to a 32-bit integer before being passed to the command-line. I'll try and come back to this post and add the common values for the FOURCC codes that QuickTime supports. Also in 10.1, we will see about making -videocodec more user friendly so that you can specify something like "H.264" or "Animation" instead of this ugly integer number.

NOTE: Specifying -videocodec does not work with the "QuickTime" presets on Mac. (e.g. "QuickTime (H.264-AAC)")

-quality <number>
The quality of the export. This option ONLY works with a format of quicktime (aka qt or mov). Quality is a number between 0 and 5. The default is 3.

0 = Minimum Quality
1 = Low Quality
2 = Normal Quality
3 = High Quality
4 = Max Quality
5 = Lossless Quality

NOTE: Specifying -quality does not work with the "QuickTime" presets on Mac. (e.g. "QuickTime (H.264-AAC)")

-depth <number>
The pixel depth of the export. This option ONLY works with a format of quicktime (aka qt or mov). The value defaults to 24, but for some codecs like Animation, you can specify a depth of 32.

NOTE: Specifying -depth does not work with the "QuickTime" presets on Mac. (e.g. "QuickTime (H.264-AAC)")

-addformatsuffix
Append the format name to the file name of the output path. This option is not new. It was available in 9.5. I just wanted to point it out here. An example of this is if you specified a format of "MP4 (H.264-AAC)", the output file would be named: MyAnimation-MP4 (H.264-AAC).mp4

-deletedocument
After the render completes, delete the .anme document. I am not sure how many people will want to use this since it could be dangerous. We use this internally to delete temporary .anme files after a render completes.
Last edited by Lost Marble on Fri Sep 14, 2007 6:36 pm, edited 2 times in total.
User avatar
Lost Marble
Site Admin
Posts: 2347
Joined: Tue Aug 03, 2004 6:02 pm
Location: Scotts Valley, California, USA
Contact:

Windows quirks

Post by Lost Marble »

Windows Quirks

On Windows, the Anime Studio executable is named Anime Studio Pro.exe, but you can type in either "Anime\ Studio\ Pro" or "Anime\ Studio\ Pro.exe".

Also, Windows GUI programs are normally unable to print output to the command line. So, when running Anime Studio in command-line rendering mode, you will not be able to see any error messages, or progress notifications. (We're working on a solution for this.)

I personally dislike the Windows command line. If you prefer a UNIX-style command line, try out the free Cygwin tools, which include a bash shell for Windows:

http://www.cygwin.com/
Last edited by Lost Marble on Fri Sep 14, 2007 6:37 pm, edited 2 times in total.
User avatar
Lost Marble
Site Admin
Posts: 2347
Joined: Tue Aug 03, 2004 6:02 pm
Location: Scotts Valley, California, USA
Contact:

Mac quirks

Post by Lost Marble »

Mac Quirks

On Mac OS, GUI applications are wrapped up in "bundles". The Anime Studio application you see in the Finder is actually a folder containing lots of little files. What this means is that to run it from the command-line, you need to do things a little differently. Instead of this:

Anime\ Studio\ Pro -r file.moho

You need to use this command:

Anime\ Studio\ Pro.app/Contents/MacOS/Anime\ Studio\ Pro -r file.anme

Or, if the Anime Studio folder is not in your path, use this command (the full path to Anime Studio):

/Applications/Anime\ Studio\ Pro/Anime\ Studio\ Pro.app/Contents/MacOS/Anime\ Studio\ Pro -r file.moho

Other than that, Anime Studio runs very nicely in command-line mode on the Mac.
Last edited by Lost Marble on Fri Sep 14, 2007 6:38 pm, edited 1 time in total.
User avatar
Lost Marble
Site Admin
Posts: 2347
Joined: Tue Aug 03, 2004 6:02 pm
Location: Scotts Valley, California, USA
Contact:

Linux Quirks

Post by Lost Marble »

Linux Quirks

On Linux, there's nothing special to worry about. Running Anime Studio from the command line is exactly as described at the beginning of this thread. Just be sure that Anime Studio is either in your path, or you use the full path to Anime Studio.
Post Reply