NatCorder
Search…
Video Transcoding
Bye Bye FFmpeg
NatCorder can be used in conjunction with our open-source NatReader API to build video transcoding applications. NatReader is a lightweight video decoding library for Unity Engine. It currently supports decoding *.mp4 videos, and has the exact same cross-platform support and minimum requirements as NatCorder.

Lightweight Transcoding

NatReader acts as the decoder while NatCorder acts as the encoder, together forming a transcoding pair.
// Create a reader
var reader = new MP4FrameReader(videoPath);
// Create a recorder
var recorder = new MP4Recorder(reader.frameSize.width, reader.frameSize.height, reader.frameRate);
// Transcode
foreach (var (pixelBuffer, timestamp) in reader.Read())
recorder.CommitFrame(pixelBuffer, timestamp);
// Finish
reader.Dispose();
var path = await recorder.FinishWriting();
The above example illustrates the general usage pattern. From here, more complex transcoders can be built.
Copy link