View Source Xav.Reader (xav v0.6.0)

Audio/video file reader.

Summary

Types

Reader options.

t()

Functions

Creates a new audio/video reader.

The same as new/1 but raises on error.

Reads and decodes the next frame.

Creates a new reader stream.

Types

@type opts() :: [
  read: :audio | :video,
  device?: boolean(),
  out_format: Xav.Frame.format(),
  out_sample_rate: integer(),
  out_channels: integer()
]

Reader options.

  • read - determines which stream to read from a file. Defaults to :video.
  • device? - determines whether path points to the camera. Defaults to false.
@type t() :: %Xav.Reader{
  bit_rate: integer(),
  codec: atom(),
  duration: integer(),
  in_channels: integer() | nil,
  in_format: atom(),
  in_sample_rate: integer() | nil,
  out_channels: integer() | nil,
  out_format: atom(),
  out_sample_rate: integer() | nil,
  reader: reference()
}

Functions

@spec new(String.t(), opts()) :: {:ok, t()} | {:error, term()}

Creates a new audio/video reader.

Both reading from a file and from a video camera are supported. In case of using a video camera, the v4l2 driver is required, and FPS are locked to 10.

Microphone input is not supported.

opts can be used to specify desired output parameters. Video frames are always returned in RGB format. This setting cannot be changed. Audio samples are always in the packed form. See Xav.Decoder.new/2 for more information.

@spec new!(String.t(), opts()) :: t()

The same as new/1 but raises on error.

@spec next_frame(t()) :: {:ok, Xav.Frame.t()} | {:error, :eof}

Reads and decodes the next frame.

Link to this function

stream!(path, opts \\ [])

View Source
@spec stream!(String.t(), opts()) :: Enumerable.t()

Creates a new reader stream.