Opened 6 years ago

Closed 5 years ago

#6874 closed defect (fixed)

"Invalid image height" decoding seemingly valid animated gif

Reported by: eefp Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: gif
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Summary of the bug:
After successfully converting numerous animated gifs to mp4, we ran into one that ffmpeg chokes on. It gives the error for the sample linked below:

[gif @ 0xac23860] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input

The gif in question animates properly in the web browser and can be decoded without warning by other gif tools

How to reproduce:

ffmpeg -i ani_gif_invalid_image_height.gif -f mp4 xyz.mp4

Sample

https://ufile.io/7mr08 (9MB)

Output:

ffmpeg version 3.4.git Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-18)
  configuration: --prefix=/root/ffmpeg_build --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags='-L/root/ffmpeg_build/lib -ldl' --bindir=/usr/local/bin --pkg-conf$
  libavutil      56.  3.100 / 56.  3.100
  libavcodec     58.  6.100 / 58.  6.100
  libavformat    58.  2.102 / 58.  2.102
  libavdevice    58.  0.100 / 58.  0.100
  libavfilter     7.  5.100 /  7.  5.100
  libswscale      5.  0.101 /  5.  0.101
  libswresample   3.  0.101 /  3.  0.101
  libpostproc    55.  0.100 / 55.  0.100
Input #0, gif, from 'ani_gif_invalid_image_height.gif':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: gif, bgra, 680x449, 10 fps, 10 tbr, 100 tbn, 100 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (gif (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 0xabe5b80] using cpu capabilities: none!
[libx264 @ 0xabe5b80] profile High 4:4:4 Predictive, level 2.2, 4:4:4 8-bit
[libx264 @ 0xabe5b80] 264 - core 120 r2151 a3f4407 - H.264/MPEG-4 AVC codec - Copyleft 2003-2011 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0$
Output #0, mp4, to 'xyz.mp4':
  Metadata:
    encoder         : Lavf58.2.102
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv444p, 680x449, q=-1--1, 10 fps, 10240 tbn, 10 tbc
    Metadata:
      encoder         : Lavc58.6.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
[gif @ 0xab9bd60] Invalid image height.
Error while decoding stream #0:0: Invalid data found when processing input
frame=    1 fps=0.0 q=25.0 Lsize=      22kB time=00:00:00.00 bitrate=1834775.5kbits/s speed=0.000265x
video:21kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 3.695502%
[libx264 @ 0xabe5b80] frame I:1     Avg QP:25.80  size: 21007
[libx264 @ 0xabe5b80] mb I  I16..4: 20.3% 56.7% 23.0%
[libx264 @ 0xabe5b80] 8x8 transform intra:56.7%
[libx264 @ 0xabe5b80] coded y,u,v intra: 65.6% 0.0% 0.0%
[libx264 @ 0xabe5b80] i16 v,h,dc,p: 69%  9% 16%  6%
[libx264 @ 0xabe5b80] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 24% 20%  4%  7%  5%  8%  5%  9%
[libx264 @ 0xabe5b80] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 25% 12%  6%  8%  7%  9%  5%  9%
[libx264 @ 0xabe5b80] kb/s:1680.56
Conversion failed!

ffmpeg -v 9 -loglevel 99 -i ani_gif_invalid_image_height.gif

[root@localhost test]# ffmpeg -v 9 -loglevel 99 -i ani_gif_invalid_image_height.gif
ffmpeg version 3.4.git Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-18)
  configuration: --prefix=/root/ffmpeg_build --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags='-L/root/ffmpeg_build/lib -ldl' --bindir=/usr/local/bin --pkg-config-flags=--static --enable-gpl --enable-version3 --enable-nonfree --enable-libfreetype --enable-libvorbis --enable-libx264
  libavutil      56.  3.100 / 56.  3.100
  libavcodec     58.  6.100 / 58.  6.100
  libavformat    58.  2.102 / 58.  2.102
  libavdevice    58.  0.100 / 58.  0.100
  libavfilter     7.  5.100 /  7.  5.100
  libswscale      5.  0.101 /  5.  0.101
  libswresample   3.  0.101 /  3.  0.101
  libpostproc    55.  0.100 / 55.  0.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '99'.
Reading option '-i' ... matched as input url with argument 'ani_gif_invalid_image_height.gif'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 9.
Successfully parsed a group of options.
Parsing a group of options: input url ani_gif_invalid_image_height.gif.
Successfully parsed a group of options.
Opening an input file: ani_gif_invalid_image_height.gif.
[NULL @ 0xb5bf1c0] Opening 'ani_gif_invalid_image_height.gif' for reading
[file @ 0xb5bf960] Setting default whitelist 'file,crypto'
Probing gif score:100 size:2048
[gif @ 0xb5bf1c0] Format gif probed with size=2048 and score=100
[gif @ 0xb5bf1c0] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0 nb_streams:1
[gif @ 0xb5bf1c0] Probe buffer size limit of 5000000 bytes reached
[gif @ 0xb5bf1c0] stream 0: start_time: -92233720368547760.000 duration: -92233720368547760.000
[gif @ 0xb5bf1c0] format: start_time: -9223372036854.775 duration: -9223372036854.775 bitrate=0 kb/s
[gif @ 0xb5bf1c0] After avformat_find_stream_info() pos: 5031219 bytes read:10831155 seeks:36 frames:36
Input #0, gif, from 'ani_gif_invalid_image_height.gif':
  Duration: N/A, bitrate: N/A
    Stream #0:0, 36, 1/100: Video: gif, 1 reference frame, bgra, 680x449, 0/1, 10 fps, 10 tbr, 100 tbn, 100 tbc
Successfully opened the file.
At least one output file must be specified
[AVIOContext @ 0xb5c7b00] Statistics: 10831155 bytes read, 36 seeks

Change History (4)

comment:1 by Carl Eugen Hoyos, 6 years ago

Component: undeterminedavcodec
Keywords: gif added
Reproduced by developer: set
Status: newopen

Patch sent.

Note that the snapshots FFmpeg offers on the download page do contain a complete version information instead of the useless string 3.4.git: http://ffmpeg.org/download.html (Download snapshot)

comment:2 by Elon Musk, 5 years ago

Resolution: needs_more_info
Status: openclosed

File is gone.

comment:3 by Carl Eugen Hoyos, 5 years ago

Resolution: needs_more_info
Status: closedreopened

comment:4 by Elon Musk, 5 years ago

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