[FFmpeg-devel] [PATCH] ffmpeg: redesign video resampling in case of mid-stream video size/format change
Stefano Sabatini
stefano.sabatini-lala at poste.it
Thu Apr 28 00:55:55 CEST 2011
On date Wednesday 2011-04-27 20:36:02 +0200, Michael Niedermayer encoded:
> On Wed, Apr 27, 2011 at 10:51:54AM +0200, Stefano Sabatini wrote:
> > On date Wednesday 2011-04-27 03:12:53 +0200, Michael Niedermayer encoded:
> > > On Wed, Apr 27, 2011 at 02:34:55AM +0200, Stefano Sabatini wrote:
> [...]
> > > > The proper fix consists in dynamic mid-stream reconfiguration, which
> > > > should fix the problem also for ffplay (which now crashes/misbehaves
> > > > in that case). The nice thing with the video resampling context is
> > > > that it can be applied to ffplay as well, and fixes the problem at the
> > > > application level while a framework solution is developed (and fixes
> > > > some of the issues with the non-libavfilter path).
> > >
> >
> > > what is your oppinion of moving the format/size "equalization" into
> > > a seperate filter? (that could be placed after vsrc_buffer like any
> > > other filter, and would
> > > pass frames through unchanged when they match the output)
> >
> > This would be acceptable (and could be applied also to "fix" the movie
> > souuce and the ffplay input).
>
> great
On the other hand I'm already satisfied with the VideoResampleContext
solution which is also already implemented (and could be used in
ffplay.c as well), now that I think at it even the equalizer filter
would be underkill (sure it could update the performed scaling
according to the size of the input picref, but this wouldn't be
reflected in the link properties, thus resulting intrinsically broken
by design, even if somehow working). So please let's move and let's
try to fix things properly.
> [...]
> > > > > I dont understand how your solution that stores the resampling with
> > > > > input streams can work without the av_vsrc_buffer_add_frame2()
> > > > > when there are more output streams than input streams.
> > > > > The first output might want 100x100 the second 400x400, theres only
> > > > > one context so it can only scale to one.
> > > >
> > > > Rescaling for the output streams is done in the libavfilter chain (a
> > > > scale filter is added to the end of the filterchain, one for each
> > > > output video stream), the rescale/reformat context is used only to
> > > > normalize the input video.
> > >
> > > This means scaling videos twice if i understand it correctly
> >
> > Not different from the current solution.
>
> The current should not scale twice
But it did, vsrc_buffer.c is now normalizing to the initial input
format/size, while the scale filter is put at the end of the output
stream filterchain. Not that this matters so much for most cases (no
mid-stream re-configuration), for which the scaling happens only once.
--
FFmpeg = Funny Frightening Merciful Philosophical Extroverse Gadget
More information about the ffmpeg-devel
mailing list