[Ffmpeg-devel] [PATCH] fix mid-stream resolution changes

Heikki Lindholm holindho
Sun Apr 1 10:34:20 CEST 2007

Michael Niedermayer kirjoitti:
> Hi
> On Sat, Mar 31, 2007 at 02:52:50PM +0300, Heikki Lindholm wrote:
>>ffmpeg's mpeg decoder cannot seem to handle mid-stream changes in 
>>resolution, which are fairly common in DVB broadcasts. I made the 
>>attached patch to do something about the problem, but knowing next to 
>>nothing about ffmpeg internals, the approach might not be the proper 
>>one. Also, I'm not sure whether the "avctx->coded_width  != s->width" 
>>checks actually ever trigger and whether they, therefore, are useful at all.
> you will have to provide a sample video and precisse and complete instructions
> on how to reproduce the original problem ...

I don't have a suitable web space for that, but I can send you a clip 
and my test program privately, if you're willing to look into this. 
Basically, I created two short PAL 704 and 720 m2v's, and, using the 
most sophisticated video editor imaginable, made a composite clip: "cat 
704.m2v 720.m2v 704.m2v 720.m2v > testclip.m2v" This seems to resemble 
the stuff that comes in a DVB transmission.

With my own test program (ffmpeg rev 8581), I get errors like
[mpeg2video @ 0xb7ec48a8]end mismatch left=313 46FE3B
[mpeg2video @ 0xb7ec48a8]concealing 1584 DC, 1584 AC, 1584 MV errors
after the second resolution change in the stream. These errors follow 
from the fact that the stuff in decode_postinit wasn't run when the 
resolution changed. With my patch, there are no such errors. Mplayer 
chokes on the stream also and displays garbage after the change (though, 
mplayer is compiled with a different ffmpeg revision.)

-- Heikki Lindholm

More information about the ffmpeg-devel mailing list