Headless playblasts

Hi all,

I’m looking to run a playblast on a machine without graphics card or monitor, mainly involving Maya, but applies to any DCC with a GPU requirement.

The requirements are simple; produce the exact same result as cmds.playblast() but via the command-line, on a blind machine.

$ mayapy -c "from maya import standalone, cmds; \
   standalone.initialize(); \
   cmds.playblast(filename='/root/workspace/my_playblast')"

Worth noting, the above works well on a machine with graphics card and monitor. So all I need is some way of emulating the windowing system and GPU.

For usecase, think of dispatching playblasts of computationally heavy animations (300 frames, <30 seconds each) to a farm so as to save some of that local RAM and keep working.

I know this has been attempted and failed before, by greater developers than I, and I can see why. Playblasts are screengrabs of an OpenGL viewport and OpenGL runs on the GPU. No GPU == No viewport.

Mesa can solve that.

The next why is that playblasts are dependent on a window. Something to screengrab from. Even with offScreen=True(?)

Xvfb can solve that.

At this point I’m at a loss. The command successfully finishes, throws a few warnings, and produces a quicktime file with no content.

Full reproducible

Either install Maya and the list of dependencies from above or use the pre-built Docker image like.


$ docker run -ti --rm -v $(pwd):/root/workspace mottosso/maya
[root@343 ~]# mayapy -c "from maya import standalone, cmds; \
   standalone.initialize(); \
   cmds.playblast(filename='/root/workspace/myplayblast')"
[root@343 ~]# exit
$ hexdump -C my_playblast.mov
00000000  00 00 00 20 66 74 79 70  71 74 20 20 20 05 03 00  |... ftypqt   ...|
00000010  71 74 20 20 00 00 00 00  00 00 00 00 00 00 00 00  |qt  ............|
00000020
$ 

just off my head, if nothing else works - try sticking it into a VM. A VM usually has a GPU, even if the host is headless. GPU performance may be bad though but if you build something like a “playblast farm” it may be okay.

In my previous studio we’ve just used maya scanline renderer to generate “playblasts” on the renderfarm. We’ve disabled all the lights we’ve found in the animators scene, created a simple set of 3 directional lights with no shadows and rendered it. Worked like a charm, however this was very specific case because we’ve been only interested in seeing the poly meshes (you can’t render i.e. NURBS curves)