video rescaling

Nicolas Dufresne nicolas at ndufresne.ca
Sun Jun 7 20:07:19 UTC 2020


Le dimanche 07 juin 2020 à 14:34 +0100, Patrick Welche a écrit :
> 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?

No, it means x264enc does not support off height. We could wake this
limitation in software, it's just not implemented.

> 
> 
> Cheers,
> 
> Patrick
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



More information about the gstreamer-devel mailing list