Opened 11 years ago

Closed 11 years ago

#3021 closed defect (fixed)

"Invalid block label" error while converting GIF

Reported by: Anton Owned by:
Priority: important Component: avformat
Version: git-master Keywords: gif regression
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Summary of the bug:
Trying to convert GIF file to webm after editing in ImageMagick library and getting this error. Original gif file converts without errors, but if I just open and save it with ImageMagick (or gifsicle) library it doesn't convert with ffmpeg anymore.

In ffmpeg 1.2.1 it's okay and I found that in ffmpeg 2.0.1 some additional error checkings were added to libavformat/gifdec.c:

    if ((ret >= 0 && !frame_parsed) || ret == AVERROR_EOF) {
        /* This might happen when there is no image block
         * between extension blocks and GIF_TRAILER or EOF */
        if (!gdc->ignore_loop && (block_label == GIF_TRAILER || url_feof(pb))
            && (gdc->total_iter < 0 || ++gdc->iter_count < gdc->total_iter))
            return avio_seek(pb, 0, SEEK_SET);
        return AVERROR_EOF;
    } else
        return ret;

So, I'm trying to understand, where is the problem: on ffmpeg side or it's ImageMagick (and other libs) GIF saving issue?

How to reproduce:

% ffmpeg -i processed.gif -b:v 600K -qmin 0 -qmax 50 -crf 5 out.webm
ffmpeg version 2.0.1 Copyright (c) 2000-2013 the FFmpeg developers
  built on Sep 25 2013 06:03:35 with Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
  configuration: --prefix=/opt/local --enable-swscale --enable-avfilter --enable-avresample --enable-libmp3lame --enable-libvorbis --enable-libopus --enable-libtheora --enable-libschroedinger --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libspeex --enable-libass --enable-libbluray --enable-gnutls --enable-libfreetype --disable-outdev=xv --mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/usr/bin/clang --arch=x86_64 --enable-yasm --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid
  libavutil      52. 38.100 / 52. 38.100
  libavcodec     55. 18.102 / 55. 18.102
  libavformat    55. 12.100 / 55. 12.100
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 79.101 /  3. 79.101
  libavresample   1.  1.  0 /  1.  1.  0
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
[gif @ 0x7fa121029800] invalid block label
Input #0, gif, from 'processed.gif':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: gif, bgra, 300x198, 100 tbr, 100 tbn, 100 tbc
[libvpx @ 0x7fa12102a400] v1.1.0
Output #0, webm, to 'out.webm':
  Metadata:
    encoder         : Lavf55.12.100
    Stream #0:0: Video: vp8 (libvpx), yuva420p, 300x198, q=0-50, 600 kb/s, 1k tbn, 100 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (gif -> libvpx)
Press [q] to stop, [?] for help
frame=    0 fps=0.0 q=0.0 Lsize=       0kB time=00:00:00.00 bitrate=N/A
video:0kB audio:0kB subtitle:0 global headers:0kB muxing overhead inf%
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)

Attachments (2)

processed.gif (1.8 MB ) - added by Anton 11 years ago.
ImageMagick processed GIF
original.gif (1.8 MB ) - added by Anton 11 years ago.
Original GIF

Change History (4)

by Anton, 11 years ago

Attachment: processed.gif added

ImageMagick processed GIF

by Anton, 11 years ago

Attachment: original.gif added

Original GIF

comment:1 by Carl Eugen Hoyos, 11 years ago

Keywords: gif regression added
Priority: normalimportant
Reproduced by developer: set
Status: newopen
Version: 2.0.1git-master

Regression since a16c205.

comment:2 by Michael Niedermayer, 11 years ago

Resolution: fixed
Status: openclosed
Note: See TracTickets for help on using tickets.