Home

Awesome

FFmpegOut

gif

FFmpegOut is a Unity plugin that allows the Unity editor and applications to record video using FFmpeg as a video encoder.

Differences between Unity Recorder

First of all, note that Unity Recorder would be a better choice in most cases for the same purpose. It's strongly recommended to check and try it out before installing FFmpegOut.

Unity Recorder

FFmpegOut

In short, you should use Unity Recorder unless you need a special codec like ProRes or lossless H.264.

System Requirements

FFmpegOut only supports desktop platforms.

FFmpegOut works not only on the legacy rendering paths (forward/deferred) but also on the standard scriptable render pipelines (LWRP/HDRP).

Installation

Download and import the following packages into your project.

Camera Capture component

The Camera Capture component (CameraCapture) is used to capture frames rendered by an attached camera.

inspector

It has a few properties for recording video: frame dimensions, preset and frame rate.

Frame Dimensions (width and height)

The dimensions of recorded video are specified with the Width and Height properties. The size of the screen or the game view will be overridden by these values.

Presets

At the moment the following presets are available for use.

NameContainerDescription
H.264 DefaultMP4Recommended for general use.
H.264 NVIDIAMP4Highly optimized. Requires a NVIDIA GPU
H.264 Lossless 420MP4Recommended for pre-render use.
H.264 Lossless 444MP4High quality but not widely supported.
HEVC DefaultMP4High quality but slow.
HEVC NVIDIAMP4Highly optimized. Requires a NVIDIA GPU
ProRes 422QuickTime
ProRes 4444QuickTimeSupports alpha channel.
VP8WebM
VP9WebMHigh quality but slow.
HAPQuickTime
HAP AlphaQuickTimeSupports alpha channel
HAP QQuickTime

Frame Rate

The Frame Rate property controls the sampling frequency of the capture component. Note that it's independent from the application frame rate. It drops/duplicates frames to fill gaps between the recording frame rate and the application frame rate. To avoid frame dropping, consider using the frame rate controller component (see below).

Frame Rate Controller component

The Frame Rate Controller component is a small utility to control the application frame rate.

inspector

It tries controlling frame rate via Application.targetFrameRate and QualitySettings.vSyncCount. Note that it only works in a best-effort fashion. Although it's expected to provide a better result, it's not guaranteed to work exactly as specified.

When the Offline Mode property is enabled, it explicitly controls the application frame rate via Time.captureFramerate. In this mode, application time is decoupled from wall-clock time so it's guaranteed that no frame dropping happens. This is useful when using the capture component to output pre-render footage.

License

MIT

Note that the FFmpegOutBinaries package is not placed under this license. When distributing an application with the package, it must be taken into account that multiple licenses are involved. See the FFmpeg License page for further details.