Getting Started

Up and Running in No Time

Importing NatCorder

To begin, import the API with the Unity Package Manager by adding the following lines to your Packages/manifest.json file:
"scopedRegistries": [
"name": "NatML",
"url": "",
"scopes": ["ai.natml"]
"dependencies": {
"ai.natml.natcorder": "1.9.4",

Specifying your Access Key

In order to use NatCorder, you need a NatML access key. Retrieve your access key from NatML Hub:
Retrieve your access key on NatML Hub.
Once you have your access key, add it in Project Settings > NatML:
Specifying your NatML access key in Project Settings.
Using NatCorder requires an active NatML MediaKit subscription. You can try it out for free, but some functionality is limited. See the FAQ for more info.

Recording the Camera

Once the API is imported, you can begin to write recording code. Let's create a recorder to record a WebCamTexture.
using System.Threading.Tasks;
using UnityEngine;
using NatML.Recorders;
using NatML.Recorders.Clocks;
public class RecordWebCam : MonoBehaviour {
async void Start () {
// Start the webcam
var cameraTexture = new WebCamTexture();
// Wait for user to smile :)
await Task.Delay(2000);
// Create a recorder
var recorder = new MP4Recorder(cameraTexture.width, cameraTexture.height, 30);
// Create a recording clock to generate timestamps
var clock = new RealtimeClock();
// Record for a few seconds
for (var i = 0; i < 300; i++) {
// Commit frame
recorder.CommitFrame(cameraTexture.GetPixels32(), clock.timestamp);
// Wait till next frame
await Task.Yield();
// All done
var path = await recorder.FinishWriting();
Debug.Log($"Recorded video to {path}");
Add this component to any game object in your scene and enter Play mode. After about 5 seconds, you should find a .mp4 file sitting in your project folder!
Before going into more details, look through the minimum requirements for developing with and deploying NatCorder.