View Source Xav.Encoder (xav v0.11.0)
Audio/Video encoder.
Currently, it only supports video encoding.
Summary
Types
Functions
@spec encode(t(), Xav.Frame.t()) :: [Xav.Packet.t()]
Encodes a frame.
The return value may be an empty list in case the encoder needs more frames to produce a packet.
@spec flush(t()) :: [Xav.Packet.t()]
Flush the encoder.
Create a new encoder.
To get the list of available encoders, see Xav.list_encoders/0
.
It accepts the following options:
:width
(pos_integer/0
) - Required. Width of the video samples.:height
(pos_integer/0
) - Required. Height of the video samples.:format
(atom/0
) - Required. Pixel format of the video samples.:time_base
(tuple ofpos_integer/0
,pos_integer/0
values) - Required. Time base of the video stream.It is a rational represented as a tuple of two postive integers
{numerator, denominator}
. It represent the number of ticksdenominator
innumerator
seconds. e.g.{1, 90000}
reprensents 90000 ticks in 1 second.it is used for the decoding and presentation timestamps of the video frames. For video frames with constant frame rate, choose a timebase of
{1, frame_rate}
.:gop_size
(pos_integer/0
) - Group of pictures length.Determines the interval in which I-Frames (or keyframes) are inserted in the stream. e.g. a value of 50, means the I-Frame will be inserted at the 1st frame, the 51st frame, the 101st frame, and so on.
:max_b_frames
(non_neg_integer/0
) - Maximum number of consecutive B-Frames to insert between non-B-Frames.A value of 0, disable insertion of B-Frames.
:profile
(String.t/0
) - The encoder's profile.A profile defines the capabilities and features an encoder can use to target specific applications (e.g.
live video
)To get the list of available profiles for an encoder, see
Xav.list_encoders/0