# GstVideo

This library contains some helper functions and includes the videosink and videofilter base classes.

## GstVideoAlignment

Extra alignment parameters for the memory of video buffers. This structure is usually used to configure the bufferpool if it supports the GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT.

### Members

`padding_top` (guint) –

extra pixels on the top

`padding_bottom` (guint) –

extra pixels on the bottom

`padding_left` (guint) –

extra pixels on the left side

`padding_right` (guint) –

extra pixels on the right side

`stride_align` (guint *) –

array with extra alignment requirements for the strides

## GstVideo.VideoAlignment

Extra alignment parameters for the memory of video buffers. This structure is usually used to configure the bufferpool if it supports the GstVideo.BUFFER_POOL_OPTION_VIDEO_ALIGNMENT.

### Members

`padding_top` (Number) –

extra pixels on the top

`padding_bottom` (Number) –

extra pixels on the bottom

`padding_left` (Number) –

extra pixels on the left side

`padding_right` (Number) –

extra pixels on the right side

`stride_align` ([ Number ]) –

array with extra alignment requirements for the strides

## GstVideo.VideoAlignment

Extra alignment parameters for the memory of video buffers. This structure is usually used to configure the bufferpool if it supports the GstVideo.BUFFER_POOL_OPTION_VIDEO_ALIGNMENT.

### Members

`padding_top` (int) –

extra pixels on the top

`padding_bottom` (int) –

extra pixels on the bottom

`padding_left` (int) –

extra pixels on the left side

`padding_right` (int) –

extra pixels on the right side

`stride_align` ([ int ]) –

array with extra alignment requirements for the strides

### Methods

#### gst_video_alignment_reset

    gst_video_alignment_reset (GstVideoAlignment * align)

Set align to its default values with no padding and no alignment.

Parameters:

`align` –

a GstVideoAlignment

#### GstVideo.VideoAlignment.prototype.reset

    function GstVideo.VideoAlignment.prototype.reset(): {
        // javascript wrapper for 'gst_video_alignment_reset'
    }

Set align to its default values with no padding and no alignment.

Parameters:

`align` (GstVideo.VideoAlignment) –

a GstVideo.VideoAlignment

#### GstVideo.VideoAlignment.reset

    def GstVideo.VideoAlignment.reset (self):
        #python wrapper for 'gst_video_alignment_reset'

Set align to its default values with no padding and no alignment.

Parameters:

`align` (GstVideo.VideoAlignment) –

a GstVideo.VideoAlignment

## GstVideoRectangle

Helper structure representing a rectangular area.

### Members

`x` (gint) –

X coordinate of rectangle's top-left point

`y` (gint) –

Y coordinate of rectangle's top-left point

`w` (gint) –

width of the rectangle

`h` (gint) –

height of the rectangle

## GstVideo.VideoRectangle

Helper structure representing a rectangular area.

### Members

`x` (Number) –

X coordinate of rectangle's top-left point

`y` (Number) –

Y coordinate of rectangle's top-left point

`w` (Number) –

width of the rectangle

`h` (Number) –

height of the rectangle

## GstVideo.VideoRectangle

Helper structure representing a rectangular area.

### Members

`x` (int) –

X coordinate of rectangle's top-left point

`y` (int) –

Y coordinate of rectangle's top-left point

`w` (int) –

width of the rectangle

`h` (int) –

height of the rectangle

## Functions

### gst_video_calculate_display_ratio

    gboolean
    gst_video_calculate_display_ratio (guint * dar_n,
                                       guint * dar_d,
                                       guint video_width,
                                       guint video_height,
                                       guint video_par_n,
                                       guint video_par_d,
                                       guint display_par_n,
                                       guint display_par_d)

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.

Parameters:

`dar_n` ( [out]) –

Numerator of the calculated display_ratio

`dar_d` ( [out]) –

Denominator of the calculated display_ratio

`video_width` –

Width of the video frame in pixels

`video_height` –

Height of the video frame in pixels

`video_par_n` –

Numerator of the pixel aspect ratio of the input video.

`video_par_d` –

Denominator of the pixel aspect ratio of the input video.

`display_par_n` –

Numerator of the pixel aspect ratio of the display device

`display_par_d` –

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.

### GstVideo.prototype.video_calculate_display_ratio

    function GstVideo.prototype.video_calculate_display_ratio(video_width: Number, video_height: Number, video_par_n: Number, video_par_d: Number, display_par_n: Number, display_par_d: Number): {
        // javascript wrapper for 'gst_video_calculate_display_ratio'
    }

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.

Parameters:

`video_width` (Number) –

Width of the video frame in pixels

`video_height` (Number) –

Height of the video frame in pixels

`video_par_n` (Number) –

Numerator of the pixel aspect ratio of the input video.

`video_par_d` (Number) –

Denominator of the pixel aspect ratio of the input video.

`display_par_n` (Number) –

Numerator of the pixel aspect ratio of the display device

`display_par_d` (Number) –

Denominator of the pixel aspect ratio of the display device

Returns a tuple made of:

(Number ) –

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` (Number ) –

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_d` (Number ) –

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.

### GstVideo.video_calculate_display_ratio

    def GstVideo.video_calculate_display_ratio (video_width, video_height, video_par_n, video_par_d, display_par_n, display_par_d):
        #python wrapper for 'gst_video_calculate_display_ratio'

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.

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 tuple made of:

(bool ) –

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` (int ) –

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_d` (int ) –

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.

### gst_video_guess_framerate

    gboolean
    gst_video_guess_framerate (GstClockTime duration,
                               gint * dest_n,
                               gint * dest_d)

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.

Parameters:

`duration` –

Nominal duration of one frame

`dest_n` ( [out][allow-none]) –

Numerator of the calculated framerate

`dest_d` ( [out][allow-none]) –

Denominator of the calculated framerate

Returns –

TRUE if a close "standard" framerate was recognised, and FALSE otherwise.

Since : 1.6

### GstVideo.prototype.video_guess_framerate

    function GstVideo.prototype.video_guess_framerate(duration: Number): {
        // javascript wrapper for 'gst_video_guess_framerate'
    }

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.

Parameters:

`duration` (Number) –

Nominal duration of one frame

Returns a tuple made of:

(Number ) –

true if a close "standard" framerate was recognised, and false otherwise.

`dest_n` (Number ) –

true if a close "standard" framerate was recognised, and false otherwise.

`dest_d` (Number ) –

true if a close "standard" framerate was recognised, and false otherwise.

Since : 1.6

### GstVideo.video_guess_framerate

    def GstVideo.video_guess_framerate (duration):
        #python wrapper for 'gst_video_guess_framerate'

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.

Parameters:

`duration` (int) –

Nominal duration of one frame

Returns a tuple made of:

(bool ) –

True if a close "standard" framerate was recognised, and False otherwise.

`dest_n` (int ) –

True if a close "standard" framerate was recognised, and False otherwise.

`dest_d` (int ) –

True if a close "standard" framerate was recognised, and False otherwise.

Since : 1.6

### gst_video_is_common_aspect_ratio

    gboolean
    gst_video_is_common_aspect_ratio (gint width,
                                      gint height,
                                      gint par_n,
                                      gint par_d)

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.

Parameters:

`width` –

Width of the video frame

`height` –

Height of the video frame

`par_n` –

Pixel aspect ratio numerator

`par_d` –

Pixel aspect ratio denominator

Returns –

TRUE if a known "standard" aspect ratio was recognised, and FALSE otherwise.

Since : 1.22

### GstVideo.prototype.video_is_common_aspect_ratio

    function GstVideo.prototype.video_is_common_aspect_ratio(width: Number, height: Number, par_n: Number, par_d: Number): {
        // javascript wrapper for 'gst_video_is_common_aspect_ratio'
    }

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.

Parameters:

`width` (Number) –

Width of the video frame

`height` (Number) –

Height of the video frame

`par_n` (Number) –

Pixel aspect ratio numerator

`par_d` (Number) –

Pixel aspect ratio denominator

Returns (Number) –

true if a known "standard" aspect ratio was recognised, and false otherwise.

Since : 1.22

### GstVideo.video_is_common_aspect_ratio

    def GstVideo.video_is_common_aspect_ratio (width, height, par_n, par_d):
        #python wrapper for 'gst_video_is_common_aspect_ratio'

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.

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 (bool) –

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

Since : 1.22

## Enumerations

### GstVideoOrientationMethod

The different video orientation methods.

##### Members

`GST_VIDEO_ORIENTATION_IDENTITY` (0) –

Identity (no rotation)

`GST_VIDEO_ORIENTATION_90R` (1) –

Rotate clockwise 90 degrees

`GST_VIDEO_ORIENTATION_180` (2) –

Rotate 180 degrees

`GST_VIDEO_ORIENTATION_90L` (3) –

Rotate counter-clockwise 90 degrees

`GST_VIDEO_ORIENTATION_HORIZ` (4) –

Flip horizontally

`GST_VIDEO_ORIENTATION_VERT` (5) –

Flip vertically

`GST_VIDEO_ORIENTATION_UL_LR` (6) –

Rotate counter-clockwise 90 degrees and flip vertically

`GST_VIDEO_ORIENTATION_UR_LL` (7) –

Rotate clockwise 90 degrees and flip vertically

`GST_VIDEO_ORIENTATION_AUTO` (8) –

Select flip method based on image-orientation tag

`GST_VIDEO_ORIENTATION_CUSTOM` (9) –

Current status depends on plugin internal setup

Since : 1.10

### GstVideo.VideoOrientationMethod

The different video orientation methods.

##### Members

`GstVideo.VideoOrientationMethod.IDENTITY` (0) –

Identity (no rotation)

`GstVideo.VideoOrientationMethod.90R` (1) –

Rotate clockwise 90 degrees

`GstVideo.VideoOrientationMethod.180` (2) –

Rotate 180 degrees

`GstVideo.VideoOrientationMethod.90L` (3) –

Rotate counter-clockwise 90 degrees

`GstVideo.VideoOrientationMethod.HORIZ` (4) –

Flip horizontally

`GstVideo.VideoOrientationMethod.VERT` (5) –

Flip vertically

`GstVideo.VideoOrientationMethod.UL_LR` (6) –

Rotate counter-clockwise 90 degrees and flip vertically

`GstVideo.VideoOrientationMethod.UR_LL` (7) –

Rotate clockwise 90 degrees and flip vertically

`GstVideo.VideoOrientationMethod.AUTO` (8) –

Select flip method based on image-orientation tag

`GstVideo.VideoOrientationMethod.CUSTOM` (9) –

Current status depends on plugin internal setup

Since : 1.10

### GstVideo.VideoOrientationMethod

The different video orientation methods.

##### Members

`GstVideo.VideoOrientationMethod.IDENTITY` (0) –

Identity (no rotation)

`GstVideo.VideoOrientationMethod.90R` (1) –

Rotate clockwise 90 degrees

`GstVideo.VideoOrientationMethod.180` (2) –

Rotate 180 degrees

`GstVideo.VideoOrientationMethod.90L` (3) –

Rotate counter-clockwise 90 degrees

`GstVideo.VideoOrientationMethod.HORIZ` (4) –

Flip horizontally

`GstVideo.VideoOrientationMethod.VERT` (5) –

Flip vertically

`GstVideo.VideoOrientationMethod.UL_LR` (6) –

Rotate counter-clockwise 90 degrees and flip vertically

`GstVideo.VideoOrientationMethod.UR_LL` (7) –

Rotate clockwise 90 degrees and flip vertically

`GstVideo.VideoOrientationMethod.AUTO` (8) –

Select flip method based on image-orientation tag

`GstVideo.VideoOrientationMethod.CUSTOM` (9) –

Current status depends on plugin internal setup

Since : 1.10

## Constants

### GST_META_TAG_VIDEO_COLORSPACE_STR

    #define GST_META_TAG_VIDEO_COLORSPACE_STR "colorspace"

This metadata stays relevant as long as video colorspace is unchanged.

Since : 1.2

### GstVideo.META_TAG_VIDEO_COLORSPACE_STR

This metadata stays relevant as long as video colorspace is unchanged.

Since : 1.2

### GstVideo.META_TAG_VIDEO_COLORSPACE_STR

This metadata stays relevant as long as video colorspace is unchanged.

Since : 1.2

### GST_META_TAG_VIDEO_ORIENTATION_STR

    #define GST_META_TAG_VIDEO_ORIENTATION_STR "orientation"

This metadata stays relevant as long as video orientation is unchanged.

Since : 1.2

### GstVideo.META_TAG_VIDEO_ORIENTATION_STR

This metadata stays relevant as long as video orientation is unchanged.

Since : 1.2

### GstVideo.META_TAG_VIDEO_ORIENTATION_STR

This metadata stays relevant as long as video orientation is unchanged.

Since : 1.2

### GST_META_TAG_VIDEO_SIZE_STR

    #define GST_META_TAG_VIDEO_SIZE_STR "size"

This metadata stays relevant as long as video size is unchanged.

Since : 1.2

### GstVideo.META_TAG_VIDEO_SIZE_STR

This metadata stays relevant as long as video size is unchanged.

Since : 1.2

### GstVideo.META_TAG_VIDEO_SIZE_STR

This metadata stays relevant as long as video size is unchanged.

Since : 1.2

### GST_META_TAG_VIDEO_STR

    #define GST_META_TAG_VIDEO_STR "video"

This metadata is relevant for video streams.

Since : 1.2

### GstVideo.META_TAG_VIDEO_STR

This metadata is relevant for video streams.

Since : 1.2

### GstVideo.META_TAG_VIDEO_STR

This metadata is relevant for video streams.

Since : 1.2

## Callbacks

### GstVideoConvertSampleCallback

    (*GstVideoConvertSampleCallback) (GstSample * sample,
                                      GError * error,
                                      gpointer user_data)

Parameters:

`sample` –
No description available
`error` –
No description available
`user_data` –
No description available

### GstVideo.VideoConvertSampleCallback

    function GstVideo.VideoConvertSampleCallback(sample: Gst.Sample, error: GError (not introspectable), user_data: Object): {
        // javascript wrapper for 'GstVideoConvertSampleCallback'
    }

Parameters:

`sample` (Gst.Sample) –
No description available
`error` (GError (not introspectable)) –
No description available
`user_data` (Object) –
No description available

### GstVideo.VideoConvertSampleCallback

    def GstVideo.VideoConvertSampleCallback (sample, error, *user_data):
        #python wrapper for 'GstVideoConvertSampleCallback'

Parameters:

`sample` (Gst.Sample) –
No description available
`error` (GError (not introspectable)) –
No description available
`user_data` (variadic) –
No description available

The results of the search are