RTMP.FLV.Metadata (rtmp v0.1.0)

Copy Markdown View Source

Extracts onMetaData from RTMP data messages.

Encoders send stream metadata (resolution, frame rate, codecs, bitrates, encoder name) as a data message, usually wrapped as @setDataFrame("onMetaData", {...}) and sometimes as a bare onMetaData({...}). Both are accepted. The result is a map with the encoder's own keys, e.g.:

%{"width" => 1920.0, "height" => 1080.0, "framerate" => 30.0,
  "videocodecid" => 7.0, "audiocodecid" => 10.0,
  "encoder" => "Lavf61.7.100"}

Numbers are floats (AMF0 has no integer type). Other data messages (onTextData, onCuePoint, ...) are ignored.

Summary

Functions

Returns {:ok, metadata}, :ignore for other data messages, or {:error, reason}.

Functions

parse(type_id, payload)

@spec parse(byte(), binary()) :: {:ok, map()} | :ignore | {:error, term()}

Returns {:ok, metadata}, :ignore for other data messages, or {:error, reason}.