HEVCRecorder
class NatML.Recorders.HEVCRecorder : IMediaRecorder
The HEVCRecorder
records MP4 videos with the H.265 HEVC video codec. This codec provides better compression at the expense of computational cost.
The HEVCRecorder
uses the H.265 HEVC codec for video and the AAC codec for audio.
On Android, this recorder is not guaranteed to be supported on any given device.
On Windows, you must install the HEVC Video Extensions pack.
The HEVCRecorder
is not supported on WebGL.
Creating the Recorder
The HEVCRecorder
can be created to record video with optional audio. To record video only, simply provide the video width
, video height
, and video framerate
.
To record video with audio, you will provide the audio format along with the video format. The audio format comprises of the sampleRate
and channelCount
.
You can additionally specify the output video bitrate (in bits per second) and keyframe interval (in seconds).
The videoBitRate
and keyframeInterval
parameters are important for controlling the output video file size.
On Windows, the HEVCRecorder
will always output audio with a 192kbps bitrate.
When recording audio from Unity (e.g. using an AudioInput
):
Set the
sampleRate
toAudioSettings.outputSampleRate.
Set the
channelCount
to(int)AudioSettings.speakerMode
.
Video Size
Refer to the Frame Size section of the IMediaRecorder
interface for more information.
Some devices, especially Android devices, will fail to record when either the width
or height
is not divisible by two. In general, it is best to stick with a standard recording size like 1280x720
or 1920x1080
.
Committing Video Frames
Refer to the Committing Video Frames section of the IMediaRecorder
interface for more information.
The spacing between consecutive timestamp
values determines the actual video frame rate. The value passed to the constructor is merely a hint to the encoder.
Committed timestamps must be strictly monotonic. Not meeting this condition will cause recording to fail.
Committing Audio Frames
Refer to the Committing Audio Frames section of the IMediaRecorder
interface for more information.
Finishing Recording
Refer to the Finishing Recording section of the IMediaRecorder
interface for more information.
Last updated