video rescaling

Patrick Welche prlw1 at cam.ac.uk
Sun Jun 7 13:34:13 UTC 2020


On Sat, Jun 06, 2020 at 12:54:25PM -0400, Nicolas Dufresne wrote:
> Le sam. 6 juin 2020 11 h 15, Patrick Welche <prlw1 at cam.ac.uk> a écrit :
> 
> > Given a sample video, e.g.,
> > http://techslides.com/demos/sample-videos/small.ogv
> > and following the videoscale documentation,
> >
> > gst-launch-1.0 -e \
> > filesrc location=small.ogv ! decodebin ! video/x-raw ! videoconvert \
> > ! videoscale ! video/x-raw,width=50 ! ximagesink
> >
> > does exactly what one expects. If I channel the output to a file
> >
> > gst-launch-1.0 -e \
> > filesrc location=small.ogv ! decodebin ! video/x-raw ! videoconvert \
> > ! videoscale ! video/x-raw,width=50 ! x264enc ! filesink location=out.mp4
> >
> 
> Unlike ximagesink, x264enc supports non square pixels. As it's zero copy,
> videoscale will prefer scaling the pixel-aspect-ratio field instead.
> 
> Set pixel-aspect-ratio=1/1 in your filter if you want to force scaling.

Thanks! It seems there is more to it though...

>From the videoscale documentation, I had the impression that I
could throw any old height & width in and hope that what came out
was whatever is specified in the filter after the videoscale element,
and if it is ridiculous, I may get a black border (add-borders=true),
but it would still be the desired size.


AFAICT that sample small.ogv is 560x320. If I try            I get

video/x-raw,width=400,height=300,pixel-aspect-ration=1/1    525x300
video/x-raw,height=300,width=400,pixel-aspect-ration=1/1    525x300
video/x-raw,height=300,width=400                            525x300
video/x-raw,height=300                                      525x300

which suggests height wins, and 560*300/320 = 525

If I try

video/x-raw,height=301

I get "Can not initialize x264 encoder"

Does this mean videoscale only scales integer ratios of height, or
is there more to it?


Cheers,

Patrick


More information about the gstreamer-devel mailing list