[FFmpeg-devel] [RFC] preserving original aspect ratio when scaling

Howard Chu hyc
Wed Jul 7 05:34:05 CEST 2010


Stefano Sabatini wrote:
> On date Tuesday 2010-07-06 08:54:57 -0700, Howard Chu encoded:
>> Stefano Sabatini wrote:
>>> On date Sunday 2010-07-04 15:16:47 -0700, Howard Chu encoded:
>>>> Along the lines of video geometry, I've been wanting to add an
>>>> option to automatically rescale while preserving aspect ratio.
>>>> Unless I missed something obvious, it doesn't appear like there's a
>>>> simple option for this at present.
>>>>
>>>> E.g., I want to rescale arbitrary videos to fit on the 480x320
>>>> display of my phone. If I only specify the frame size, then videos
>>>> are stretched/distorted to fit that size, losing the aspect ratio. I
>>>> think I can force the aspect ratio so this doesn't happen, but that
>>>> requires that I know the aspect ratio of the input in advance.
>>>>
>>>> If I have a 4:3 512x384 video, I want it dropped down to e.g.
>>>> 432x320. (Or something...) 16:9 512x288 ->   480x272. Something that's
>>>> already small enough should pass thru unchanged, e.g. 416x224. So
>>>> some kind of "shrink if needed" or "shrink to fit" option. Any
>>>> suggestions on what to call this option?
>>>
>>> This can be achieved making parametric the values for the scale and
>>> pad filters.
>>>
>>> This should be rather simple to implement (and there is already a
>>> patch for the scale filter), patches for that are welcome.
>>
>> Can you point me to the scale filter patch you're talking about?
>
> http://thread.gmane.org/gmane.comp.video.ffmpeg.devel/109707

Thanks. I'm not sure that this parametric scaling patch makes this much 
easier. I quickly hacked this together. It's pretty certain this is the wrong 
approach, but it does what I want.

Mainly this lets me feed arbitrary input into a single ffserver stream, 
instead of having to worry about what aspect ratio and frame rate was being 
used in the input and matching it up to one of several ffserver stream configs.

-- 
   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: dif.txt
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100706/246bc143/attachment.txt>



More information about the ffmpeg-devel mailing list