[FFmpeg-devel] [PATCH] fftools/ffmpeg_filter: use -reinit_filter to disable/enable auto scale

Li, Zhong zhong.li at intel.com
Fri Jul 12 08:53:34 EEST 2019


> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces at ffmpeg.org] On Behalf
> Of Fu, Linjie
> Sent: Friday, July 12, 2019 1:36 PM
> To: FFmpeg development discussions and patches
> <ffmpeg-devel at ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH] fftools/ffmpeg_filter: use -reinit_filter
> to disable/enable auto scale
> 
> > -----Original Message-----
> > From: ffmpeg-devel [mailto:ffmpeg-devel-bounces at ffmpeg.org] On
> Behalf
> > Of mypopy at gmail.com
> > Sent: Friday, July 12, 2019 13:28
> > To: FFmpeg development discussions and patches <ffmpeg-
> > devel at ffmpeg.org>
> > Cc: Fu, Linjie <linjie.fu at intel.com>
> > Subject: Re: [FFmpeg-devel] [PATCH] fftools/ffmpeg_filter: use
> > -reinit_filter to disable/enable auto scale
> >
> > On Fri, Jul 12, 2019 at 1:19 PM Linjie Fu <linjie.fu at intel.com> wrote:
> > >
> > > Currently, ffmpeg inserts scale filter in the filter graph to force
> > > the whole decoded stream to scale into the same size with the first
> > > frame. It's not quite make sense in resolution changing cases if
> > > user wants the rawvideo without any scale.
> > >
> > > Option -reinit_filter 0 could be used to realize similar function,
> > > but it fails when ifilter has hw_frame_ctx.
> > >
> > > Add auto_scale flag set by -reinit_filter to indicate whether auto
> > > inserting the scale filter in the filter graph.
> > >
> > > Signed-off-by: Linjie Fu <linjie.fu at intel.com>
> > > ---
> > > Request for comments.
> > > As we have discussed in the rawdump filter patch, here is a simpler
> > > solution based on -reinit_filter, and reuse this option.(maybe it's
> > > not easy to be accepted to add a separate option)
> > >
> > >  fftools/ffmpeg.c        | 2 +-
> > >  fftools/ffmpeg.h        | 1 +
> > >  fftools/ffmpeg_filter.c | 2 +-
> > >  3 files changed, 3 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index
> > > 01f04103cf..5305b87bd4 100644
> > > --- a/fftools/ffmpeg.c
> > > +++ b/fftools/ffmpeg.c
> > > @@ -2133,6 +2133,7 @@ static int ifilter_send_frame(InputFilter
> > > *ifilter,
> > AVFrame *frame)
> > >
> > >      /* determine if the parameters for this input changed */
> > >      need_reinit = ifilter->format != frame->format;
> > > +    fg->auto_scale = ifilter->ist->reinit_filters;
> > >
> > >      switch (ifilter->ist->st->codecpar->codec_type) {
> > >      case AVMEDIA_TYPE_AUDIO:
> > > @@ -2145,7 +2146,6 @@ static int ifilter_send_frame(InputFilter
> > > *ifilter,
> > AVFrame *frame)
> > >                         ifilter->height != frame->height;
> > >          break;
> > >      }
> > > -
> > Unrelated change
> 
> Yep, this should be recalled.
> 
> > >
> > Add an option to disable/enable "auto insert" is Ok for me, but I
> > think if you reuse the -reinit_filter option, you need to update doc
> > part at the same time.
> 
> I prefer to add a separate option, too.
> Depending on the comments, I'll either update doc for reinit_filter, or add a
> new option and related doc.

Since there is an existed option named "autorotate", add an new option "autoscale" looks can keep tune. 


More information about the ffmpeg-devel mailing list