View Source Xav.Reader (xav v0.10.0)
Audio/video file reader.
Summary
Types
@type t() :: %Xav.Reader{ bit_rate: integer(), codec: atom(), duration: integer(), framerate: {integer(), integer()} | nil, 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
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.
The following options can be provided:
:read
- The type of the stream to read from the input, eithervideo
oraudio
The default value is:video
.:device?
(boolean/0
) - Whether the path points to the camera The default value isfalse
.:out_format
- The output format of the audio samples. It should be one of the following values:u8, s16, s32, s64, f32, f64
.For video samples, it is always
:rgb24
.:out_sample_rate
(pos_integer/0
) - The output sample rate of the audio samples:out_channels
(pos_integer/0
) - The output number of channels of the audio samples
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.
Seeks the reader to the given time in seconds
@spec stream!(String.t(), Keyword.t()) :: Enumerable.t()
Creates a new reader stream.
Check new/1
for the available options.