Skip to content

GStreamer element to resize a video and keep its aspect ratio

License

Notifications You must be signed in to change notification settings

aler9/gst-videoscale-ratio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gst-videoscale-ratio

This is a GStreamer filter that allows to resize a video and keep its aspect ratio.

This pipeline will produce a 1920x1080 video:

gst-launch-1.0 \
videotestsrc ! video/x-raw,width=1280,height=720 \
! videoscaleratio height=1080 \
! xvimagesink

A pipeline with the native videoscale needs to know in advantage the size of the output video, that is either fixed or inherited from the input video. For instance, this will produce a 1280x1080 video, with the wrong aspect ratio:

gst-launch-1.0 \
videotestsrc ! video/x-raw,width=1280,height=720 \
! videoscale \
! "video/x-raw,height=1080" \
! xvimagesink

Installation

Install build dependencies:

sudo apt install -y --no-install-recommends \
gcc \
meson \
libgstreamer-plugins-base1.0-dev

Compile and install:

meson --prefix=/usr build \
&& cd build \
&& ninja \
&& sudo ninja install

Usage

Use the filter videoscaleratio and set the width parameter or the height parameter with the desired width or height; the other size will be set automatically.

About

GStreamer element to resize a video and keep its aspect ratio

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published