Generating a MP4 Video from Unity 3D

It took me a little to find, but generating videos from Unity 3D turns out to be not that hard. (Well, its not 100% sorted – like why did the video come up UPSIDE DOWN – but it’s pretty good.)

Here is the scene I wanted it for. Note how the background is moving smoothly as the two characters run down the track. Other panning scenes I just panned a static image. In this case however the run sequence is quite long – I did not have an image big enough to pan for this length of time.


As background, if you have not read my other blog posts, I am using Unity 3D to generate backgrounds for an Adobe Character Animator cartoon. It was too hard for me to draw backgrounds by hand, so I purchased some assets from the Unity Asset store. Most of the time I take a still frame shot just using screen capture software. But some scenes I really wanted smooth background movement, with my animated characters superimposed on top.

Previously I had tried to use OBS studio to capture the screen while I tried to pan through the background image. But I found this dropped lots of frames. Using the approach below generates perfectly smooth 24 frame per second output.

It turns out everything I needed was available for free on the Unity asset store. In particular

  • Cinemachine – makes it easy to move the camera around a scene.
  • Post Production Stack – I don’t think I really needed this in the end, but it was recommended in the Unity Cinemachine tutorial video.
  • Recorder – records a game object to a MP4 file (at least on Windows).

Using Cinemachine (“cinema-sheen”) I created a “Camera and Dolly” and after two quick YouTube tutorials managed to get a camera sweeping along the side of the sports field. Note that Cinemachine is actually quite impressive in what it can do if you have Unity 3D characters moving around. I only needed the simplest of camera movements.

Next using Recorder, I got it to save the game object animation output to a MP4 file on disk. I believe this is still a beta, and for me the video was saved upside down. (There was a flag to flip output vertically, but I tried both settings with no luck.) However as I was using After Effects to composite the cartoon characters on top, this was easy to fix.

If you are new to Unity, I won’t say “it was easy” – it took a bit of messing around for myself as a novice Unity 3D user. But once I realized there was a compile error in some old assets I had loaded (grr!), I managed to work my way through it using various tutorials.

Watching the Unity 3D tutorials does beg the question whether I would use Unity 3D for the complete animation – with 3D characters. My answer for now is no – it looks like a much larger time commitment to build the 3D models for characters and do all the lip sync movements. But Unity do appear to be investing in this area, so I suspect the animation and video production tools will continue to get better and easier over time.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s