Membrane.ABRTranscoder
(Membrane ABR Transcoder plugin v0.1.2)
View Source
Adaptive bit rate transcoder.
ABR Ladder
The element works as an ABR ladder, meaning that given a source stream it scales it to lower resolutions (with potentially halved framerate) which is desired by ABR protocols such as HLS to serve lower resolution streams to clients with worse network conditions.
A single ABR ladder works in the following way:
- decode the source stream
- perform multiple scaling operations
- optionally reduce the framerate
- encode each scaled stream separately
Hardware acceleration
Decoding/encoding/scaling operations combined are very computational demanding and it is hard to perform them in real-time (with a speed equal or higher to the pace of incoming source stream).
Even if we could achieve real-time performance with a regular CPU the server would not be able to handle many of such workflows.
To keep a decent performance (streams per server) we need to use hardware that is better suited than a regular CPU which leaves us with either GPUs or other specialized accelerated hardware (e.g. Xilinx U30 cards).
Element options
Passed via struct Membrane.ABRTranscoder.t/0
backendmodule() | struct()Required
Module or struct representing a transcoder backend and its configuration that should be used for initialization.The available backends are
Membrane.ABRTranscoder.Backends.NvidiaandMembrane.ABRTranscoder.Backends.U30.min_inter_frame_delayMembrane.Time.t()Default value:
250 ms
If delay between input frames is bigger than this value, the transcoder won't reduce the framerate on the outputs withframerate: :half.telemetry_callbacks%{ on_successful_init: (-> term()), on_frame_process_start: (-> term()), on_frame_process_end: (-> term()) }Default value:
%{}
Callbacks called on particular transcoder events.
Pads
:input
Accepted formats:
%H264{alignment: :au, stream_structure: :annexb}| Direction: | :input |
| Availability: | :always |
| Flow control: | :auto |
:output
Accepted formats:
%H264{alignment: :au, stream_structure: :annexb}| Direction: | :output |
| Availability: | :on_request |
| Flow control: | :auto |
Pad options:
widthpos_integer() | nilDefault value:
nil
Width of the output video. Preserves the input width by default.heightpos_integer() | nilDefault value:
nil
Height of the output video. Preserves the input height by default.framerate:full | :halfDefault value:
:full
Output framerate -fullpreserves the input framerate,halfreduces it twice.bitratepos_integer() | nilDefault value:
nil
When set, the encoder tries to output the stream with specified bitrate.
Summary
Types
@type output_pad_opts() :: [ width: pos_integer() | nil, height: pos_integer() | nil, framerate: :full | :half, bitrate: pos_integer() | nil ]
Options for pad :output
@type t() :: %Membrane.ABRTranscoder{ backend: module() | struct(), min_inter_frame_delay: Membrane.Time.t(), telemetry_callbacks: %{ on_successful_init: (-> term()), on_frame_process_start: (-> term()), on_frame_process_end: (-> term()) } }
Struct containing options for Membrane.ABRTranscoder
Functions
@spec options() :: keyword()
Returns description of options available for this module