[FFmpeg-devel] [PATCH 4/4] Make the crop filter accept parametric expressions.

Stefano Sabatini stefano.sabatini-lala
Fri Sep 10 09:50:14 CEST 2010


On date Thursday 2010-09-09 15:29:20 +0200, Michael Niedermayer encoded:
> On Thu, Sep 09, 2010 at 12:06:16PM +0200, Stefano Sabatini wrote:
> > On date Thursday 2010-09-09 01:11:42 +0200, Stefano Sabatini encoded:
> > > On date Wednesday 2010-09-08 15:56:27 +0200, Michael Niedermayer encoded:
> > > > On Thu, Jul 22, 2010 at 07:52:35PM +0200, Stefano Sabatini wrote:
> > > [...]
> > > > > diff --git a/libavfilter/vf_crop.c b/libavfilter/vf_crop.c
> > > > > index 6a7ae70..df9b5a2 100644
> > > > > --- a/libavfilter/vf_crop.c
> > > > > +++ b/libavfilter/vf_crop.c
> > > > > @@ -24,7 +24,31 @@
> > > > >   */
> > > > >  
> > > > >  #include "avfilter.h"
> > > > > +#include "libavutil/eval.h"
> > > > >  #include "libavutil/pixdesc.h"
> > > > > +#include "libavutil/avstring.h"
> > > > > +
> > > > > +static const char *var_names[] = {
> > > > > +    "E",
> > > > > +    "PHI",
> > > > > +    "PI",
> > > > > +    "x",
> > > > > +    "y",
> > > > > +    "w",      ///< width  of the input video
> > > > > +    "h",      ///< height of the input video
> > > > 
> > > > t for timestamp in seconds
> > > > f for frame number
> > > 
> > > This will be only possible for x and y, as w and h cannot (yet) be
> > > dynamically changed.
> > 
> > Another idea would be to implement a separate cropeval filter in the
> 
> no
> 
> 
> > same file partly sharing the crop code, and perform x/y evaluation and
> > validity checks in start_frame() (this to avoid to slow down the crop
> > filter, which currently does just one evaluation during the
> > configuration stage).
> 
> mplayer has a filter that does a eval per pixel so i dont think one per
> frame will kill you

Done like this.
 
> 
> > 
> > In the same way we could also add a cropfile filter which takes the
> > crop values to be applied from a file, that would be useful for a
> 
> allow eval to read from a file, more generic more flexible and more usefull

I need to think more about how to implement this.

Patch updated.
-- 
FFmpeg = Faithless and Free Mysterious Proud Eccentric Generator



More information about the ffmpeg-devel mailing list