GstTranscoder: GStreamer transcoder 1.0 Refenrence Manual

## GstTranscoder GstTranscoder — High level API to transcode media files from one format to any other format using the GStreamer framework. |

## Functions

GstTranscoder * | gst_transcoder_new ()
GstTranscoder * | gst_transcoder_new_full ()
gboolean | gst_transcoder_run ()
void | gst_transcoder_set_cpu_usage ()
void | gst_transcoder_run_async ()
void | gst_transcoder_set_position_update_interval ()
gchar * | gst_transcoder_get_source_uri ()
gchar * | gst_transcoder_get_dest_uri ()
guint | gst_transcoder_get_position_update_interval ()
GstClockTime | gst_transcoder_get_position ()
GstClockTime | gst_transcoder_get_duration ()
GstElement * | gst_transcoder_get_pipeline ()
gboolean | gst_transcoder_get_avoid_reencoding ()
void | gst_transcoder_set_avoid_reencoding ()

## Properties

gboolean | avoid-reencoding | Read / Write
gchar * | dest-uri | Read / Write / Construct Only
guint64 | duration | Read
GstElement * | pipeline | Read
guint64 | position | Read
guint | position-update-interval | Read / Write
GstEncodingProfile * | profile | Read / Write / Construct Only
GstTranscoderSignalDispatcher * | signal-dispatcher | Write / Construct Only
gchar * | src-uri | Read / Write / Construct Only

## Signals

void | done | No Hooks
void | duration-changed | No Hooks
void | position-updated | No Hooks

## Types and Values

| GstTranscoder

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GstObject
                ╰── GstTranscoder

## Description

## Functions

### gst_transcoder_new ()

    GstTranscoder *
    gst_transcoder_new (const gchar *source_uri,
                        const gchar *dest_uri,
                        const gchar *encoding_profile);

#### Parameters

source_uri | The URI of the media stream to transcode |
dest_uri | The URI of the destination of the transcoded stream |
encoding_profile | The serialized GstEncodingProfile defining the output format. Have a look at the GstEncodingProfile documentation to find more about the serialization format. |

#### Returns

a new GstTranscoder instance

### gst_transcoder_new_full ()

    GstTranscoder *
    gst_transcoder_new_full (const gchar *source_uri,
                             const gchar *dest_uri,
                             GstEncodingProfile *profile,
                             GstTranscoderSignalDispatcher *signal_dispatcher);

#### Parameters

source_uri | The URI of the media stream to transcode |
dest_uri | The URI of the destination of the transcoded stream |
profile | The GstEncodingProfile defining the output format have a look at the GstEncodingProfile documentation to find more about the serialization format. |
signal_dispatcher | The GstTranscoderSignalDispatcher to be used to dispatch the various signals. |

#### Returns

a new GstTranscoder instance

### gst_transcoder_run ()

    gboolean
    gst_transcoder_run (GstTranscoder *self,
                        GError **error);

Run the transcoder task synchonously. You can connect to the 'position' signal to get information about the progress of the transcoding.

#### Parameters

self | The GstTranscoder to run |
error | An error to be set if transcoding fails. | [allow-none]

### gst_transcoder_set_cpu_usage ()

    void
    gst_transcoder_set_cpu_usage (GstTranscoder *self,
                                  gint cpu_usage);

Sets `cpu_usage` as target percentage CPU usage of the process running the transcoding task. It will modulate the transcoding speed to reach that target usage.

#### Parameters

self | The GstTranscoder to limit CPU usage on. |
cpu_usage | The percentage of the CPU the process running the transcoder should try to use. It takes into account the number of cores avalaible. |

### gst_transcoder_run_async ()

    void
    gst_transcoder_run_async (GstTranscoder *self);

Run the transcoder task asynchonously. You should connect to the 'done' signal to be notified about when the transcoding is done, and to the 'error' signal to be notified about any error.

#### Parameters

self | The GstTranscoder to run |

### gst_transcoder_set_position_update_interval ()

    void
    gst_transcoder_set_position_update_interval
                                   (GstTranscoder *self,
                                    guint interval);

Set interval in milliseconds between two position-updated signals. Pass 0 to stop updating the position.

#### Parameters

self | GstTranscoder instance |
interval | interval in ms |

### gst_transcoder_get_source_uri ()

    gchar *
    gst_transcoder_get_source_uri (GstTranscoder *self);

Gets the URI of the currently-transcoding stream.

#### Parameters

self | GstTranscoder instance |

#### Returns

a string containing the URI of the source stream. `g_free()` after usage.

[transfer full]

### gst_transcoder_get_dest_uri ()

    gchar *
    gst_transcoder_get_dest_uri (GstTranscoder *self);

Gets the URI of the destination of the transcoded stream.

#### Parameters

self | GstTranscoder instance |

#### Returns

a string containing the URI of the destination of the transcoded stream. `g_free()` after usage.

[transfer full]

### gst_transcoder_get_position_update_interval ()

    guint
    gst_transcoder_get_position_update_interval
                                   (GstTranscoder *self);

#### Parameters

self | GstTranscoder instance |

#### Returns

current position update interval in milliseconds

### gst_transcoder_get_position ()

    GstClockTime
    gst_transcoder_get_position (GstTranscoder *self);

#### Parameters

self | GstTranscoder instance |

#### Returns

the absolute position time, in nanoseconds, of the transcoding stream.

### gst_transcoder_get_duration ()

    GstClockTime
    gst_transcoder_get_duration (GstTranscoder *self);

Retrieves the duration of the media stream that self represents.

#### Parameters

self | GstTranscoder instance |

#### Returns

the duration of the transcoding media stream, in nanoseconds.

### gst_transcoder_get_pipeline ()

    GstElement *
    gst_transcoder_get_pipeline (GstTranscoder *self);

#### Parameters

self | GstTranscoder instance |

#### Returns

The internal uritranscodebin instance.

[transfer full]

### gst_transcoder_get_avoid_reencoding ()

    gboolean
    gst_transcoder_get_avoid_reencoding (GstTranscoder *self);

#### Parameters

self | The GstTranscoder to check whether reencoding is avoided or not. |

#### Returns

`TRUE` if the transcoder tries to avoid reencoding streams where reencoding is not strictly needed, `FALSE` otherwise.

### gst_transcoder_set_avoid_reencoding ()

    void
    gst_transcoder_set_avoid_reencoding (GstTranscoder *self,
                                         gboolean avoid_reencoding);

#### Parameters

self | The GstTranscoder to set whether reencoding should be avoided or not. |
avoid_reencoding | `TRUE` if the transcoder should try to avoid reencoding streams where * reencoding is not strictly needed, `FALSE` otherwise. |

## Types and Values

### GstTranscoder

    typedef struct _GstTranscoder GstTranscoder;

## Property Details

### The `“avoid-reencoding”` property

      “avoid-reencoding”         gboolean

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

Flags: Read / Write

Default value: FALSE

### The `“dest-uri”` property

      “dest-uri”                 gchar *

Source URI.

Flags: Read / Write / Construct Only

Default value: NULL

### The `“duration”` property

      “duration”                 guint64

Duration.

Flags: Read

Default value: 18446744073709551615

### The `“pipeline”` property

      “pipeline”                 GstElement *

GStreamer pipeline that is used.

Flags: Read

### The `“position”` property

      “position”                 guint64

Current Position.

Flags: Read

Default value: 18446744073709551615

### The `“position-update-interval”` property

      “position-update-interval” guint

Interval in milliseconds between two position-updated signals.Pass 0 to stop updating the position.

Flags: Read / Write

Allowed values: <= 10000

Default value: 100

### The `“profile”` property

      “profile”                  GstEncodingProfile *

The GstEncodingProfile to use.

Flags: Read / Write / Construct Only

### The `“signal-dispatcher”` property

      “signal-dispatcher”        GstTranscoderSignalDispatcher *

Dispatcher for the signals to e.g. event loops.

Flags: Write / Construct Only

### The `“src-uri”` property

      “src-uri”                  gchar *

Source URI.

Flags: Read / Write / Construct Only

Default value: NULL

## Signal Details

### The `“done”` signal

    void
    user_function (GstTranscoder *gsttranscoder,
                   gpointer       user_data)

Flags: No Hooks

### The `“duration-changed”` signal

    void
    user_function (GstTranscoder *gsttranscoder,
                   guint64        arg1,
                   gpointer       user_data)

Flags: No Hooks

### The `“position-updated”` signal

    void
    user_function (GstTranscoder *gsttranscoder,
                   guint64        arg1,
                   gpointer       user_data)

Flags: No Hooks