Tasks as input an unparsed stream and provides on each pad an unparsed, transcoded stream with the desired properties.
Input might be MPEG-TS or FLV but other streaming containers might work as well. If the input stream contains more than 1 video and 1 audio stream, which one will be picked is undefined behaviour.
Process lifecycle
Each bin runs FFmpeg once. When the bin observes that process exiting, it sends its parent one notification:
{:transcoder_exited, %{reason: reason, input_eos_received?: boolean}}reason is :normal for exit zero, {:status, code} for a nonzero exit,
or {:signal, signal, core_dump?} for termination by signal. Infrastructure
failures may carry another reason, such as :port_closed.
input_eos_received? records whether the FFmpeg filter had handled input EOS
when it observed the exit. It is an observation, not a success classification.
An exit can be abnormal even after input EOS; decoder warnings can also occur
before a successful exit.
Process exit does not mean that the media outputs or downstream sinks have finished. The bin preserves output EOS for normal and abnormal FFmpeg exits, after its readers have drained. The notification and individual output EOS travel through different processes; callers must tolerate either arrival order and use downstream completion to coordinate draining.
The bin never restarts FFmpeg. Its parent owns recovery, drain deadlines, and any replacement run. Internal element/reader failures still use ordinary OTP failure propagation. The notification is not guaranteed during bin teardown or a bin crash; callers must also supervise or monitor their media graph.
Bin options
Passed via struct Membrane.FFmpeg.Transcoder.t/0
wait_random_access_indicatorboolean()Default value:
true
If enabled, emits packets only after the random access indicator is found in the MPEG-TS PES stream, otherwise packets are emitted immediately. When enabled, it means that the first video packet that comes out is going to be a keyframe unit.
Pads
:input
Accepted formats:
Membrane.RemoteStream| Direction: | :input |
| Availability: | :always |
:scte
Accepted formats:
Membrane.RemoteStreamMembrane.AACMembrane.H264| Direction: | :output |
| Availability: | :on_request |
Pad options:
pidpos_integer()Default value:
nil
PID of the SCTE stream. Whennilit grabs the first stream.
:text
Accepted formats:
Membrane.Text| Direction: | :output |
| Availability: | :on_request |
Pad options:
source
Required{:dvb_teletext, 100..899}
Defines the source of the captions. Currently supported:- Teletext:
{:dvb_teletext, page_number}
- Teletext:
:video
Accepted formats:
Membrane.RemoteStreamMembrane.AACMembrane.H264| Direction: | :output |
| Availability: | :on_request |
Pad options:
copyboolean()Default value:
false
If enabled, the stream will not be re-encodedresolution{integer(), integer()}Default value:
{-2, 720}
Resolution of the given output.bitratepos_integer()Default value:
3300000
Maximum bitrateprofileatom()Default value:
:high
H264 Profilecrfpos_integer()Default value:
26presetatom()Default value:
:hightuneatom()Default value:
:zerolatencyfpspos_integer()Default value:
30gop_sizepos_integer()Default value:
60b_framespos_integer()Default value:
3levelString.t()Default value:
"3.1"
:audio
Accepted formats:
Membrane.RemoteStreamMembrane.AACMembrane.H264| Direction: | :output |
| Availability: | :on_request |
Pad options:
copyboolean()Default value:
false
If enabled, the stream will not be re-encodedcodec:aac | :opusDefault value:
:aac
Audio codec to use for encoding. Ignored when copy is true.bitratepos_integer()Default value:
128000
Maximum bitratesample_ratepos_integer()Default value:
48000channelspos_integer()Default value:
2
Summary
Types
Options for pad :audio
Options for pad :scte
Struct containing options for Membrane.FFmpeg.Transcoder
Options for pad :text
Options for pad :video
Types
@type audio_pad_opts() :: [ copy: boolean(), codec: :aac | :opus, bitrate: pos_integer(), sample_rate: pos_integer(), channels: pos_integer() ]
Options for pad :audio
@type scte_pad_opts() :: [{:pid, pos_integer()}]
Options for pad :scte
@type t() :: %Membrane.FFmpeg.Transcoder{wait_random_access_indicator: boolean()}
Struct containing options for Membrane.FFmpeg.Transcoder
@type text_pad_opts() :: [{:source, {:dvb_teletext, 100..899}}]
Options for pad :text
@type video_pad_opts() :: [ copy: boolean(), resolution: {integer(), integer()}, bitrate: pos_integer(), profile: atom(), crf: pos_integer(), preset: atom(), tune: atom(), fps: pos_integer(), gop_size: pos_integer(), b_frames: pos_integer(), level: String.t() ]
Options for pad :video
Functions
@spec options() :: keyword()
Returns description of options available for this module