View Source Membrane.H264.FFmpeg.Encoder (Membrane H264 FFmpeg plugin v0.21.1)

Membrane element that encodes raw video frames to H264 format.

The element expects each frame to be received in a separate buffer, so the parser (Membrane.Element.RawVideo.Parser) may be required in a pipeline before the encoder (e.g. when input is read from Membrane.File.Source).

Additionally, the encoder has to receive proper caps with picture format and dimensions before any encoding takes place.

Please check t/0 for available options.

element-options

Element options

Passed via struct Membrane.H264.FFmpeg.Encoder.t/0

  • crf

    any

    Default value: 23
    Constant rate factor that affects the quality of output stream. Value of 0 is lossless compression while 51 (for 8-bit samples) or 63 (10-bit) offers the worst quality. The range is exponential, so increasing the CRF value +6 results in roughly half the bitrate / file size, while -6 leads to roughly twice the bitrate.

  • preset

    presets()

    Default value: :medium
    Collection of predefined options providing certain encoding. The slower the preset chosen, the higher compression for the same quality can be achieved.

  • profile

    H264.profile_t() | nil

    Default value: nil
    Sets a limit on the features that the encoder will use to the ones supported in a provided H264 profile. Said features will have to be supported by the decoder in order to decode the resulting video. It may override other, more specific options affecting compression (e.g setting max_b_frames to 2 while profile is set to :baseline will have no effect and no B-frames will be present).

  • use_shm?

    boolean

    Default value: false

  • max_b_frames

    any

    Default value: nil
    Maximum number of B-frames between non-B-frames. Set to 0 to encode video without b-frames

pads

Pads

input

:input

Availability :always
Caps Membrane.RawVideo, restrictions:
  pixel_format: one_of([:I420, :I422]),
  aligned: true
Demand mode :auto
Demand unit :buffers
Direction :input
Mode :pull
Name :input

output

:output

Availability :always
Caps Membrane.H264, restrictions:
  stream_format: :byte_stream,
  alignment: :au
Demand mode :auto
Demand unit :buffers
Direction :output
Mode :pull
Name :output

Link to this section Summary

Types

t()

Struct containing options for Membrane.H264.FFmpeg.Encoder

Functions

Returns pads descriptions for Membrane.H264.FFmpeg.Encoder

Returns description of options available for this module

Link to this section Types

@type presets() ::
  :placebo
  | :veryslow
  | :slower
  | :slow
  | :medium
  | :fast
  | :faster
  | :veryfast
  | :superfast
  | :ultrafast
@type t() :: %Membrane.H264.FFmpeg.Encoder{
  crf: any(),
  max_b_frames: any(),
  preset: presets(),
  profile: Membrane.H264.profile_t() | nil,
  use_shm?: boolean()
}

Struct containing options for Membrane.H264.FFmpeg.Encoder

Link to this section Functions

@spec membrane_pads() :: [{Membrane.Pad.name_t(), Membrane.Pad.description_t()}]

Returns pads descriptions for Membrane.H264.FFmpeg.Encoder

@spec options() :: keyword()

Returns description of options available for this module