Functions

ancillary_meta_api_get_type ()

ancillary_meta_get_info ()

buffer_add_ancillary_meta (buffer)

buffer_add_video_afd_meta (buffer, field, spec, afd)

buffer_add_video_affine_transformation_meta (buffer)

buffer_add_video_bar_meta (buffer, field, is_letterbox, bar_data1, bar_data2)

buffer_add_video_caption_meta (buffer, caption_type, data)

buffer_add_video_codec_alpha_meta (buffer, alpha_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_sei_user_data_unregistered_meta (buffer, uuid, data, size)

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_coordinates (event)

navigation_event_get_type (event)

navigation_event_new_command (command)

navigation_event_new_key_press (key, state)

navigation_event_new_key_release (key, state)

navigation_event_new_mouse_button_press (button, x, y, state)

navigation_event_new_mouse_button_release (button, x, y, state)

navigation_event_new_mouse_move (x, y, state)

navigation_event_new_mouse_scroll (x, y, delta_x, delta_y, state)

navigation_event_new_touch_cancel (state)

navigation_event_new_touch_down (identifier, x, y, pressure, state)

navigation_event_new_touch_frame (state)

navigation_event_new_touch_motion (identifier, x, y, pressure, state)

navigation_event_new_touch_up (identifier, x, y, state)

navigation_event_parse_command (event)

navigation_event_parse_key_event (event)

navigation_event_parse_modifier_state (event, state)

navigation_event_parse_mouse_button_event (event)

navigation_event_parse_mouse_move_event (event)

navigation_event_parse_mouse_scroll_event (event)

navigation_event_parse_touch_event (event)

navigation_event_parse_touch_up_event (event)

navigation_event_set_coordinates (event, x, y)

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_afd_meta_api_get_type ()

video_afd_meta_get_info ()

video_affine_transformation_meta_api_get_type ()

video_affine_transformation_meta_get_info ()

video_bar_meta_api_get_type ()

video_bar_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_caption_meta_api_get_type ()

video_caption_meta_get_info ()

video_caption_type_from_caps (caps)

video_caption_type_to_caps (type)

video_center_rect (src, dst, scaling)

video_chroma_from_string (s)

video_chroma_resample (resample, lines, width)

video_chroma_site_from_string (s)

video_chroma_site_to_string (site)

video_chroma_to_string (site)

video_codec_alpha_meta_api_get_type ()

video_codec_alpha_meta_get_info ()

video_color_matrix_from_iso (value)

video_color_matrix_get_Kr_Kb (matrix)

video_color_matrix_to_iso (matrix)

video_color_primaries_from_iso (value)

video_color_primaries_get_info (primaries)

video_color_primaries_is_equivalent (primaries, other)

video_color_primaries_to_iso (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_dma_drm_fourcc_from_format (format)

video_dma_drm_fourcc_from_string (format_str)

video_dma_drm_fourcc_to_format (fourcc)

video_dma_drm_fourcc_to_string (fourcc, modifier)

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_formats_any ()

video_formats_raw ()

video_frame_map (info, buffer, flags)

video_frame_map_id (info, buffer, id, flags)

video_gl_texture_upload_meta_api_get_type ()

video_gl_texture_upload_meta_get_info ()

video_guess_framerate (duration)

video_info_dma_drm_from_caps (caps)

video_info_dma_drm_from_video_info (info, modifier)

video_info_dma_drm_init ()

video_info_from_caps (caps)

video_info_init ()

video_interlace_mode_from_string (mode)

video_interlace_mode_to_string (mode)

video_is_common_aspect_ratio (width, height, par_n, par_d)

video_is_dma_drm_caps (caps)

video_make_raw_caps (formats)

video_make_raw_caps_with_features (formats, features)

video_mastering_display_info_from_string (mastering)

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_orientation_from_tag (taglist)

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_sei_user_data_unregistered_meta_api_get_type ()

video_sei_user_data_unregistered_meta_get_info ()

video_sei_user_data_unregistered_parse_precision_time_stamp (user_data)

video_tile_get_index (mode, x, y, x_tiles, y_tiles)

video_time_code_meta_api_get_type ()

video_time_code_meta_get_info ()

video_transfer_function_decode (func, val)

video_transfer_function_encode (func, val)

video_transfer_function_from_iso (value)

video_transfer_function_is_equivalent (from_func, from_bpp, to_func, to_bpp)

video_transfer_function_to_iso (func)

Details

GstVideo.ancillary_meta_api_get_type()
Return type:

GObject.GType

GstVideo.ancillary_meta_get_info()
Return type:

Gst.MetaInfo

GstVideo.buffer_add_ancillary_meta(buffer)
Parameters:

buffer (Gst.Buffer) – A Gst.Buffer

Returns:

A new GstVideo.AncillaryMeta, or None if an error happened.

Return type:

GstVideo.AncillaryMeta

Adds a new GstVideo.AncillaryMeta to the buffer. The caller is responsible for setting the appropriate fields.

New in version 1.24.

GstVideo.buffer_add_video_afd_meta(buffer, field, spec, afd)
Parameters:
Returns:

the GstVideo.VideoAFDMeta on buffer.

Return type:

GstVideo.VideoAFDMeta

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

New in version 1.18.

GstVideo.buffer_add_video_affine_transformation_meta(buffer)
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_bar_meta(buffer, field, is_letterbox, bar_data1, bar_data2)
Parameters:
  • buffer (Gst.Buffer) – a Gst.Buffer

  • field (int) – 0 for progressive or field 1 and 1 for field 2

  • is_letterbox (bool) – if true then bar data specifies letterbox, otherwise pillarbox

  • bar_data1 (int) – If is_letterbox is true, then the value specifies the last line of a horizontal letterbox bar area at top of reconstructed frame. Otherwise, it specifies the last horizontal luminance sample of a vertical pillarbox bar area at the left side of the reconstructed frame

  • bar_data2 (int) – If is_letterbox is true, then the value specifies the first line of a horizontal letterbox bar area at bottom of reconstructed frame. Otherwise, it specifies the first horizontal luminance sample of a vertical pillarbox bar area at the right side of the reconstructed frame.

Returns:

the GstVideo.VideoBarMeta on buffer.

See Table 6.11 Bar Data Syntax

https://www.atsc.org/wp-content/uploads/2015/03/a_53-Part-4-2009.pdf

Return type:

GstVideo.VideoBarMeta

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

New in version 1.18.

GstVideo.buffer_add_video_caption_meta(buffer, caption_type, data)
Parameters:
Returns:

the GstVideo.VideoCaptionMeta on buffer.

Return type:

GstVideo.VideoCaptionMeta

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

New in version 1.16.

GstVideo.buffer_add_video_codec_alpha_meta(buffer, alpha_buffer)
Parameters:
Returns:

the GstVideo.VideoCodecAlphaMeta on buffer.

Return type:

GstVideo.VideoCodecAlphaMeta

Attaches a GstVideo.VideoCodecAlphaMeta metadata to buffer with the given alpha buffer.

New in version 1.20.

GstVideo.buffer_add_video_gl_texture_upload_meta(buffer, texture_orientation, n_textures, texture_type, upload, user_data, user_data_copy, user_data_free)
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)
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)
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)
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)
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)
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_sei_user_data_unregistered_meta(buffer, uuid, data, size)
Parameters:
  • buffer (Gst.Buffer) – a Gst.Buffer

  • uuid (int) – User Data Unregistered UUID

  • data (int) – SEI User Data Unregistered buffer

  • size (int) – size of the data buffer

Returns:

the GstVideo.VideoSEIUserDataUnregisteredMeta on buffer.

Return type:

GstVideo.VideoSEIUserDataUnregisteredMeta

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

New in version 1.22.

GstVideo.buffer_add_video_time_code_meta(buffer, tc)
Parameters:
Returns:

the GstVideo.VideoTimeCodeMeta on buffer, or (since 1.16) None if the timecode was invalid.

Return type:

GstVideo.VideoTimeCodeMeta or None

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)
Parameters:
Returns:

the GstVideo.VideoTimeCodeMeta on buffer, or (since 1.16) None if the timecode was invalid.

Return type:

GstVideo.VideoTimeCodeMeta or None

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

New in version 1.10.

GstVideo.buffer_get_video_meta(buffer)
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 or None

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)
Parameters:
Returns:

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

Return type:

GstVideo.VideoMeta or None

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)
Parameters:
Returns:

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

Return type:

GstVideo.VideoRegionOfInterestMeta or None

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)
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)
Parameters:

Set the video alignment in align to the bufferpool configuration config

GstVideo.is_video_overlay_prepare_window_handle_message(msg)
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_coordinates(event)
Parameters:

event (Gst.Event) – The Gst.Event to inspect.

Returns:

A boolean indicating success.

x:

Pointer to a float to receive the x coordinate of the navigation event.

y:

Pointer to a float to receive the y coordinate of the navigation event.

Return type:

(bool, x: float, y: float)

Try to retrieve x and y coordinates of a GstVideo.Navigation event.

New in version 1.22.

GstVideo.navigation_event_get_type(event)
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_new_command(command)
Parameters:

command (GstVideo.NavigationCommand) – The navigation command to use.

Returns:

a new Gst.Event

Return type:

Gst.Event

Create a new navigation event given navigation command..

New in version 1.22.

GstVideo.navigation_event_new_key_press(key, state)
Parameters:
  • key (str) – A string identifying the key press.

  • state (GstVideo.NavigationModifierType) – a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt).

Returns:

a new Gst.Event

Return type:

Gst.Event

Create a new navigation event for the given key press.

New in version 1.22.

GstVideo.navigation_event_new_key_release(key, state)
Parameters:
  • key (str) – A string identifying the released key.

  • state (GstVideo.NavigationModifierType) – a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt).

Returns:

a new Gst.Event

Return type:

Gst.Event

Create a new navigation event for the given key release.

New in version 1.22.

GstVideo.navigation_event_new_mouse_button_press(button, x, y, state)
Parameters:
  • button (int) – The number of the pressed mouse button.

  • x (float) – The x coordinate of the mouse cursor.

  • y (float) – The y coordinate of the mouse cursor.

  • state (GstVideo.NavigationModifierType) – a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt).

Returns:

a new Gst.Event

Return type:

Gst.Event

Create a new navigation event for the given key mouse button press.

New in version 1.22.

GstVideo.navigation_event_new_mouse_button_release(button, x, y, state)
Parameters:
  • button (int) – The number of the released mouse button.

  • x (float) – The x coordinate of the mouse cursor.

  • y (float) – The y coordinate of the mouse cursor.

  • state (GstVideo.NavigationModifierType) – a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt).

Returns:

a new Gst.Event

Return type:

Gst.Event

Create a new navigation event for the given key mouse button release.

New in version 1.22.

GstVideo.navigation_event_new_mouse_move(x, y, state)
Parameters:
  • x (float) – The x coordinate of the mouse cursor.

  • y (float) – The y coordinate of the mouse cursor.

  • state (GstVideo.NavigationModifierType) – a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt).

Returns:

a new Gst.Event

Return type:

Gst.Event

Create a new navigation event for the new mouse location.

New in version 1.22.

GstVideo.navigation_event_new_mouse_scroll(x, y, delta_x, delta_y, state)
Parameters:
  • x (float) – The x coordinate of the mouse cursor.

  • y (float) – The y coordinate of the mouse cursor.

  • delta_x (float) – The x component of the scroll movement.

  • delta_y (float) – The y component of the scroll movement.

  • state (GstVideo.NavigationModifierType) – a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt).

Returns:

a new Gst.Event

Return type:

Gst.Event

Create a new navigation event for the mouse scroll.

New in version 1.22.

GstVideo.navigation_event_new_touch_cancel(state)
Parameters:

state (GstVideo.NavigationModifierType) – a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt).

Returns:

a new Gst.Event

Return type:

Gst.Event

Create a new navigation event signalling that all currently active touch points are cancelled and should be discarded. For example, under Wayland this event might be sent when a swipe passes the threshold to be recognized as a gesture by the compositor.

New in version 1.22.

GstVideo.navigation_event_new_touch_down(identifier, x, y, pressure, state)
Parameters:
  • identifier (int) – A number uniquely identifying this touch point. It must stay unique to this touch point at least until an up event is sent for the same identifier, or all touch points are cancelled.

  • x (float) – The x coordinate of the new touch point.

  • y (float) – The y coordinate of the new touch point.

  • pressure (float) – Pressure data of the touch point, from 0.0 to 1.0, or NaN if no data is available.

  • state (GstVideo.NavigationModifierType) – a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt).

Returns:

a new Gst.Event

Return type:

Gst.Event

Create a new navigation event for an added touch point.

New in version 1.22.

GstVideo.navigation_event_new_touch_frame(state)
Parameters:

state (GstVideo.NavigationModifierType) – a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt).

Returns:

a new Gst.Event

Return type:

Gst.Event

Create a new navigation event signalling the end of a touch frame. Touch frames signal that all previous down, motion and up events not followed by another touch frame event already should be considered simultaneous.

New in version 1.22.

GstVideo.navigation_event_new_touch_motion(identifier, x, y, pressure, state)
Parameters:
  • identifier (int) – A number uniquely identifying this touch point. It must correlate to exactly one previous touch_start event.

  • x (float) – The x coordinate of the touch point.

  • y (float) – The y coordinate of the touch point.

  • pressure (float) – Pressure data of the touch point, from 0.0 to 1.0, or NaN if no data is available.

  • state (GstVideo.NavigationModifierType) – a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt).

Returns:

a new Gst.Event

Return type:

Gst.Event

Create a new navigation event for a moved touch point.

New in version 1.22.

GstVideo.navigation_event_new_touch_up(identifier, x, y, state)
Parameters:
  • identifier (int) – A number uniquely identifying this touch point. It must correlate to exactly one previous down event, but can be reused after sending this event.

  • x (float) – The x coordinate of the touch point.

  • y (float) – The y coordinate of the touch point.

  • state (GstVideo.NavigationModifierType) – a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt).

Returns:

a new Gst.Event

Return type:

Gst.Event

Create a new navigation event for a removed touch point.

New in version 1.22.

GstVideo.navigation_event_parse_command(event)
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)
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)

Note: Modifier keys (as defined in GstVideo.NavigationModifierType) press and release events are generated even if those states are present on all other related events

GstVideo.navigation_event_parse_modifier_state(event, state)
Parameters:
Returns:

True if the event is a GstVideo.Navigation event with associated modifiers state, otherwise False.

Return type:

bool

New in version 1.22.

GstVideo.navigation_event_parse_mouse_button_event(event)
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)
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_event_parse_mouse_scroll_event(event)
Parameters:

event (Gst.Event) – A Gst.Event to inspect.

Returns:

True if all 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.

delta_x:

Pointer to a float to receive the delta_x coordinate of the mouse movement.

delta_y:

Pointer to a float to receive the delta_y coordinate of the mouse movement.

Return type:

(bool, x: float, y: float, delta_x: float, delta_y: float)

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

New in version 1.18.

GstVideo.navigation_event_parse_touch_event(event)
Parameters:

event (Gst.Event) – A Gst.Event to inspect.

Returns:

True if all details could be extracted, otherwise False.

identifier:

Pointer to a int that will receive the identifier unique to this touch point.

x:

Pointer to a float that will receive the x coordinate of the touch event.

y:

Pointer to a float that will receive the y coordinate of the touch event.

pressure:

Pointer to a float that will receive the force of the touch event, in the range from 0.0 to 1.0. If pressure data is not available, NaN will be set instead.

Return type:

(bool, identifier: int, x: float, y: float, pressure: float)

Retrieve the details of a GstVideo.Navigation touch-down or touch-motion event. Determine which type the event is using GstVideo.Navigation.event_get_type() to retrieve the GstVideo.NavigationEventType.

New in version 1.22.

GstVideo.navigation_event_parse_touch_up_event(event)
Parameters:

event (Gst.Event) – A Gst.Event to inspect.

Returns:

True if all details could be extracted, otherwise False.

identifier:

Pointer to a int that will receive the identifier unique to this touch point.

x:

Pointer to a float that will receive the x coordinate of the touch event.

y:

Pointer to a float that will receive the y coordinate of the touch event.

Return type:

(bool, identifier: int, x: float, y: float)

Retrieve the details of a GstVideo.Navigation touch-up event.

New in version 1.22.

GstVideo.navigation_event_set_coordinates(event, x, y)
Parameters:
Returns:

A boolean indicating success.

Return type:

bool

Try to set x and y coordinates on a GstVideo.Navigation event. The event must be writable.

New in version 1.22.

GstVideo.navigation_message_get_type(message)
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)
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)
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)
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)
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)
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)
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)
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)
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()
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()
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)
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)
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)
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)
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)
Parameters:

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

GstVideo.video_afd_meta_api_get_type()
Return type:

GObject.GType

GstVideo.video_afd_meta_get_info()
Return type:

Gst.MetaInfo

GstVideo.video_affine_transformation_meta_api_get_type()
Return type:

GObject.GType

GstVideo.video_affine_transformation_meta_get_info()
Return type:

Gst.MetaInfo

GstVideo.video_bar_meta_api_get_type()
Return type:

GObject.GType

GstVideo.video_bar_meta_get_info()
Return type:

Gst.MetaInfo

GstVideo.video_blend(dest, src, x, y, global_alpha)
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)
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)
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_caption_meta_api_get_type()
Return type:

GObject.GType

GstVideo.video_caption_meta_get_info()
Return type:

Gst.MetaInfo

GstVideo.video_caption_type_from_caps(caps)
Parameters:

caps (Gst.Caps) – Fixed Gst.Caps to parse

Returns:

GstVideo.VideoCaptionType.

Return type:

GstVideo.VideoCaptionType

Parses fixed Closed Caption Gst.Caps and returns the corresponding caption type, or GstVideo.VideoCaptionType.UNKNOWN.

New in version 1.16.

GstVideo.video_caption_type_to_caps(type)
Parameters:

type (GstVideo.VideoCaptionType) – GstVideo.VideoCaptionType

Returns:

new Gst.Caps

Return type:

Gst.Caps

Creates new caps corresponding to type.

New in version 1.16.

GstVideo.video_center_rect(src, dst, scaling)
Parameters:
Returns:

a pointer to a GstVideo.VideoRectangle which will receive the result area

Return type:

result: GstVideo.VideoRectangle

Takes src rectangle and position it at the center of dst rectangle with or without scaling. It handles clipping if the src rectangle is bigger than the dst one and scaling is set to False.

New in version 1.20.

GstVideo.video_chroma_from_string(s)
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

Deprecated since version 1.20: Use GstVideo.VideoChromaSite.from_string() instead.

GstVideo.video_chroma_resample(resample, lines, width)
Parameters:

Perform resampling of width chroma pixels in lines.

GstVideo.video_chroma_site_from_string(s)
Parameters:

s (str) – a chromasite string

Returns:

a GstVideo.VideoChromaSite or GstVideo.VideoChromaSite.UNKNOWN when s does not contain a valid chroma-site description.

Return type:

GstVideo.VideoChromaSite

Convert s to a GstVideo.VideoChromaSite

New in version 1.20.

GstVideo.video_chroma_site_to_string(site)
Parameters:

site (GstVideo.VideoChromaSite) – a GstVideo.VideoChromaSite

Returns:

a string representation of site or None if site contains undefined value or is equal to GstVideo.VideoChromaSite.UNKNOWN

Return type:

str or None

Converts site to its string representation.

New in version 1.20.

GstVideo.video_chroma_to_string(site)
Parameters:

site (GstVideo.VideoChromaSite) – a GstVideo.VideoChromaSite

Returns:

a string describing site.

Return type:

str

Converts site to its string representation.

Deprecated since version 1.20: Use GstVideo.VideoChromaSite.to_string() instead.

GstVideo.video_codec_alpha_meta_api_get_type()
Returns:

GObject.GType for the GstVideo.VideoCodecAlphaMeta structure.

Return type:

GObject.GType

New in version 1.20.

GstVideo.video_codec_alpha_meta_get_info()
Returns:

Gst.MetaInfo pointer that describes GstVideo.VideoCodecAlphaMeta.

Return type:

Gst.MetaInfo

New in version 1.20.

GstVideo.video_color_matrix_from_iso(value)
Parameters:

value (int) – a ITU-T H.273 matrix coefficients value

Returns:

the matched GstVideo.VideoColorMatrix

Return type:

GstVideo.VideoColorMatrix

Converts the value to the GstVideo.VideoColorMatrix The matrix coefficients (MatrixCoefficients) value is defined by “ISO/IEC 23001-8 Section 7.3 Table 4” and “ITU-T H.273 Table 4”. “H.264 Table E-5” and “H.265 Table E.5” share the identical values.

New in version 1.18.

GstVideo.video_color_matrix_get_Kr_Kb(matrix)
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_matrix_to_iso(matrix)
Parameters:

matrix (GstVideo.VideoColorMatrix) – a GstVideo.VideoColorMatrix

Returns:

The value of ISO/IEC 23001-8 matrix coefficients.

Return type:

int

Converts GstVideo.VideoColorMatrix to the “matrix coefficients” (MatrixCoefficients) value defined by “ISO/IEC 23001-8 Section 7.3 Table 4” and “ITU-T H.273 Table 4”. “H.264 Table E-5” and “H.265 Table E.5” share the identical values.

New in version 1.18.

GstVideo.video_color_primaries_from_iso(value)
Parameters:

value (int) – a ITU-T H.273 colour primaries value

Returns:

the matched GstVideo.VideoColorPrimaries

Return type:

GstVideo.VideoColorPrimaries

Converts the value to the GstVideo.VideoColorPrimaries The colour primaries (ColourPrimaries) value is defined by “ISO/IEC 23001-8 Section 7.1 Table 2” and “ITU-T H.273 Table 2”. “H.264 Table E-3” and “H.265 Table E.3” share the identical values.

New in version 1.18.

GstVideo.video_color_primaries_get_info(primaries)
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_primaries_is_equivalent(primaries, other)
Parameters:
Returns:

True if primaries and other can be considered equivalent.

Return type:

bool

Checks whether primaries and other are functionally equivalent

New in version 1.22.

GstVideo.video_color_primaries_to_iso(primaries)
Parameters:

primaries (GstVideo.VideoColorPrimaries) – a GstVideo.VideoColorPrimaries

Returns:

The value of ISO/IEC 23001-8 colour primaries.

Return type:

int

Converts GstVideo.VideoColorPrimaries to the “colour primaries” (ColourPrimaries) value defined by “ISO/IEC 23001-8 Section 7.1 Table 2” and “ITU-T H.273 Table 2”. “H.264 Table E-3” and “H.265 Table E.3” share the identical values.

New in version 1.18.

GstVideo.video_color_range_offsets(range, info)
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)
Parameters:
Return type:

float

New in version 1.6.

Deprecated since version 1.20: Use GstVideo.VideoTransferFunction.decode() instead.

GstVideo.video_color_transfer_encode(func, val)
Parameters:
Return type:

float

New in version 1.6.

Deprecated since version 1.20: Use GstVideo.VideoTransferFunction.encode() instead.

GstVideo.video_convert_sample(sample, to_caps, timeout)
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 or None

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)
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 occurred 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()
Return type:

GObject.GType

GstVideo.video_crop_meta_get_info()
Return type:

Gst.MetaInfo

GstVideo.video_dma_drm_fourcc_from_format(format)
Parameters:

format (GstVideo.VideoFormat) – a GstVideo.VideoFormat

Returns:

the DRM_FORMAT_* corresponding to the format.

Return type:

int

Converting the video format into dma drm fourcc. If no matching fourcc found, then DRM_FORMAT_INVALID is returned.

New in version 1.24.

GstVideo.video_dma_drm_fourcc_from_string(format_str)
Parameters:

format_str (str) – a drm format string

Returns:

The drm fourcc value or DRM_FORMAT_INVALID if format_str is invalid.

modifier:

Return the modifier in format or None to ignore.

Return type:

(int, modifier: int)

Convert the format_str string into the drm fourcc value. The modifier is also parsed if we want. Please note that the format_str should follow the fourcc:modifier kind style, such as NV12:0x0100000000000002

New in version 1.24.

GstVideo.video_dma_drm_fourcc_to_format(fourcc)
Parameters:

fourcc (int) – the dma drm value.

Returns:

the GST_VIDEO_FORMAT_* corresponding to the fourcc.

Return type:

GstVideo.VideoFormat

Converting a dma drm fourcc into the video format. If no matching video format found, then GstVideo.VideoFormat.UNKNOWN is returned.

New in version 1.24.

GstVideo.video_dma_drm_fourcc_to_string(fourcc, modifier)
Parameters:
  • fourcc (int) – a drm fourcc value.

  • modifier (int) – the associated modifier value.

Returns:

the drm kind string composed of to fourcc and modifier.

Return type:

str or None

Returns a string containing drm kind format, such as NV12:0x0100000000000002, or None otherwise.

New in version 1.24.

GstVideo.video_event_is_force_key_unit(event)
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)
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)
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)
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)
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)
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)
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)
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)
Parameters:

order (GstVideo.VideoFieldOrder) – a GstVideo.VideoFieldOrder

Returns:

order as a string.

Return type:

str

Convert order to its string representation.

New in version 1.12.

GstVideo.video_format_from_fourcc(fourcc)
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)
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)
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)
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)
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)
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)
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_formats_any()
Returns:

an array of GstVideo.VideoFormat

Return type:

[GstVideo.VideoFormat]

Return all the raw video formats supported by GStreamer including special opaque formats such as GstVideo.VideoFormat.DMA_DRM for which no software conversion exists. This should be use for passthrough template cpas.

New in version 1.24.

GstVideo.video_formats_raw()
Returns:

an array of GstVideo.VideoFormat

Return type:

[GstVideo.VideoFormat]

Return all the raw video formats supported by GStreamer.

New in version 1.18.

GstVideo.video_frame_map(info, buffer, flags)
Parameters:
Returns:

True on success.

frame:

pointer to GstVideo.VideoFrame

Return type:

(bool, frame: GstVideo.VideoFrame)

Use info and buffer to fill in the values of frame. frame is usually allocated on the stack, and you will pass the address to the GstVideo.VideoFrame structure allocated on the stack; GstVideo.VideoFrame.map() will then fill in the structures with the various video-specific information you need to access the pixels of the video buffer. You can then use accessor macros such as GST_VIDEO_FRAME_COMP_DATA(), GST_VIDEO_FRAME_PLANE_DATA(), GST_VIDEO_FRAME_COMP_STRIDE(), GST_VIDEO_FRAME_PLANE_STRIDE() etc. to get to the pixels.

GstVideoFrame vframe;
...
// set RGB pixels to black one at a time
if (gst_video_frame_map (&vframe, video_info, video_buffer, GST_MAP_WRITE)) {
  guint8 *pixels = GST_VIDEO_FRAME_PLANE_DATA (vframe, 0);
  guint stride = GST_VIDEO_FRAME_PLANE_STRIDE (vframe, 0);
  guint pixel_stride = GST_VIDEO_FRAME_COMP_PSTRIDE (vframe, 0);

  for (h = 0; h < height; ++h) {
    for (w = 0; w < width; ++w) {
      guint8 *pixel = pixels + h * stride + w * pixel_stride;

      memset (pixel, 0, pixel_stride);
    }
  }

  gst_video_frame_unmap (&vframe);
}
...

All video planes of buffer will be mapped and the pointers will be set in frame->data.

The purpose of this function is to make it easy for you to get to the video pixels in a generic way, without you having to worry too much about details such as whether the video data is allocated in one contiguous memory chunk or multiple memory chunks (e.g. one for each plane); or if custom strides and custom plane offsets are used or not (as signalled by GstVideo.VideoMeta on each buffer). This function will just fill the GstVideo.VideoFrame structure with the right values and if you use the accessor macros everything will just work and you can access the data easily. It also maps the underlying memory chunks for you.

GstVideo.video_frame_map_id(info, buffer, id, flags)
Parameters:
Returns:

True on success.

frame:

pointer to GstVideo.VideoFrame

Return type:

(bool, frame: GstVideo.VideoFrame)

Use info and buffer to fill in the values of frame with the video frame information of frame id.

When id is -1, the default frame is mapped. When id != -1, this function will return False when there is no GstVideo.VideoMeta with that id.

All video planes of buffer will be mapped and the pointers will be set in frame->data.

GstVideo.video_gl_texture_upload_meta_api_get_type()
Return type:

GObject.GType

GstVideo.video_gl_texture_upload_meta_get_info()
Return type:

Gst.MetaInfo

GstVideo.video_guess_framerate(duration)
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_info_dma_drm_from_caps(caps)
Parameters:

caps (Gst.Caps) – a Gst.Caps

Returns:

True if caps could be parsed

drm_info:

GstVideo.VideoInfoDmaDrm

Return type:

(bool, drm_info: GstVideo.VideoInfoDmaDrm)

Parse caps and update info. Please note that the caps should be a dma drm caps. The GstVideo.video_is_dma_drm_caps() can be used to verify it before calling this function.

New in version 1.24.

GstVideo.video_info_dma_drm_from_video_info(info, modifier)
Parameters:
Returns:

True if drm_info is filled correctly.

drm_info:

GstVideo.VideoInfoDmaDrm

Return type:

(bool, drm_info: GstVideo.VideoInfoDmaDrm)

Fills drm_info if info's format has a valid drm format and modifier is also valid

New in version 1.24.

GstVideo.video_info_dma_drm_init()
Returns:

a GstVideo.VideoInfoDmaDrm

Return type:

drm_info: GstVideo.VideoInfoDmaDrm

Initialize drm_info with default values.

New in version 1.24.

GstVideo.video_info_from_caps(caps)
Parameters:

caps (Gst.Caps) – a Gst.Caps

Returns:

True if caps could be parsed

info:

GstVideo.VideoInfo

Return type:

(bool, info: GstVideo.VideoInfo)

Parse caps and update info.

GstVideo.video_info_init()
Returns:

a GstVideo.VideoInfo

Return type:

info: GstVideo.VideoInfo

Initialize info with default values.

GstVideo.video_interlace_mode_from_string(mode)
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)
Parameters:

mode (GstVideo.VideoInterlaceMode) – a GstVideo.VideoInterlaceMode

Returns:

mode as a string.

Return type:

str

Convert mode to its string representation.

New in version 1.6.

GstVideo.video_is_common_aspect_ratio(width, height, par_n, par_d)
Parameters:
  • width (int) – Width of the video frame

  • height (int) – Height of the video frame

  • par_n (int) – Pixel aspect ratio numerator

  • par_d (int) – Pixel aspect ratio denominator

Returns:

True if a known “standard” aspect ratio was recognised, and False otherwise.

Return type:

bool

Given a frame’s dimensions and pixel aspect ratio, this function will calculate the frame’s aspect ratio and compare it against a set of common well-known “standard” aspect ratios.

New in version 1.22.

GstVideo.video_is_dma_drm_caps(caps)
Parameters:

caps (Gst.Caps) – a Gst.Caps

Returns:

True if the caps is a dma drm caps.

Return type:

bool

Check whether the caps is a dma drm kind caps. Please note that the caps should be fixed.

New in version 1.24.

GstVideo.video_make_raw_caps(formats)
Parameters:

formats ([GstVideo.VideoFormat] or None) – an array of raw GstVideo.VideoFormat, or None

Returns:

a video GstCaps

Return type:

Gst.Caps

Return a generic raw video caps for formats defined in formats. If formats is None returns a caps for all the supported raw video formats, see GstVideo.video_formats_raw().

New in version 1.18.

GstVideo.video_make_raw_caps_with_features(formats, features)
Parameters:
Returns:

a video GstCaps

Return type:

Gst.Caps

Return a generic raw video caps for formats defined in formats with features features. If formats is None returns a caps for all the supported video formats, see GstVideo.video_formats_raw().

New in version 1.18.

GstVideo.video_mastering_display_info_from_string(mastering)
Parameters:

mastering (str) – a Gst.Structure representing GstVideo.VideoMasteringDisplayInfo

Returns:

True if minfo was filled with mastering

minfo:

a GstVideo.VideoMasteringDisplayInfo

Return type:

(bool, minfo: GstVideo.VideoMasteringDisplayInfo)

Extract GstVideo.VideoMasteringDisplayInfo from mastering

New in version 1.18.

GstVideo.video_meta_api_get_type()
Return type:

GObject.GType

GstVideo.video_meta_get_info()
Return type:

Gst.MetaInfo

GstVideo.video_meta_transform_scale_get_quark()
Returns:

a #GQuark

Return type:

int

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

GstVideo.video_multiview_get_doubled_height_modes()
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()
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()
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()
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()
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)
Parameters:
Returns:

A boolean indicating whether the GstVideo.VideoMultiviewFlags.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)
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)
Parameters:

mview_mode (GstVideo.VideoMultiviewMode) – A GstVideo.VideoMultiviewMode value

Returns:

The caps string representation of the mode, or None if invalid.

Return type:

str or None

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

New in version 1.6.

GstVideo.video_multiview_video_info_change_mode(info, out_mview_mode, out_mview_flags)
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_orientation_from_tag(taglist)
Parameters:

taglist (Gst.TagList) – A Gst.TagList

Returns:

True if there was a valid “image-orientation” tag in the taglist.

method:

The location where to return the orientation.

Return type:

(bool, method: GstVideo.VideoOrientationMethod)

Parses the “image-orientation” tag and transforms it into the GstVideo.VideoOrientationMethod enum.

New in version 1.20.

GstVideo.video_overlay_composition_meta_api_get_type()
Return type:

GObject.GType

GstVideo.video_overlay_composition_meta_get_info()
Return type:

Gst.MetaInfo

GstVideo.video_overlay_install_properties(oclass, last_prop_id)
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)
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().

New in version 1.14.

GstVideo.video_region_of_interest_meta_api_get_type()
Return type:

GObject.GType

GstVideo.video_region_of_interest_meta_get_info()
Return type:

Gst.MetaInfo

GstVideo.video_sei_user_data_unregistered_meta_api_get_type()
Returns:

GObject.GType for the GstVideo.VideoSEIUserDataUnregisteredMeta structure.

Return type:

GObject.GType

New in version 1.22.

GstVideo.video_sei_user_data_unregistered_meta_get_info()
Returns:

Gst.MetaInfo pointer that describes GstVideo.VideoSEIUserDataUnregisteredMeta.

Return type:

Gst.MetaInfo

New in version 1.22.

GstVideo.video_sei_user_data_unregistered_parse_precision_time_stamp(user_data)
Parameters:

user_data (GstVideo.VideoSEIUserDataUnregisteredMeta) – a GstVideo.VideoSEIUserDataUnregisteredMeta

Returns:

True if data is a Precision Time Stamp and it was parsed correctly

status:

User Data Unregistered UUID

precision_time_stamp:

The parsed Precision Time Stamp SEI

Return type:

(bool, status: int, precision_time_stamp: int)

Parses and returns the Precision Time Stamp (ST 0604) from the SEI User Data Unregistered buffer

New in version 1.22.

GstVideo.video_tile_get_index(mode, x, y, x_tiles, y_tiles)
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 GstVideo.VideoTileType.INDEXED.

New in version 1.4.

GstVideo.video_time_code_meta_api_get_type()
Return type:

GObject.GType

GstVideo.video_time_code_meta_get_info()
Return type:

Gst.MetaInfo

GstVideo.video_transfer_function_decode(func, val)
Parameters:
Returns:

the gamma decoded value of val

Return type:

float

Convert val to its gamma decoded value. This is the inverse operation of GstVideo.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.20.

GstVideo.video_transfer_function_encode(func, val)
Parameters:
Returns:

the gamma 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.20.

GstVideo.video_transfer_function_from_iso(value)
Parameters:

value (int) – a ITU-T H.273 transfer characteristics value

Returns:

the matched GstVideo.VideoTransferFunction

Return type:

GstVideo.VideoTransferFunction

Converts the value to the GstVideo.VideoTransferFunction The transfer characteristics (TransferCharacteristics) value is defined by “ISO/IEC 23001-8 Section 7.2 Table 3” and “ITU-T H.273 Table 3”. “H.264 Table E-4” and “H.265 Table E.4” share the identical values.

New in version 1.18.

GstVideo.video_transfer_function_is_equivalent(from_func, from_bpp, to_func, to_bpp)
Parameters:
Returns:

True if from_func and to_func can be considered equivalent.

Return type:

bool

Returns whether from_func and to_func are equivalent. There are cases (e.g. BT601, BT709, and BT2020_10) where several functions are functionally identical. In these cases, when doing conversion, we should consider them as equivalent. Also, BT2020_12 is the same as the aforementioned three for less than 12 bits per pixel.

New in version 1.18.

GstVideo.video_transfer_function_to_iso(func)
Parameters:

func (GstVideo.VideoTransferFunction) – a GstVideo.VideoTransferFunction

Returns:

The value of ISO/IEC 23001-8 transfer characteristics.

Return type:

int

Converts GstVideo.VideoTransferFunction to the “transfer characteristics” (TransferCharacteristics) value defined by “ISO/IEC 23001-8 Section 7.2 Table 3” and “ITU-T H.273 Table 3”. “H.264 Table E-4” and “H.265 Table E.4” share the identical values.

New in version 1.18.