Functions

  buffer_add_video_affine_transformation_meta (buffer)
  buffer_add_video_gl_texture_upload_meta (buffer, texture_orientation, n_textures, texture_type, upload, user_data, user_data_copy, user_data_free)
  buffer_add_video_meta (buffer, flags, format, width, height)
  buffer_add_video_meta_full (buffer, flags, format, width, height, n_planes, offset, stride)
  buffer_add_video_overlay_composition_meta (buf, comp)
  buffer_add_video_region_of_interest_meta (buffer, roi_type, x, y, w, h)
  buffer_add_video_region_of_interest_meta_id (buffer, roi_type, x, y, w, h)
  buffer_add_video_time_code_meta (buffer, tc)
  buffer_add_video_time_code_meta_full (buffer, fps_n, fps_d, latest_daily_jam, flags, hours, minutes, seconds, frames, field_count)
  buffer_get_video_meta (buffer)
  buffer_get_video_meta_id (buffer, id)
  buffer_get_video_region_of_interest_meta_id (buffer, id)
  buffer_pool_config_get_video_alignment (config, align)
  buffer_pool_config_set_video_alignment (config, align)
  is_video_overlay_prepare_window_handle_message (msg)
  navigation_event_get_type (event)
  navigation_event_parse_command (event)
  navigation_event_parse_key_event (event)
  navigation_event_parse_mouse_button_event (event)
  navigation_event_parse_mouse_move_event (event)
  navigation_message_get_type (message)
  navigation_message_new_angles_changed (src, cur_angle, n_angles)
  navigation_message_new_commands_changed (src)
  navigation_message_new_event (src, event)
  navigation_message_new_mouse_over (src, active)
  navigation_message_parse_angles_changed (message)
  navigation_message_parse_event (message)
  navigation_message_parse_mouse_over (message)
  navigation_query_get_type (query)
  navigation_query_new_angles ()
  navigation_query_new_commands ()
  navigation_query_parse_angles (query)
  navigation_query_parse_commands_length (query)
  navigation_query_parse_commands_nth (query, nth)
  navigation_query_set_angles (query, cur_angle, n_angles)
  navigation_query_set_commandsv (query, cmds)
  video_affine_transformation_meta_api_get_type ()
  video_affine_transformation_meta_get_info ()
  video_blend (dest, src, x, y, global_alpha)
  video_blend_scale_linear_RGBA (src, src_buffer, dest_height, dest_width)
  video_calculate_display_ratio (video_width, video_height, video_par_n, video_par_d, display_par_n, display_par_d)
  video_chroma_from_string (s)
  video_chroma_resample (resample, lines, width)
  video_chroma_to_string (site)
  video_color_matrix_get_Kr_Kb (matrix)
  video_color_primaries_get_info (primaries)
  video_color_range_offsets (range, info)
  video_color_transfer_decode (func, val)
  video_color_transfer_encode (func, val)
  video_convert_sample (sample, to_caps, timeout)
  video_convert_sample_async (sample, to_caps, timeout, callback, *user_data)
  video_crop_meta_api_get_type ()
  video_crop_meta_get_info ()
  video_event_is_force_key_unit (event)
  video_event_new_downstream_force_key_unit (timestamp, stream_time, running_time, all_headers, count)
  video_event_new_still_frame (in_still)
  video_event_new_upstream_force_key_unit (running_time, all_headers, count)
  video_event_parse_downstream_force_key_unit (event)
  video_event_parse_still_frame (event)
  video_event_parse_upstream_force_key_unit (event)
  video_field_order_from_string (order)
  video_field_order_to_string (order)
  video_format_from_fourcc (fourcc)
  video_format_from_masks (depth, bpp, endianness, red_mask, green_mask, blue_mask, alpha_mask)
  video_format_from_string (format)
  video_format_get_info (format)
  video_format_get_palette (format)
  video_format_to_fourcc (format)
  video_format_to_string (format)
  video_gl_texture_upload_meta_api_get_type ()
  video_gl_texture_upload_meta_get_info ()
  video_guess_framerate (duration)
  video_interlace_mode_from_string (mode)
  video_interlace_mode_to_string (mode)
  video_meta_api_get_type ()
  video_meta_get_info ()
  video_meta_transform_scale_get_quark ()
  video_multiview_get_doubled_height_modes ()
  video_multiview_get_doubled_size_modes ()
  video_multiview_get_doubled_width_modes ()
  video_multiview_get_mono_modes ()
  video_multiview_get_unpacked_modes ()
  video_multiview_guess_half_aspect (mv_mode, width, height, par_n, par_d)
  video_multiview_mode_from_caps_string (caps_mview_mode)
  video_multiview_mode_to_caps_string (mview_mode)
  video_multiview_video_info_change_mode (info, out_mview_mode, out_mview_flags)
  video_overlay_composition_meta_api_get_type ()
  video_overlay_composition_meta_get_info ()
  video_overlay_install_properties (oclass, last_prop_id)
  video_overlay_set_property (object, last_prop_id, property_id, value)
  video_region_of_interest_meta_api_get_type ()
  video_region_of_interest_meta_get_info ()
  video_tile_get_index (mode, x, y, x_tiles, y_tiles)
  video_time_code_meta_api_get_type ()
  video_time_code_meta_get_info ()

Details

GstVideo.buffer_add_video_affine_transformation_meta(buffer)[source]
Parameters:buffer (Gst.Buffer) – a Gst.Buffer
Returns:the GstVideo.VideoAffineTransformationMeta on buffer.
Return type:GstVideo.VideoAffineTransformationMeta

Attaches GstVideo.VideoAffineTransformationMeta metadata to buffer with the given parameters.

New in version 1.8.

GstVideo.buffer_add_video_gl_texture_upload_meta(buffer, texture_orientation, n_textures, texture_type, upload, user_data, user_data_copy, user_data_free)[source]
Parameters:
Returns:

the GstVideo.VideoGLTextureUploadMeta on buffer.

Return type:

GstVideo.VideoGLTextureUploadMeta

Attaches GstVideo.VideoGLTextureUploadMeta metadata to buffer with the given parameters.

GstVideo.buffer_add_video_meta(buffer, flags, format, width, height)[source]
Parameters:
Returns:

the GstVideo.VideoMeta on buffer.

Return type:

GstVideo.VideoMeta

Attaches GstVideo.VideoMeta metadata to buffer with the given parameters and the default offsets and strides for format and width x height.

This function calculates the default offsets and strides and then calls GstVideo.buffer_add_video_meta_full() with them.

GstVideo.buffer_add_video_meta_full(buffer, flags, format, width, height, n_planes, offset, stride)[source]
Parameters:
Returns:

the GstVideo.VideoMeta on buffer.

Return type:

GstVideo.VideoMeta

Attaches GstVideo.VideoMeta metadata to buffer with the given parameters.

GstVideo.buffer_add_video_overlay_composition_meta(buf, comp)[source]
Parameters:
Returns:

a GstVideo.VideoOverlayCompositionMeta

Return type:

GstVideo.VideoOverlayCompositionMeta

Sets an overlay composition on a buffer. The buffer will obtain its own reference to the composition, meaning this function does not take ownership of comp.

GstVideo.buffer_add_video_region_of_interest_meta(buffer, roi_type, x, y, w, h)[source]
Parameters:
  • buffer (Gst.Buffer) – a Gst.Buffer
  • roi_type (str) – Type of the region of interest (e.g. “face”)
  • x (int) – X position
  • y (int) – Y position
  • w (int) – width
  • h (int) – height
Returns:

the GstVideo.VideoRegionOfInterestMeta on buffer.

Return type:

GstVideo.VideoRegionOfInterestMeta

Attaches GstVideo.VideoRegionOfInterestMeta metadata to buffer with the given parameters.

GstVideo.buffer_add_video_region_of_interest_meta_id(buffer, roi_type, x, y, w, h)[source]
Parameters:
  • buffer (Gst.Buffer) – a Gst.Buffer
  • roi_type (int) – Type of the region of interest (e.g. “face”)
  • x (int) – X position
  • y (int) – Y position
  • w (int) – width
  • h (int) – height
Returns:

the GstVideo.VideoRegionOfInterestMeta on buffer.

Return type:

GstVideo.VideoRegionOfInterestMeta

Attaches GstVideo.VideoRegionOfInterestMeta metadata to buffer with the given parameters.

GstVideo.buffer_add_video_time_code_meta(buffer, tc)[source]
Parameters:
Returns:

the GstVideo.VideoTimeCodeMeta on buffer.

Return type:

GstVideo.VideoTimeCodeMeta

Attaches GstVideo.VideoTimeCodeMeta metadata to buffer with the given parameters.

New in version 1.10.

GstVideo.buffer_add_video_time_code_meta_full(buffer, fps_n, fps_d, latest_daily_jam, flags, hours, minutes, seconds, frames, field_count)[source]
Parameters:
Returns:

the GstVideo.VideoTimeCodeMeta on buffer.

Return type:

GstVideo.VideoTimeCodeMeta

Attaches GstVideo.VideoTimeCodeMeta metadata to buffer with the given parameters.

New in version 1.10.

GstVideo.buffer_get_video_meta(buffer)[source]
Parameters:buffer (Gst.Buffer) – a Gst.Buffer
Returns:the GstVideo.VideoMeta with lowest id (usually 0) or None when there is no such metadata on buffer.
Return type:GstVideo.VideoMeta

Find the GstVideo.VideoMeta on buffer with the lowest id.

Buffers can contain multiple GstVideo.VideoMeta metadata items when dealing with multiview buffers.

GstVideo.buffer_get_video_meta_id(buffer, id)[source]
Parameters:
Returns:

the GstVideo.VideoMeta with id or None when there is no such metadata on buffer.

Return type:

GstVideo.VideoMeta

Find the GstVideo.VideoMeta on buffer with the given id.

Buffers can contain multiple GstVideo.VideoMeta metadata items when dealing with multiview buffers.

GstVideo.buffer_get_video_region_of_interest_meta_id(buffer, id)[source]
Parameters:
Returns:

the GstVideo.VideoRegionOfInterestMeta with id or None when there is no such metadata on buffer.

Return type:

GstVideo.VideoRegionOfInterestMeta

Find the GstVideo.VideoRegionOfInterestMeta on buffer with the given id.

Buffers can contain multiple GstVideo.VideoRegionOfInterestMeta metadata items if multiple regions of interests are marked on a frame.

GstVideo.buffer_pool_config_get_video_alignment(config, align)[source]
Parameters:
Returns:

True if config could be parsed correctly.

Return type:

bool

Get the video alignment from the bufferpool configuration config in in align

GstVideo.buffer_pool_config_set_video_alignment(config, align)[source]
Parameters:

Set the video alignment in align to the bufferpool configuration config

GstVideo.is_video_overlay_prepare_window_handle_message(msg)[source]
Parameters:msg (Gst.Message) – a Gst.Message
Returns:whether msg is a “prepare-window-handle” message
Return type:bool

Convenience function to check if the given message is a “prepare-window-handle” message from a GstVideo.VideoOverlay.

GstVideo.navigation_event_get_type(event)[source]
Parameters:event (Gst.Event) – A Gst.Event to inspect.
Return type:GstVideo.NavigationEventType

Inspect a Gst.Event and return the GstVideo.NavigationEventType of the event, or GstVideo.NavigationEventType.INVALID if the event is not a GstVideo.Navigation event.

GstVideo.navigation_event_parse_command(event)[source]
Parameters:event (Gst.Event) – A Gst.Event to inspect.
Returns:True if the navigation command could be extracted, otherwise False.
command:Pointer to GstVideo.NavigationCommand to receive the type of the navigation event.
Return type:(bool, command: GstVideo.NavigationCommand)

Inspect a GstVideo.Navigation command event and retrieve the enum value of the associated command.

GstVideo.navigation_event_parse_key_event(event)[source]
Parameters:event (Gst.Event) – A Gst.Event to inspect.
Returns:
key:A pointer to a location to receive the string identifying the key press. The returned string is owned by the event, and valid only until the event is unreffed.
Return type:(bool, key: str)
GstVideo.navigation_event_parse_mouse_button_event(event)[source]
Parameters:event (Gst.Event) – A Gst.Event to inspect.
Returns:True if the button number and both coordinates could be extracted, otherwise False.
button:Pointer to a int that will receive the button number associated with the event.
x:Pointer to a float to receive the x coordinate of the mouse button event.
y:Pointer to a float to receive the y coordinate of the mouse button event.
Return type:(bool, button: int, x: float, y: float)

Retrieve the details of either a GstVideo.Navigation mouse button press event or a mouse button release event. Determine which type the event is using GstVideo.Navigation.event_get_type() to retrieve the GstVideo.NavigationEventType.

GstVideo.navigation_event_parse_mouse_move_event(event)[source]
Parameters:event (Gst.Event) – A Gst.Event to inspect.
Returns:True if both coordinates could be extracted, otherwise False.
x:Pointer to a float to receive the x coordinate of the mouse movement.
y:Pointer to a float to receive the y coordinate of the mouse movement.
Return type:(bool, x: float, y: float)

Inspect a GstVideo.Navigation mouse movement event and extract the coordinates of the event.

GstVideo.navigation_message_get_type(message)[source]
Parameters:message (Gst.Message) – A Gst.Message to inspect.
Returns:The type of the Gst.Message, or GstVideo.NavigationMessageType.INVALID if the message is not a GstVideo.Navigation notification.
Return type:GstVideo.NavigationMessageType

Check a bus message to see if it is a GstVideo.Navigation event, and return the GstVideo.NavigationMessageType identifying the type of the message if so.

GstVideo.navigation_message_new_angles_changed(src, cur_angle, n_angles)[source]
Parameters:
  • src (Gst.Object) – A Gst.Object to set as source of the new message.
  • cur_angle (int) – The currently selected angle.
  • n_angles (int) – The number of viewing angles now available.
Returns:

The new Gst.Message.

Return type:

Gst.Message

Creates a new GstVideo.Navigation message with type GstVideo.NavigationMessageType.ANGLES_CHANGED for notifying an application that the current angle, or current number of angles available in a multiangle video has changed.

GstVideo.navigation_message_new_commands_changed(src)[source]
Parameters:src (Gst.Object) – A Gst.Object to set as source of the new message.
Returns:The new Gst.Message.
Return type:Gst.Message

Creates a new GstVideo.Navigation message with type GstVideo.NavigationMessageType.COMMANDS_CHANGED

GstVideo.navigation_message_new_event(src, event)[source]
Parameters:
Returns:

The new Gst.Message.

Return type:

Gst.Message

Creates a new GstVideo.Navigation message with type GstVideo.NavigationMessageType.EVENT.

New in version 1.6.

GstVideo.navigation_message_new_mouse_over(src, active)[source]
Parameters:
  • src (Gst.Object) – A Gst.Object to set as source of the new message.
  • active (bool) – True if the mouse has entered a clickable area of the display. False if it over a non-clickable area.
Returns:

The new Gst.Message.

Return type:

Gst.Message

Creates a new GstVideo.Navigation message with type GstVideo.NavigationMessageType.MOUSE_OVER.

GstVideo.navigation_message_parse_angles_changed(message)[source]
Parameters:message (Gst.Message) – A Gst.Message to inspect.
Returns:True if the message could be successfully parsed. False if not.
cur_angle:A pointer to a int to receive the new current angle number, or None
n_angles:A pointer to a int to receive the new angle count, or None.
Return type:(bool, cur_angle: int, n_angles: int)

Parse a GstVideo.Navigation message of type GstVideo.NavigationMessageType.ANGLES_CHANGED and extract the cur_angle and n_angles parameters.

GstVideo.navigation_message_parse_event(message)[source]
Parameters:message (Gst.Message) – A Gst.Message to inspect.
Returns:True if the message could be successfully parsed. False if not.
event:a pointer to a Gst.Event to receive the contained navigation event.
Return type:(bool, event: Gst.Event)

Parse a GstVideo.Navigation message of type GstVideo.NavigationMessageType.EVENT and extract contained Gst.Event. The caller must unref the event when done with it.

New in version 1.6.

GstVideo.navigation_message_parse_mouse_over(message)[source]
Parameters:message (Gst.Message) – A Gst.Message to inspect.
Returns:True if the message could be successfully parsed. False if not.
active:A pointer to a bool to receive the active/inactive state, or None.
Return type:(bool, active: bool)

Parse a GstVideo.Navigation message of type GstVideo.NavigationMessageType.MOUSE_OVER and extract the active/inactive flag. If the mouse over event is marked active, it indicates that the mouse is over a clickable area.

GstVideo.navigation_query_get_type(query)[source]
Parameters:query (Gst.Query) – The query to inspect
Returns:The GstVideo.NavigationQueryType of the query, or GstVideo.NavigationQueryType.INVALID
Return type:GstVideo.NavigationQueryType

Inspect a Gst.Query and return the GstVideo.NavigationQueryType associated with it if it is a GstVideo.Navigation query.

GstVideo.navigation_query_new_angles()[source]
Returns:The new query.
Return type:Gst.Query

Create a new GstVideo.Navigation angles query. When executed, it will query the pipeline for the set of currently available angles, which may be greater than one in a multiangle video.

GstVideo.navigation_query_new_commands()[source]
Returns:The new query.
Return type:Gst.Query

Create a new GstVideo.Navigation commands query. When executed, it will query the pipeline for the set of currently available commands.

GstVideo.navigation_query_parse_angles(query)[source]
Parameters:query (Gst.Query) – a Gst.Query
Returns:True if the query could be successfully parsed. False if not.
cur_angle:Pointer to a int into which to store the currently selected angle value from the query, or None
n_angles:Pointer to a int into which to store the number of angles value from the query, or None
Return type:(bool, cur_angle: int, n_angles: int)

Parse the current angle number in the GstVideo.Navigation angles query into the int pointed to by the cur_angle variable, and the number of available angles into the int pointed to by the n_angles variable.

GstVideo.navigation_query_parse_commands_length(query)[source]
Parameters:query (Gst.Query) – a Gst.Query
Returns:True if the query could be successfully parsed. False if not.
n_cmds:the number of commands in this query.
Return type:(bool, n_cmds: int)

Parse the number of commands in the GstVideo.Navigation commands query.

GstVideo.navigation_query_parse_commands_nth(query, nth)[source]
Parameters:
Returns:

True if the query could be successfully parsed. False if not.

cmd:a pointer to store the nth command into.

Return type:

(bool, cmd: GstVideo.NavigationCommand)

Parse the GstVideo.Navigation command query and retrieve the nth command from it into cmd. If the list contains less elements than nth, cmd will be set to GstVideo.NavigationCommand.INVALID.

GstVideo.navigation_query_set_angles(query, cur_angle, n_angles)[source]
Parameters:
  • query (Gst.Query) – a Gst.Query
  • cur_angle (int) – the current viewing angle to set.
  • n_angles (int) – the number of viewing angles to set.

Set the GstVideo.Navigation angles query result field in query.

GstVideo.navigation_query_set_commandsv(query, cmds)[source]
Parameters:

Set the GstVideo.Navigation command query result fields in query. The number of commands passed must be equal to n_commands.

GstVideo.video_affine_transformation_meta_api_get_type()[source]
Return type:GObject.GType
GstVideo.video_affine_transformation_meta_get_info()[source]
Return type:Gst.MetaInfo
GstVideo.video_blend(dest, src, x, y, global_alpha)[source]
Parameters:
Return type:

bool

Lets you blend the src image into the dest image

GstVideo.video_blend_scale_linear_RGBA(src, src_buffer, dest_height, dest_width)[source]
Parameters:
  • src (GstVideo.VideoInfo) – the GstVideo.VideoInfo describing the video data in src_buffer
  • src_buffer (Gst.Buffer) – the source buffer containing video pixels to scale
  • dest_height (int) – the height in pixels to scale the video data in src_buffer to
  • dest_width (int) – the width in pixels to scale the video data in src_buffer to
Returns:

dest:pointer to a GstVideo.VideoInfo structure that will be filled in with the details for dest_buffer
dest_buffer:a pointer to a Gst.Buffer variable, which will be set to a newly-allocated buffer containing the scaled pixels.

Return type:

(dest: GstVideo.VideoInfo, dest_buffer: Gst.Buffer)

Scales a buffer containing RGBA (or AYUV) video. This is an internal helper function which is used to scale subtitle overlays, and may be deprecated in the near future. Use GstVideo.VideoScaler to scale video buffers instead.

GstVideo.video_calculate_display_ratio(video_width, video_height, video_par_n, video_par_d, display_par_n, display_par_d)[source]
Parameters:
  • video_width (int) – Width of the video frame in pixels
  • video_height (int) – Height of the video frame in pixels
  • video_par_n (int) – Numerator of the pixel aspect ratio of the input video.
  • video_par_d (int) – Denominator of the pixel aspect ratio of the input video.
  • display_par_n (int) – Numerator of the pixel aspect ratio of the display device
  • display_par_d (int) – Denominator of the pixel aspect ratio of the display device
Returns:

A boolean indicating success and a calculated Display Ratio in the dar_n and dar_d parameters. The return value is False in the case of integer overflow or other error.

dar_n:Numerator of the calculated display_ratio
dar_d:Denominator of the calculated display_ratio

Return type:

(bool, dar_n: int, dar_d: int)

Given the Pixel Aspect Ratio and size of an input video frame, and the pixel aspect ratio of the intended display device, calculates the actual display ratio the video will be rendered with.

GstVideo.video_chroma_from_string(s)[source]
Parameters:s (str) – a chromasite string
Returns:a GstVideo.VideoChromaSite or GstVideo.VideoChromaSite.UNKNOWN when s does not contain a valid chroma description.
Return type:GstVideo.VideoChromaSite

Convert s to a GstVideo.VideoChromaSite

GstVideo.video_chroma_resample(resample, lines, width)[source]
Parameters:

Perform resampling of width chroma pixels in lines.

GstVideo.video_chroma_to_string(site)[source]
Parameters:site (GstVideo.VideoChromaSite) – a GstVideo.VideoChromaSite
Returns:a string describing site.
Return type:str

Converts site to its string representation.

GstVideo.video_color_matrix_get_Kr_Kb(matrix)[source]
Parameters:matrix (GstVideo.VideoColorMatrix) – a GstVideo.VideoColorMatrix
Returns:True if matrix was a YUV color format and Kr and Kb contain valid values.
Kr:result red channel coefficient
Kb:result blue channel coefficient
Return type:(bool, Kr: float, Kb: float)

Get the coefficients used to convert between Y’PbPr and R’G’B’ using matrix.

When:

0.0 <= [Y',R',G',B'] <= 1.0)
(-0.5 <= [Pb,Pr] <= 0.5)

the general conversion is given by:

Y' = Kr*R' + (1-Kr-Kb)*G' + Kb*B'
Pb = (B'-Y')/(2*(1-Kb))
Pr = (R'-Y')/(2*(1-Kr))

and the other way around:

R' = Y' + Cr*2*(1-Kr)
G' = Y' - Cb*2*(1-Kb)*Kb/(1-Kr-Kb) - Cr*2*(1-Kr)*Kr/(1-Kr-Kb)
B' = Y' + Cb*2*(1-Kb)

New in version 1.6.

GstVideo.video_color_primaries_get_info(primaries)[source]
Parameters:primaries (GstVideo.VideoColorPrimaries) – a GstVideo.VideoColorPrimaries
Returns:a GstVideo.VideoColorPrimariesInfo for primaries.
Return type:GstVideo.VideoColorPrimariesInfo

Get information about the chromaticity coordinates of primaries.

New in version 1.6.

GstVideo.video_color_range_offsets(range, info)[source]
Parameters:
Returns:

offset:output offsets
scale:output scale

Return type:

(offset: [int], scale: [int])

Compute the offset and scale values for each component of info. For each component, (c[i] - offset[i]) / scale[i] will scale the component c[i] to the range [0.0 .. 1.0].

The reverse operation (c[i] * scale[i]) + offset[i] can be used to convert the component values in range [0.0 .. 1.0] back to their representation in info and range.

GstVideo.video_color_transfer_decode(func, val)[source]
Parameters:
Returns:

the gamme decoded value of val

Return type:

float

Convert val to its gamma decoded value. This is the inverse operation of gst_video_color_transfer_encode().

For a non-linear value L’ in the range [0..1], conversion to the linear L is in general performed with a power function like:

L = L' ^ gamma

Depending on func, different formulas might be applied. Some formulas encode a linear segment in the lower range.

New in version 1.6.

GstVideo.video_color_transfer_encode(func, val)[source]
Parameters:
Returns:

the gamme encoded value of val

Return type:

float

Convert val to its gamma encoded value.

For a linear value L in the range [0..1], conversion to the non-linear (gamma encoded) L’ is in general performed with a power function like:

L' = L ^ (1 / gamma)

Depending on func, different formulas might be applied. Some formulas encode a linear segment in the lower range.

New in version 1.6.

GstVideo.video_convert_sample(sample, to_caps, timeout)[source]
Parameters:
Raises:

GLib.Error

Returns:

The converted Gst.Sample, or None if an error happened (in which case err will point to the GLib.Error).

Return type:

Gst.Sample

Converts a raw video buffer into the specified output caps.

The output caps can be any raw video formats or any image formats (jpeg, png, …).

The width, height and pixel-aspect-ratio can also be specified in the output caps.

GstVideo.video_convert_sample_async(sample, to_caps, timeout, callback, *user_data)[source]
Parameters:

Converts a raw video buffer into the specified output caps.

The output caps can be any raw video formats or any image formats (jpeg, png, …).

The width, height and pixel-aspect-ratio can also be specified in the output caps.

callback will be called after conversion, when an error occured or if conversion didn’t finish after timeout. callback will always be called from the thread default GLib.MainContext, see GLib.MainContext.get_thread_default(). If GLib before 2.22 is used, this will always be the global default main context.

destroy_notify will be called after the callback was called and user_data is not needed anymore.

GstVideo.video_crop_meta_api_get_type()[source]
Return type:GObject.GType
GstVideo.video_crop_meta_get_info()[source]
Return type:Gst.MetaInfo
GstVideo.video_event_is_force_key_unit(event)[source]
Parameters:event (Gst.Event) – A Gst.Event to check
Returns:True if the event is a valid force key unit event
Return type:bool

Checks if an event is a force key unit event. Returns true for both upstream and downstream force key unit events.

GstVideo.video_event_new_downstream_force_key_unit(timestamp, stream_time, running_time, all_headers, count)[source]
Parameters:
  • timestamp (int) – the timestamp of the buffer that starts a new key unit
  • stream_time (int) – the stream_time of the buffer that starts a new key unit
  • running_time (int) – the running_time of the buffer that starts a new key unit
  • all_headers (bool) – True to produce headers when starting a new key unit
  • count (int) – integer that can be used to number key units
Returns:

The new Gst.Event

Return type:

Gst.Event

Creates a new downstream force key unit event. A downstream force key unit event can be sent down the pipeline to request downstream elements to produce a key unit. A downstream force key unit event must also be sent when handling an upstream force key unit event to notify downstream that the latter has been handled.

To parse an event created by GstVideo.video_event_new_downstream_force_key_unit() use GstVideo.video_event_parse_downstream_force_key_unit().

GstVideo.video_event_new_still_frame(in_still)[source]
Parameters:in_still (bool) – boolean value for the still-frame state of the event.
Returns:The new Gst.Event
Return type:Gst.Event

Creates a new Still Frame event. If in_still is True, then the event represents the start of a still frame sequence. If it is False, then the event ends a still frame sequence.

To parse an event created by GstVideo.video_event_new_still_frame() use GstVideo.video_event_parse_still_frame().

GstVideo.video_event_new_upstream_force_key_unit(running_time, all_headers, count)[source]
Parameters:
  • running_time (int) – the running_time at which a new key unit should be produced
  • all_headers (bool) – True to produce headers when starting a new key unit
  • count (int) – integer that can be used to number key units
Returns:

The new Gst.Event

Return type:

Gst.Event

Creates a new upstream force key unit event. An upstream force key unit event can be sent to request upstream elements to produce a key unit.

running_time can be set to request a new key unit at a specific running_time. If set to Gst.CLOCK_TIME_NONE, upstream elements will produce a new key unit as soon as possible.

To parse an event created by GstVideo.video_event_new_downstream_force_key_unit() use GstVideo.video_event_parse_downstream_force_key_unit().

GstVideo.video_event_parse_downstream_force_key_unit(event)[source]
Parameters:event (Gst.Event) – A Gst.Event to parse
Returns:True if the event is a valid downstream force key unit event.
timestamp:A pointer to the timestamp in the event
stream_time:A pointer to the stream-time in the event
running_time:A pointer to the running-time in the event
all_headers:A pointer to the all_headers flag in the event
count:A pointer to the count field of the event
Return type:(bool, timestamp: int, stream_time: int, running_time: int, all_headers: bool, count: int)

Get timestamp, stream-time, running-time, all-headers and count in the force key unit event. See GstVideo.video_event_new_downstream_force_key_unit() for a full description of the downstream force key unit event.

running_time will be adjusted for any pad offsets of pads it was passing through.

GstVideo.video_event_parse_still_frame(event)[source]
Parameters:event (Gst.Event) – A Gst.Event to parse
Returns:True if the event is a valid still-frame event. False if not
in_still:A boolean to receive the still-frame status from the event, or None
Return type:(bool, in_still: bool)

Parse a Gst.Event, identify if it is a Still Frame event, and return the still-frame state from the event if it is. If the event represents the start of a still frame, the in_still variable will be set to True, otherwise False. It is OK to pass None for the in_still variable order to just check whether the event is a valid still-frame event.

Create a still frame event using GstVideo.video_event_new_still_frame()

GstVideo.video_event_parse_upstream_force_key_unit(event)[source]
Parameters:event (Gst.Event) – A Gst.Event to parse
Returns:True if the event is a valid upstream force-key-unit event. False if not
running_time:A pointer to the running_time in the event
all_headers:A pointer to the all_headers flag in the event
count:A pointer to the count field in the event
Return type:(bool, running_time: int, all_headers: bool, count: int)

Get running-time, all-headers and count in the force key unit event. See GstVideo.video_event_new_upstream_force_key_unit() for a full description of the upstream force key unit event.

Create an upstream force key unit event using GstVideo.video_event_new_upstream_force_key_unit()

running_time will be adjusted for any pad offsets of pads it was passing through.

GstVideo.video_field_order_from_string(order)[source]
Parameters:order (str) – a field order
Returns:the GstVideo.VideoFieldOrder of order or GstVideo.VideoFieldOrder.UNKNOWN when order is not a valid string representation for a GstVideo.VideoFieldOrder.
Return type:GstVideo.VideoFieldOrder

Convert order to a GstVideo.VideoFieldOrder

New in version 1.12.

GstVideo.video_field_order_to_string(order)[source]
Parameters:order (GstVideo.VideoFieldOrder) – a GstVideo.VideoFieldOrder
Returns:order as a string or None if order in invalid.
Return type:str

Convert order to its string representation.

New in version 1.12.

GstVideo.video_format_from_fourcc(fourcc)[source]
Parameters:fourcc (int) – a FOURCC value representing raw YUV video
Returns:the GstVideo.VideoFormat describing the FOURCC value
Return type:GstVideo.VideoFormat

Converts a FOURCC value into the corresponding GstVideo.VideoFormat. If the FOURCC cannot be represented by GstVideo.VideoFormat, GstVideo.VideoFormat.UNKNOWN is returned.

GstVideo.video_format_from_masks(depth, bpp, endianness, red_mask, green_mask, blue_mask, alpha_mask)[source]
Parameters:
  • depth (int) – the amount of bits used for a pixel
  • bpp (int) – the amount of bits used to store a pixel. This value is bigger than depth
  • endianness (int) – the endianness of the masks, GLib.LITTLE_ENDIAN or GLib.BIG_ENDIAN
  • red_mask (int) – the red mask
  • green_mask (int) – the green mask
  • blue_mask (int) – the blue mask
  • alpha_mask (int) – the alpha mask, or 0 if no alpha mask
Returns:

a GstVideo.VideoFormat or GstVideo.VideoFormat.UNKNOWN when the parameters to not specify a known format.

Return type:

GstVideo.VideoFormat

Find the GstVideo.VideoFormat for the given parameters.

GstVideo.video_format_from_string(format)[source]
Parameters:format (str) – a format string
Returns:the GstVideo.VideoFormat for format or GstVideo.VideoFormat.UNKNOWN when the string is not a known format.
Return type:GstVideo.VideoFormat

Convert the format string to its GstVideo.VideoFormat.

GstVideo.video_format_get_info(format)[source]
Parameters:format (GstVideo.VideoFormat) – a GstVideo.VideoFormat
Returns:The GstVideo.VideoFormatInfo for format.
Return type:GstVideo.VideoFormatInfo

Get the GstVideo.VideoFormatInfo for format

GstVideo.video_format_get_palette(format)[source]
Parameters:format (GstVideo.VideoFormat) – a GstVideo.VideoFormat
Returns:the default palette of format or None when format does not have a palette.
size:size of the palette in bytes
Return type:(object or None, size: int)

Get the default palette of format. This the palette used in the pack function for paletted formats.

New in version 1.2.

GstVideo.video_format_to_fourcc(format)[source]
Parameters:format (GstVideo.VideoFormat) – a GstVideo.VideoFormat video format
Returns:the FOURCC corresponding to format
Return type:int

Converts a GstVideo.VideoFormat value into the corresponding FOURCC. Only a few YUV formats have corresponding FOURCC values. If format has no corresponding FOURCC value, 0 is returned.

GstVideo.video_format_to_string(format)[source]
Parameters:format (GstVideo.VideoFormat) – a GstVideo.VideoFormat video format
Returns:the name corresponding to format
Return type:str

Returns a string containing a descriptive name for the GstVideo.VideoFormat if there is one, or None otherwise.

GstVideo.video_gl_texture_upload_meta_api_get_type()[source]
Return type:GObject.GType
GstVideo.video_gl_texture_upload_meta_get_info()[source]
Return type:Gst.MetaInfo
GstVideo.video_guess_framerate(duration)[source]
Parameters:duration (int) – Nominal duration of one frame
Returns:True if a close “standard” framerate was recognised, and False otherwise.
dest_n:Numerator of the calculated framerate
dest_d:Denominator of the calculated framerate
Return type:(bool, dest_n: int, dest_d: int)

Given the nominal duration of one video frame, this function will check some standard framerates for a close match (within 0.1%) and return one if possible,

It will calculate an arbitrary framerate if no close match was found, and return False.

It returns False if a duration of 0 is passed.

New in version 1.6.

GstVideo.video_interlace_mode_from_string(mode)[source]
Parameters:mode (str) – a mode
Returns:the GstVideo.VideoInterlaceMode of mode or GstVideo.VideoInterlaceMode.PROGRESSIVE when mode is not a valid string representation for a GstVideo.VideoInterlaceMode.
Return type:GstVideo.VideoInterlaceMode

Convert mode to a GstVideo.VideoInterlaceMode

New in version 1.6.

GstVideo.video_interlace_mode_to_string(mode)[source]
Parameters:mode (GstVideo.VideoInterlaceMode) – a GstVideo.VideoInterlaceMode
Returns:mode as a string or None if mode in invalid.
Return type:str

Convert mode to its string representation.

New in version 1.6.

GstVideo.video_meta_api_get_type()[source]
Return type:GObject.GType
GstVideo.video_meta_get_info()[source]
Return type:Gst.MetaInfo
GstVideo.video_meta_transform_scale_get_quark()[source]
Returns:a #GQuark
Return type:int

Get the #GQuark for the “gst-video-scale” metadata transform operation.

GstVideo.video_multiview_get_doubled_height_modes()[source]
Returns:A const GObject.Value containing a list of stereo video modes

Utility function that returns a GObject.Value with a GstList of packed stereo video modes with double the height of a single view for use in caps negotiations. Currently this is top-bottom and row-interleaved.

Return type:GObject.Value

New in version 1.6.

GstVideo.video_multiview_get_doubled_size_modes()[source]
Returns:A const GObject.Value containing a list of stereo video modes

Utility function that returns a GObject.Value with a GstList of packed stereo video modes that have double the width/height of a single view for use in caps negotiation. Currently this is just ‘checkerboard’ layout.

Return type:GObject.Value

New in version 1.6.

GstVideo.video_multiview_get_doubled_width_modes()[source]
Returns:A const GObject.Value containing a list of stereo video modes

Utility function that returns a GObject.Value with a GstList of packed stereo video modes with double the width of a single view for use in caps negotiations. Currently this is side-by-side, side-by-side-quincunx and column-interleaved.

Return type:GObject.Value

New in version 1.6.

GstVideo.video_multiview_get_mono_modes()[source]
Returns:A const GObject.Value containing a list of mono video modes

Utility function that returns a GObject.Value with a GstList of mono video modes (mono/left/right) for use in caps negotiations.

Return type:GObject.Value

New in version 1.6.

GstVideo.video_multiview_get_unpacked_modes()[source]
Returns:A const GObject.Value containing a list of ‘unpacked’ stereo video modes

Utility function that returns a GObject.Value with a GstList of unpacked stereo video modes (separated/frame-by-frame/frame-by-frame-multiview) for use in caps negotiations.

Return type:GObject.Value

New in version 1.6.

GstVideo.video_multiview_guess_half_aspect(mv_mode, width, height, par_n, par_d)[source]
Parameters:
Returns:

A boolean indicating whether the #GST_VIDEO_MULTIVIEW_FLAG_HALF_ASPECT flag should be set.

Utility function that heuristically guess whether a frame-packed stereoscopic video contains half width/height encoded views, or full-frame views by looking at the overall display aspect ratio.

Return type:

bool

New in version 1.6.

GstVideo.video_multiview_mode_from_caps_string(caps_mview_mode)[source]
Parameters:caps_mview_mode (str) – multiview-mode field string from caps
Returns:The GstVideo.VideoMultiviewMode value

Given a string from a caps multiview-mode field, output the corresponding GstVideo.VideoMultiviewMode or GstVideo.VideoMultiviewMode.NONE

Return type:GstVideo.VideoMultiviewMode

New in version 1.6.

GstVideo.video_multiview_mode_to_caps_string(mview_mode)[source]
Parameters:mview_mode (GstVideo.VideoMultiviewMode) – A GstVideo.VideoMultiviewMode value
Returns:The caps string representation of the mode, or None if invalid.

Given a GstVideo.VideoMultiviewMode returns the multiview-mode caps string for insertion into a caps structure

Return type:str

New in version 1.6.

GstVideo.video_multiview_video_info_change_mode(info, out_mview_mode, out_mview_flags)[source]
Parameters:

Utility function that transforms the width/height/PAR and multiview mode and flags of a GstVideo.VideoInfo into the requested mode.

New in version 1.6.

GstVideo.video_overlay_composition_meta_api_get_type()[source]
Return type:GObject.GType
GstVideo.video_overlay_composition_meta_get_info()[source]
Return type:Gst.MetaInfo
GstVideo.video_overlay_install_properties(oclass, last_prop_id)[source]
Parameters:
  • oclass (GObject.ObjectClass) – The class on which the properties will be installed
  • last_prop_id (int) – The first free property ID to use

This helper shall be used by classes implementing the GstVideo.VideoOverlay interface that want the render rectangle to be controllable using properties. This helper will install “render-rectangle” property into the class.

New in version 1.14.

GstVideo.video_overlay_set_property(object, last_prop_id, property_id, value)[source]
Parameters:
Returns:

True if the property_id matches the GstVideo.VideoOverlay property

Return type:

bool

This helper shall be used by classes implementing the GstVideo.VideoOverlay interface that want the render rectangle to be controllable using properties. This helper will parse and set the render rectangle calling GstVideo.VideoOverlay.set_render_rectangle().

GstVideo.video_region_of_interest_meta_api_get_type()[source]
Return type:GObject.GType
GstVideo.video_region_of_interest_meta_get_info()[source]
Return type:Gst.MetaInfo
GstVideo.video_tile_get_index(mode, x, y, x_tiles, y_tiles)[source]
Parameters:
Returns:

the index of the tile at x and y in the tiled image of x_tiles by y_tiles.

Return type:

int

Get the tile index of the tile at coordinates x and y in the tiled image of x_tiles by y_tiles.

Use this method when mode is of type %GST_VIDEO_TILE_MODE_INDEXED.

New in version 1.4.

GstVideo.video_time_code_meta_api_get_type()[source]
Return type:GObject.GType
GstVideo.video_time_code_meta_get_info()[source]
Return type:Gst.MetaInfo