## encodebin

encodebin — Convenience encoding/muxing element

## Synopsis

                        GstEncodeBin;

## Object Hierarchy

      GObject
       +----GstObject
             +----GstElement
                   +----GstBin
                         +----GstEncodeBin

## Implemented Interfaces

GstEncodeBin implements GstChildProxy.

## Properties

      "audio-jitter-tolerance"   guint64               : Read / Write
      "avoid-reencoding"         gboolean              : Read / Write
      "profile"                  GstEncodingProfile*   : Read / Write
      "queue-buffers-max"        guint                 : Read / Write
      "queue-bytes-max"          guint                 : Read / Write
      "queue-time-max"           guint64               : Read / Write
      "flags"                    GstEncFlags           : Read / Write

## Signals

      "request-pad"                                    : Action

## Description

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. GstEncodeBin 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. GstEncodeBin 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.

## Synopsis

### Element Information

plugin | encoding
author | Edward Hervey <edward.hervey@collabora.co.uk>
class | Generic/Bin/Encoder

### Element Pads

name | audio_%d
direction | sink
presence | request
details | ANY

name | private_%d
direction | sink
presence | request
details | ANY

name | video_%d
direction | sink
presence | request
details | ANY

name | src
direction | source
presence | always
details | ANY

## Details

### GstEncodeBin

    typedef struct _GstEncodeBin GstEncodeBin;

## Property Details

### The `"audio-jitter-tolerance"` property

      "audio-jitter-tolerance"   guint64               : Read / Write

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

Default value: 20000000

### The `"avoid-reencoding"` property

      "avoid-reencoding"         gboolean              : Read / Write

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

Default value: FALSE

### The `"profile"` property

      "profile"                  GstEncodingProfile*   : Read / Write

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

### The `"queue-buffers-max"` property

      "queue-buffers-max"        guint                 : Read / Write

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

Default value: 200

### The `"queue-bytes-max"` property

      "queue-bytes-max"          guint                 : Read / Write

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

Default value: 10485760

### The `"queue-time-max"` property

      "queue-time-max"           guint64               : Read / Write

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

Default value: 1000000000

### The `"flags"` property

      "flags"                    GstEncFlags           : Read / Write

Control the behaviour of encodebin.

## Signal Details

### The `"request-pad"` signal

    GstPad*             user_function                      (GstEncodeBin *encodebin,
                                                            GstCaps      *caps,
                                                            gpointer      user_data)      : Action

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.

`encodebin` : | a GstEncodeBin instance
`caps` : | a GstCaps
`user_data` : | user data set when the signal handler was connected.
Returns : | A compatible GstPad, or `NULL` if no compatible GstPad could be created or is available.