VideoMixer (video_mixer v2.1.6)
View SourceSummary
Functions
Initializes the mixer using a constrained layout with safe defaults.
Initializes the mixer with a custom filter graph.
Types
@type filter_graph_t() :: {String.t(), [non_neg_integer()]}
@type input_name() :: atom()
@type spec_mapping_t() :: [VideoMixer.FrameSpec.t()]
@type t() :: %VideoMixer{ filter_indexes: [non_neg_integer()], input_order: [input_name()], mapping: spec_mapping_t(), ref: reference() }
Functions
@spec init( VideoMixer.FilterGraph.layout(), keyword(VideoMixer.FrameSpec.t()) | map(), VideoMixer.FrameSpec.t(), keyword() ) :: {:ok, t()} | {:error, VideoMixer.Error.t()}
Initializes the mixer using a constrained layout with safe defaults.
@spec init_raw( filter_graph_t(), spec_mapping_t(), [input_name()], VideoMixer.FrameSpec.t() ) :: {:ok, t()} | {:error, VideoMixer.Error.t()}
Initializes the mixer with a custom filter graph.
Filter graph gotchas
Each input becomes a buffersrc labelled
[i:v](0-indexed ininput_order). The terminal pad must be labelled[out].Input buffersrcs are configured with
time_base=1/1, i.e. PTS is in seconds. Time-driven filters such asfade=st=…:d=…will interpret PTS in seconds, which rarely matches the upstream timing. Pre-bake animations into the input frames instead of relying on time-based filters.Some filters parse their
formatoption as an enum alias rather than as a pixel-format string. Theoverlayfilter is the canonical example: useoverlay=...:format=yuv420(enum), notformat=yuv420p(pix_fmt string).formatas a standalone filter (e.g.[1:v]format=yuva420p[ovl]) does take pix_fmt strings.Supported input/output
pixel_formatvalues are:I420,:I422,:I444,:RGBA, and:BGRA. RGBA/BGRA are useful as overlay sources with alpha; convert to a YUV planar format inside the graph (e.g.format=yuva420p) before feedingoverlay.
@spec mix(t(), keyword(VideoMixer.Frame.t()) | map()) :: {:ok, binary()} | {:error, VideoMixer.Error.t()}