Headless Playblasts Batches

Contrary to popular beliefs, it’s totally possible to do your playblasts in batch mode. It can be very helpful in a lot of workflow: - create a missing playblast without the hassle of opening Maya UI - move all playblasts calculation to a remote computer to be able to continue to work at the same time - update playblasts of all shots at once on a renderfarm to make an up to date montage of the movie All of this is made a lot easier and faster when doing playblasts in batch mode

Both mayabatch and mayapy can do this, the main difference is the background color being different and mayapy being a little finicky.

In a Python module put this simple code:

def do_playblast(output):
    cmds.playblast(f=output, widthHeight=[1980, 1080], percent=100, forceOverwrite=True, viewer=False)

And you can call maya with one of those

# For mayabatch
maya -batch -file "file_to_playblast.ma" -command 'callPython "playblast" "do_playblast" {"output_path.mp4"}' -noAutoloadPlugins
# For mayapy
mayapy -c "import maya.standalone;maya.standalone.initialize(name='python');import playblast;playblast.do_playblast('output_path.mp4')" "filepath_to_playblast.ma"

The Maya file to open is directly in the command but you can also put the opening of the Maya file into the script instead. This way it’s possible to do a batch of several scenes on a single node to save time on the initialization of Maya, but it’s not worth it. If it crashes it’s harder to know what happened and which job was processed or not. By deploying one job per scene you can send it to different computers on the renderfarm and see the general progress.

Another option would be to simply render with a fast software/hardware renderer.

If you encounter problems, as a last resort you could launch a Maya GUI and override the default UI with a very small window. This can be done by creating an empty Maya workspace layout, and then setting the environment variable MAYA_OVERRIDE_UI to a path to this MEL script:

string $jobWindow = `window -mw -title "Playblast" -widthHeight 1 1`;
workspaceLayoutManager -setCurrent "EMPTY"; // EMPTY is the name of my empty workspace
setParent ..;
showWindow $jobWindow;