[FFmpeg-devel] [PATCH] Fix distortion problem in MPEG1/2 video

Heesuk Jung hsjung1305 at gmail.com
Thu May 16 02:39:33 CEST 2013


I checked the linked damaged fie(cartonfold.avi) and I knew that
pull parsing make some problems when the file is played.

And so I agree your previous patch using metadata.

Thanks for feedback.

2013/5/16 Michael Niedermayer <michaelni at gmx.at>

> On Fri, May 10, 2013 at 03:13:51PM +0900, Heesuk Jung wrote:
> > In some MPEG1/2 AVI files, there are video distortion problem in bottom
> of screen.
> > (I just test files using ffplay)
> >
> > 1. MPEG1 video problematic file link
> >  - https://docs.google.com/open?id=0B6r7ZfWFIypCMkltZHJDY0pQN1U
> > 2. MPEG2 video problematic file link
> >  - https://docs.google.com/open?id=0B6r7ZfWFIypCM0ZremxpbXc1N3c
> >
> > Root cause of this problem is wrong frame size based on header
> information.
> > Suggests to use full parsing option after checking frame size within
> some frames in order
> > to prevent performance loss.
> >
> > Please refer the concern of performance loss at my previous patch.
> > (http://ffmpeg.org/pipermail/ffmpeg-devel/2012-November/134186.html)
> > ---
> >  libavcodec/mpegvideo_parser.c | 15 +++++++++++++++
> >  1 file changed, 15 insertions(+)
> >
> > diff --git a/libavcodec/mpegvideo_parser.c
> b/libavcodec/mpegvideo_parser.c
> > index f127218..dddc11f 100644
> > --- a/libavcodec/mpegvideo_parser.c
> > +++ b/libavcodec/mpegvideo_parser.c
> > @@ -24,6 +24,10 @@
> >  #include "mpeg12.h"
> >  #include "internal.h"
> >
> > +#define MAX_RETRY_FULL_PARSING 7
> > +
> > +static uint8_t retry_num = 0;
>
> breaks multiple decoders and multiple threads
>
>
> > +
> >  struct MpvParseContext {
> >      ParseContext pc;
> >      AVRational frame_rate;
> > @@ -160,6 +164,16 @@ static int mpegvideo_parse(AVCodecParserContext *s,
> >      ParseContext *pc= &pc1->pc;
> >      int next;
> >
> > +    if (retry_num < MAX_RETRY_FULL_PARSING &&
> > +        s->flags & PARSER_FLAG_COMPLETE_FRAMES) {
> > +        int measured_buf_size;
> > +        measured_buf_size = ff_mpeg1_find_frame_end(pc, buf, buf_size,
> s);
> > +
> > +        if (measured_buf_size > 0 && measured_buf_size < buf_size)
> > +            s->flags &= ~PARSER_FLAG_COMPLETE_FRAMES;
>
> this code breaks decoding of
> http://samples.ffmpeg.org/V-codecs/BW10/cartonfold.avi
> also the code could trigger on damaged files that do not need full
> parsing
>
>
> [...]
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> The bravest are surely those who have the clearest vision
> of what is before them, glory and danger alike, and yet
> notwithstanding go out to meet it. -- Thucydides
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>


More information about the ffmpeg-devel mailing list