Xav.Reader (xav v0.2.1)

Audio/video files reader.

Summary

Types

Reader options.

t()

Functions

Creates a new audio/video reader.

The same as new/1 but raises on error.

Reads the next frame.

Types

@type opts() :: [read: :audio | :video, device?: boolean()]

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_format: atom(),
  out_format: atom(),
  reader: reference(),
  sample_rate: integer() | nil
}

Functions

Link to this function

new(path, opts \\ [])

@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.

Link to this function

new!(path, opts \\ [])

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

The same as new/1 but raises on error.

Link to this function

next_frame(reader)

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

Reads the next frame.

A frame is always decoded. Video frames are always in the RGB format. Audio samples are always interleaved.