GstTranscoder.Transcoder

g GObject.InitiallyUnowned GObject.InitiallyUnowned Gst.Object Gst.Object GObject.InitiallyUnowned->Gst.Object GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned GstTranscoder.Transcoder GstTranscoder.Transcoder Gst.Object->GstTranscoder.Transcoder

Subclasses:

None

Methods

Inherited:

Gst.Object (27), GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

is_transcoder_message (msg)

class

new (source_uri, dest_uri, encoding_profile)

class

new_full (source_uri, dest_uri, profile)

get_avoid_reencoding ()

get_dest_uri ()

get_duration ()

get_message_bus ()

get_pipeline ()

get_position ()

get_position_update_interval ()

get_signal_adapter (context)

get_source_uri ()

get_sync_signal_adapter ()

run ()

run_async ()

set_avoid_reencoding (avoid_reencoding)

set_cpu_usage (cpu_usage)

set_position_update_interval (interval)

Virtual Methods

Inherited:

Gst.Object (1), GObject.Object (7)

Properties

Inherited:

Gst.Object (2)

Name

Type

Flags

Short Description

avoid-reencoding

bool

r/w

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

dest-uri

str

r/w/co

Source URI

duration

int

r

Duration

pipeline

Gst.Element

r

GStreamer pipeline that is used

position

int

r

Current Position

position-update-interval

int

r/w

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

profile

GstPbutils.EncodingProfile

r/w/co

The GstPbutils.EncodingProfile to use

src-uri

str

r/w/co

Source URI

Signals

Inherited:

Gst.Object (1), GObject.Object (1)

Fields

Inherited:

Gst.Object (1), GObject.Object (1)

Class Details

class GstTranscoder.Transcoder(**kwargs)
Bases:

Gst.Object

Abstract:

No

Structure:

GstTranscoder.TranscoderClass

classmethod is_transcoder_message(msg)
Parameters:

msg (Gst.Message) – A Gst.Message

Returns:

A bool indicating whether the passes message represents a GstTranscoder.Transcoder message or not.

Return type:

bool

New in version 1.20.

classmethod new(source_uri, dest_uri, encoding_profile)
Parameters:
  • source_uri (str) – The URI of the media stream to transcode

  • dest_uri (str) – The URI of the destination of the transcoded stream

  • encoding_profile (str) – The serialized GstPbutils.EncodingProfile defining the output format. Have a look at the GstPbutils.EncodingProfile documentation to find more about the serialization format.

Returns:

a new GstTranscoder.Transcoder instance

Return type:

GstTranscoder.Transcoder

classmethod new_full(source_uri, dest_uri, profile)
Parameters:
Returns:

a new GstTranscoder.Transcoder instance

Return type:

GstTranscoder.Transcoder

get_avoid_reencoding()
Returns:

True if the transcoder tries to avoid reencoding streams where reencoding is not strictly needed, False otherwise.

Return type:

bool

get_dest_uri()
Returns:

a string containing the URI of the destination of the transcoded stream. GLib.free() after usage.

Return type:

str

Gets the URI of the destination of the transcoded stream.

get_duration()
Returns:

the duration of the transcoding media stream, in nanoseconds.

Return type:

int

Retrieves the duration of the media stream that self represents.

get_message_bus()
Returns:

The transcoder message bus instance

Return type:

Gst.Bus

GstTranscoder.Transcoder API exposes a Gst.Bus instance which purpose is to provide data structures representing transcoder-internal events in form of Gst.Message-s of type Gst.MessageType.APPLICATION.

Each message carries a “transcoder-message” field of type GstTranscoder.TranscoderMessage. Further fields of the message data are specific to each possible value of that enumeration.

Applications can consume the messages asynchronously within their own event-loop / UI-thread etc. Note that in case the application does not consume the messages, the bus will accumulate these internally and eventually fill memory. To avoid that, the bus has to be set “flushing”.

New in version 1.20.

get_pipeline()
Returns:

The internal uritranscodebin instance

Return type:

Gst.Element

get_position()
Returns:

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

Return type:

int

get_position_update_interval()
Returns:

current position update interval in milliseconds

Return type:

int

get_signal_adapter(context)
Parameters:

context (GLib.MainContext or None) – A GLib.MainContext on which the main-loop will process transcoder bus messages on. Can be None (thread-default context will be used then).

Returns:

The GstTranscoder.TranscoderSignalAdapter to connect signal handlers to.

Return type:

GstTranscoder.TranscoderSignalAdapter or None

Gets the GstTranscoder.TranscoderSignalAdapter attached to self if it is attached to the right GLib.MainContext. If no GstTranscoder.TranscoderSignalAdapter has been created yet, it will be created and returned, other calls will return that same adapter until it is destroyed, at which point, a new one can be attached the same way.

New in version 1.20.

get_source_uri()
Returns:

a string containing the URI of the source stream. GLib.free() after usage.

Return type:

str

Gets the URI of the currently-transcoding stream.

get_sync_signal_adapter()
Returns:

The GstTranscoder.TranscoderSignalAdapter to connect signal handlers to.

Return type:

GstTranscoder.TranscoderSignalAdapter

Gets the GstTranscoder.TranscoderSignalAdapter attached to self to emit signals from its thread of emission.

New in version 1.20.

run()
Raises:

GLib.Error

Return type:

bool

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

run_async()

Run the transcoder task asynchronously. 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.

set_avoid_reencoding(avoid_reencoding)
Parameters:

avoid_reencoding (bool) – True if the transcoder should try to avoid reencoding streams where * reencoding is not strictly needed, False otherwise.

set_cpu_usage(cpu_usage)
Parameters:

cpu_usage (int) – The percentage of the CPU the process running the transcoder should try to use. It takes into account the number of cores available.

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.

set_position_update_interval(interval)
Parameters:

interval (int) – interval in ms

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

Property Details

GstTranscoder.Transcoder.props.avoid_reencoding
Name:

avoid-reencoding

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

See #encodebin:avoid-reencoding

GstTranscoder.Transcoder.props.dest_uri
Name:

dest-uri

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

Source URI

GstTranscoder.Transcoder.props.duration
Name:

duration

Type:

int

Default Value:

18446744073709551615

Flags:

READABLE

Duration

GstTranscoder.Transcoder.props.pipeline
Name:

pipeline

Type:

Gst.Element

Default Value:

None

Flags:

READABLE

GStreamer pipeline that is used

GstTranscoder.Transcoder.props.position
Name:

position

Type:

int

Default Value:

18446744073709551615

Flags:

READABLE

Current Position

GstTranscoder.Transcoder.props.position_update_interval
Name:

position-update-interval

Type:

int

Default Value:

100

Flags:

READABLE, WRITABLE

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

GstTranscoder.Transcoder.props.profile
Name:

profile

Type:

GstPbutils.EncodingProfile

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The GstPbutils.EncodingProfile to use

GstTranscoder.Transcoder.props.src_uri
Name:

src-uri

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

Source URI