[FFmpeg-trac] #732(avutil:closed): Storing variables not working in expressions
FFmpeg
trac at avcodec.org
Sat Oct 6 12:05:49 CEST 2012
#732: Storing variables not working in expressions
-------------------------------------+-------------------------------------
Reporter: jworrall | Owner:
Type: enhancement | Status: closed
Priority: normal | Component: avutil
Version: unspecified | Resolution: wontfix
Keywords: expression | Blocked By:
evaluation scale | Reproduced by developer: 0
Blocking: |
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
Changes (by saste):
* keywords: expression evaluation => expression evaluation scale
* resolution: => wontfix
* status: new => closed
* component: undetermined => avutil
Comment:
Replying to [comment:3 jworrall]:
> Oh, well, that explains a lot. It seems the variables would be more
powerful if they could be shared between expressions. For example, I am
trying to write a scale filter that will scale a video of any size and
aspect ratio down (but not up) to fit inside an iPhone display, while
preserving aspect ratio. I've written a script that gets variables for
the display/frame size depending on which iPhone it is (FW, FH and the
aspect ratio FA).
>
> I was eventually able to do it without variables; it looks like this:
> -vf "scale = min(1\,gt(iw\,$FW)+gt(ih\,$FH)) * (gte(a\,$FA)*$FW +
lt(a\,$FA)*(($FH*iw)/ih)) + not(min(1\,gt(iw\,$FW)+gt(ih\,$FH)))*iw : \
> min(1\,gt(iw\,$FW)+gt(ih\,$FH)) * (lte(a\,$FA)*$FH +
gt(a\,$FA)*(($FW*ih)/iw)) + not(min(1\,gt(iw\,$FW)+gt(ih\,$FH)))*ih" \
>
> If the variables were preserved between the width and height
expressions, it would be somewhat shorter and easier to follow:
> -vf "scale = st(0\,min(1\,gt(iw\,$FW)+gt(ih\,$FH) ) ) * (gte(a\,$FA)*$FW
+ lt(a\,$FA)*(($FH*iw)/ih) ) + not(ld(0))*iw : \
> ld(0) * ( lte(a\,$FA)*$FH + gt(a\,$FA)*(($FW*ih)/iw) ) + not(ld(0))*ih "
\
>
> Maybe it's not that important, but I'm sure more 'global' variables
would have other uses as well. In any case, unless and until such a
feature is developed, it would be good to put in the manual that the
variables are not preserved between expressions. Might save someone else
several days of tearing their hair out! Thanks
Global variables would require a serious overhaul of the eval system
(since you may need to pass the environment from one expression to
another), and would have several possible unwanted side effects. I think
the best way to achieve what you want is through external scripting, this
would also simplify the logic and improve readability.
So I'm closing this feature request as WONTFIX.
--
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/732#comment:5>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list