NatCorder API: Unity Recording Made Easy

I am happy to introduce an API that you will absolutely want to get your hands on. I developed NatCam, the goto camera API for Unity, with video recording functionality. After stumbling upon it, a lot of developers reached out to me asking one question: can NatCam record game objects and UI from Unity too? Due to design and architectural considerations, the answer has been a resounding no. Now, I can gladly say that there is a solution for this.

NatCorder is a lightweight, easy-to-use, full-feature video recording API for iOS and Android. With NatCorder, you can record anything*; You can record the screen, a part of the screen, a specific camera, a texture, and so on. You can also record game audio from audio sources, listeners, and custom sources. In designing the API, our biggest goal has been to provide a very easy API. We want you to spend less time learning what API calls to make, and more time actually developing your project. I’d say that our second biggest goal is providing much of the crucial functionality that the current goto recording API, Everyplay, is missing. With these in mind, we have crafted a simple, powerful API.

NatCorder API

NatCorder API exposes the core functionality of hardware encoders. The API is designed with a ‘push’ architecture, meaning that the client (you) will manually push frames for encoding whenever you want. This also means that you provide the timestamps for each frame that you push, allowing you to do fun things like retiming, slow motion, and so on. The overall process is very simple: you start recording; then for as long as you want, you acquire a recording frame from NatCorder, render or blit to it, then commit the frame for encoding; and once you’re all done, you stop recording.

When it comes to audio, the process is pretty much the same. You commit floating point PCM sample buffers (float[]) with a corresponding timestamp while recording:


Why You Should Switch from Everyplay

I would like to list a few critical reasons why NatCorder is your best option for video recording in Unity:

  • You can record anything. By anything, I mean anything and everything that can be rendered into a texture. Whether it’s a game view, UI, a camera, a texture, NatCam, or anything else — NatCorder can record it.
  • You can record at custom resolutions. You can record as high as Full HD (1920x1080) and even higher on devices that support it. Unlike Everyplay, you aren’t limited to the resolution of your screen.
  • You can record animated GIF’s. In addition to recording MP4 videos, NatCorder can record animated GIF’s that loop forever.
  • You can control recording quality. You want to optimize the recording for file size or bandwidth? Just tell NatCorder what bitrate and keyframe interval you want, and it’ll take care of the rest. Again, Everyplay doesn’t provide any control over this.
  • You get the recorded video in device storage. This has personally been one of my biggest frustrations with Everyplay — them keeping the recorded video away from you. NatCorder will record directly to device storage and give you the path to the video.
  • It’s crazy fast. All of NatCorder’s encoding is done on dedicated threads, and the API is heavily optimized for performance, following from design breakthroughs we made while developing NatCam.
  • It is very easy to use. As you can see from my above example, you can get up and running with video recording in only a few API calls.
  • It is lightweight. It is a minimalist API designed to not add baggage and overhead to your project. See for yourself:
API’s don’t come any leaner than this
  • macOS support. NatCorder comes with a full native macOS backend. As a result, you can use NatCorder’s full functionality in both the Unity Editor on macOS, and in standalone macOS builds.
  • Windows support. NatCorder comes with a native Windows backend that works both in the Unity Editor on Windows and in standalone Windows builds.
  • Experimental WebGL support. NatCorder also comes with an experimental WebGL backend that runs on most modern browsers.

Get NatCorder

NatCorder is now on the Unity Asset Store. Make sure to grab it and start recording those precious seconds of gameplay! Also make sure to follow discussions and post any feedback or bug reports on the Unity forum thread. Thank you very much!

— Lanre Olokoba.