[FFmpeg-devel] [PATCH] avoid crashes if input stream size changes without using -r

Reimar Döffinger Reimar.Doeffinger
Mon Jul 6 11:45:21 CEST 2009

On Mon, Jul 06, 2009 at 10:28:38AM +0100, M?ns Rullg?rd wrote:
> Reimar D?ffinger <Reimar.Doeffinger at gmx.de> writes:
> > On Mon, Jul 06, 2009 at 05:30:56AM +0200, Michael Niedermayer wrote:
> >> On Sun, Jul 05, 2009 at 01:45:45PM +0200, Reimar D?ffinger wrote:
> >> > I don't know why, but currently FFmpeg only checks for an input stream
> >> > size change when it is using resizing.
> >> 
> >> id guess, the idea might have been to allow size changes on the encoder
> >> side too when supported (trivial for intra only codecs)
> >
> > The code for that isn't there though (rawenc with the current code could
> > already handle that fine), FFmpeg never gives the encoder the slightest
> > hint that the resolution changed (avctx width/height stay at the
> > original values)...
> Then we should fix that.

That would mean at the same time fixing all encoders to handle it or
there will still be crashes.
Also, while the raw "encoder" can handle size changes, the result won't
be usable in most containers (which containers that handle raw can
handle mid-stream size changes in it?).
That's why I proposed the error message, making size changes without
scaling work right is more than a small effort and will probably only
work for a select few formats anyway.
It might make more sense to just require an explicit codec re-init in
that case (though that still doesn't answer how to handle it at the
muxer level).

More information about the ffmpeg-devel mailing list