fixed-aspect video scaling?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

fixed-aspect video scaling?

Dan Taylor-2
I want to scale video to a fixed height, while keeping the image proportions.
 
I do not see this capability in videoscale.  If I set only one property, it is the only one scaled,
and the property ranges do not have the "overloaded" values of the scaling in mplayer.
 
I can either do the "overload", or something I think is cleaner, which is add another property,
(default to "off", to preserve the current behavior), called somthing like "aspect" (suggestions
welcome).  This property would enforce proportional scaling, within the limitations of the
scaling algorithms.
 
There is the question of priority (horizontal or vertical) when aspect is preserved, but I think
that could be handled by using a "best-fit".  Neither result should exceed the "to" size,
of course, and whichever dimension loses more, proportionally, would be given priority.  For
example, if width would lose 10% if proportionally scaled to height, while height would lose
8% if scaled proportionally to width, the the image would be scaled to width.  Some of us
might need more control than that, so "aspect" could be multi-valued, such as "off", "on"
(best-fit), "x" (or "width"), and "y" (or "height").
 

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: fixed-aspect video scaling?

michael smith-6-3
On Tue, Nov 11, 2008 at 7:28 PM, Dan Taylor <[hidden email]> wrote:
> I want to scale video to a fixed height, while keeping the image
> proportions.
>
> I do not see this capability in videoscale.  If I set only one property, it
> is the only one scaled,
> and the property ranges do not have the "overloaded" values of the scaling
> in mplayer.

Yes, right now, the application has to calculate the image dimensions
itself if it wants to scale like this (which isn't all that complex,
but it's obviously easier to have this happen automatically).

Adding a force-aspect-ratio property (like some of the video sinks
have) would probably be reasonable to do.

Mike

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: fixed-aspect video scaling?

Dan Taylor-2


> -----Original Message-----
> From: Michael Smith [mailto:[hidden email]]
> Sent: Wednesday, November 12, 2008 10:16 AM
> To: Discussion of the development of GStreamer
> Subject: Re: [gst-devel] fixed-aspect video scaling?
>
> On Tue, Nov 11, 2008 at 7:28 PM, Dan Taylor <[hidden email]>
wrote:
> > I want to scale video to a fixed height, while keeping the image
> > proportions.
> >
> > I do not see this capability in videoscale.  If I set only one
property,

> it
> > is the only one scaled,
> > and the property ranges do not have the "overloaded" values of the
> scaling
> > in mplayer.
>
> Yes, right now, the application has to calculate the image dimensions
> itself if it wants to scale like this (which isn't all that complex,
> but it's obviously easier to have this happen automatically).
>
> Adding a force-aspect-ratio property (like some of the video sinks
> have) would probably be reasonable to do.
>
> Mike

I hadn't tripped over the force-aspect-ratio properties of the other
video sinks.  I've added this property to the fbdevsink, rather than
making a redundant (for those sinks) change to the scaling engine.

While I was in the fbdevsink, I made a lot of other changes to it that
make it easier to embed.  I've added properties for a "box" in which
the video is displayed, controls for whether, or not, to center, and
in which axes, and controls for whether to fit in x, y, or both.  In
addition, if centering an image larger than the buffer/box in x or y,
the center portion of the image is displayed, and I use a table to
drive the copy, so the several multiplies in the render routine are
moved to a routine that only runs at setup/property change time.

I left the default behavior as is, such that if none of the new
properties are set, it displays exactly as the original.

It isn't cleaned up enough to generate a patch, just yet.  When it is,
I will submit it and hope someone else finds it useful.

Thanks for info about the force-aspect-ratio in the other sinks.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel