RustyOpus.Settings (rusty_opus v0.3.3)

Copy Markdown View Source

Validated encoder quality settings.

These settings tune the encoding quality and size:

  • :bitrate — target bitrate in bits/second (a positive integer), or nil to keep the codec default (64_000).
  • :complexity — encoding complexity from 0 (fast) to 10 (best), or nil.
  • :cbrtrue to force constant bitrate, false for variable, or nil for default.
  • :fectrue to enable in-band forward error correction.
  • :packet_loss — expected packet-loss percentage 0..100 used for rate estimation.

Raise :bitrate to increase output size/fidelity, or lower it to shrink it — this is the knob behind "changing the quality" of an encoding.

Summary

Functions

Builds validated settings from a keyword list.

Returns the native NifMap shape consumed by the encoder NIF.

Types

t()

@type t() :: %RustyOpus.Settings{
  bitrate: non_neg_integer() | nil,
  cbr: boolean() | nil,
  complexity: 0..10 | nil,
  fec: boolean(),
  packet_loss: 0..100
}

Functions

new(opts)

@spec new(keyword()) :: {:ok, t()} | {:error, RustyOpus.Error.t()}

Builds validated settings from a keyword list.

Returns {:ok, settings} or {:error, %RustyOpus.Error{}}.

to_native(s)

@spec to_native(t()) :: map()

Returns the native NifMap shape consumed by the encoder NIF.