encodebin

EncodeBin provides a bin for encoding/muxing various streams according to a specified GstEncodingProfile.

Based on the profile that was set (via the profile property), EncodeBin will internally select and configure the required elements (encoders, muxers, but also audio and video converters) so that you can provide it raw or pre-encoded streams of data in input and have your encoded/muxed/converted stream in output.

Features

  • Automatic encoder and muxer selection based on elements available on the system.

  • Conversion of raw audio/video streams (scaling, framerate conversion, colorspace conversion, samplerate conversion) to conform to the profile output format.

  • Variable number of streams. If the presence property for a stream encoding profile is 0, you can request any number of sink pads for it via the standard request pad gstreamer API or the request-pad action signal.

  • Avoid reencoding (passthrough). If the input stream is already encoded and is compatible with what the GstEncodingProfile expects, then the stream won't be re-encoded but just passed through downstream to the muxer or the output.

  • Mix pre-encoded and raw streams as input. In addition to the passthrough feature above, you can feed both raw audio/video AND already-encoded data to a pad. encodebin will take care of passing through the compatible segments and re-encoding the segments of media that need encoding.

  • Standard behaviour is to use a GstEncodingContainerProfile to have both encoding and muxing performed. But you can also provide a single stream profile (like GstEncodingAudioProfile) to only have the encoding done and handle the encoded output yourself.

  • Audio imperfection corrections. Incoming audio streams can have non perfect timestamps (jitter), like the streams coming from ASF files. encodebin will automatically fix those imperfections for you. See audio-jitter-tolerance for more details.

  • Variable or Constant video framerate. If your GstEncodingVideoProfile has the variableframerate property deactivated (default), then the incoming raw video stream will be retimestampped in order to produce a constant framerate.

  • Cross-boundary re-encoding. When feeding compatible pre-encoded streams that fall on segment boundaries, and for supported formats (right now only H263), the GOP will be decoded/reencoded when needed to produce an encoded output that fits exactly within the request GstSegment.

  • Missing plugin support. If a GstElement is missing to encode/mux to the request profile formats, a missing-plugin GstMessage will be posted on the GstBus, allowing systems that support the missing-plugin system to offer the user a way to install the missing element.

Hierarchy

GObject
    ╰──GInitiallyUnowned
        ╰──GstObject
            ╰──GstElement
                ╰──GstBin
                    ╰──encodebin

Factory details

Authors: – Edward Hervey

Classification:Generic/Bin/Encoder

Rank – none

Plugin – gstencoding

Package – GStreamer Base Plug-ins git

Pad Templates

audio_%u

ANY

Presencerequest

Directionsink


private_%u

ANY

Presencerequest

Directionsink


src

ANY

Presencealways

Directionsrc


video_%u

ANY

Presencerequest

Directionsink


Signals

request-pad

GstPad *
request_pad_callback (GstElement * encodebin,
                      GstCaps * caps,
                      gpointer udata)
def request_pad_callback (encodebin, caps, udata):
    #python callback for the 'request-pad' signal
function request_pad_callback(encodebin: GstElement * encodebin, caps: GstCaps * caps, udata: gpointer udata): {
    // javascript callback for the 'request-pad' signal
}

Use this method to request an unused sink request GstPad that can take the provided caps as input. You must release the pad with gst_element_release_request_pad when you are done with it.

Parameters:

encodebin

a encodebin instance

caps

a GstCaps

udata
No description available
Returns ( GstPad * ) –

A compatible GstPad, or NULL if no compatible GstPad could be created or is available.


request-profile-pad

GstPad *
request_profile_pad_callback (GstElement * encodebin,
                              gchararray profilename,
                              gpointer udata)
def request_profile_pad_callback (encodebin, profilename, udata):
    #python callback for the 'request-profile-pad' signal
function request_profile_pad_callback(encodebin: GstElement * encodebin, profilename: gchararray profilename, udata: gpointer udata): {
    // javascript callback for the 'request-profile-pad' signal
}

Use this method to request an unused sink request GstPad from the profile profilename. You must release the pad with gst_element_release_request_pad when you are done with it.

Parameters:

encodebin

a encodebin instance

profilename

the name of a GstEncodingProfile

udata
No description available
Returns ( GstPad * ) –

A compatible GstPad, or NULL if no compatible GstPad could be created or is available.


Properties

async-handling

“async-handling” gboolean

The bin will handle Asynchronous state changes

Flags : Read / Write

Default value : false


audio-jitter-tolerance

“audio-jitter-tolerance” guint64

Amount of timestamp jitter/imperfection to allow on audio streams before inserting/dropping samples (ns)

Flags : Read / Write

Default value : 20000000


avoid-reencoding

“avoid-reencoding” gboolean

Whether to re-encode portions of compatible video streams that lay on segment boundaries

Flags : Read / Write

Default value : false


flags

“flags” Encode-bin-flags

Control the behaviour of encodebin.

Flags : Read / Write

Default value : (none)


message-forward

“message-forward” gboolean

Forwards all children messages

Flags : Read / Write

Default value : false


name

“name” gchararray

The name of the object

Flags : Read / Write / Construct

Default value : NULL


parent

“parent” GstObject *

The parent of the object

Flags : Read / Write


profile

“profile” GstEncodingProfile *

The GstEncodingProfile to use. This property must be set before going to GST_STATE_PAUSED or higher.

Flags : Read / Write


queue-buffers-max

“queue-buffers-max” guint

Max. number of buffers in the queue (0=disable)

Flags : Read / Write

Default value : 200


queue-bytes-max

“queue-bytes-max” guint

Max. amount of data in the queue (bytes, 0=disable)

Flags : Read / Write

Default value : 10485760


queue-time-max

“queue-time-max” guint64

Max. amount of data in the queue (in ns, 0=disable)

Flags : Read / Write

Default value : 1000000000


Named constants

Encode-bin-flags

Members

no-audio-conversion (0x00000001) – Do not use audio conversion elements
no-video-conversion (0x00000002) – Do not use video conversion elements

The results of the search are