Opened 5 years ago

Closed 4 years ago

#7902 closed defect (fixed)

GIF transparent frames overlapping

Reported by: kolopo Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords: gif alpha
Cc: rederrorsuru@gmail.com Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug: Transparent gifs are having frames overlap previous ones. If the stats mode is set as single then all frames will overlap the previous frames. If stats mode is full or diff then only the first frame will remain and be overlapped by each frame.

How to reproduce:

% ffmpeg -v 9 -loglevel 99 -framerate 1 -i input%d.png -lavfi palettegen[pal],[0:v][pal]paletteuse output.gif
ffmpeg version N-93851-gdcc999819d Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 8.3.1 (GCC) 20190414
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
  libavutil      56. 27.100 / 56. 27.100
  libavcodec     58. 52.101 / 58. 52.101
  libavformat    58. 27.103 / 58. 27.103
  libavdevice    58.  7.100 / 58.  7.100
  libavfilter     7. 51.100 /  7. 51.100
  libswscale      5.  4.101 /  5.  4.101
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.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 '-framerate' ... matched as AVOption 'framerate' with argument '1'.
Reading option '-i' ... matched as input url with argument 'input%d.png'.
Reading option '-lavfi' ... matched as option 'lavfi' (create a complex filtergraph) with argument 'palettegen[pal],[0:v][pal]paletteuse'.
Reading option 'output.gif' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 9.
Applying option lavfi (create a complex filtergraph) with argument palettegen[pal],[0:v][pal]paletteuse.
Successfully parsed a group of options.
Parsing a group of options: input url input%d.png.
Successfully parsed a group of options.
Opening an input file: input%d.png.
Probing image2 score:100 size:0
[image2 @ 00000260f636af40] Opening 'input1.png' for reading
[file @ 00000260f636ed80] Setting default whitelist 'file,crypto'
[AVIOContext @ 00000260f6376f40] Statistics: 5778 bytes read, 0 seeks
[image2 @ 00000260f636af40] Opening 'input2.png' for reading
[file @ 00000260f63788c0] Setting default whitelist 'file,crypto'
[AVIOContext @ 00000260f6378a00] Statistics: 7702 bytes read, 0 seeks
[image2 @ 00000260f636af40] Opening 'input3.png' for reading
[file @ 00000260f6376f80] Setting default whitelist 'file,crypto'
[AVIOContext @ 00000260f6378940] Statistics: 7906 bytes read, 0 seeks
[image2 @ 00000260f636af40] Opening 'input4.png' for reading
[file @ 00000260f63788c0] Setting default whitelist 'file,crypto'
[AVIOContext @ 00000260f687b380] Statistics: 7554 bytes read, 0 seeks
[image2 @ 00000260f636af40] Opening 'input5.png' for reading
[file @ 00000260f6382700] Setting default whitelist 'file,crypto'
[AVIOContext @ 00000260f63827c0] Statistics: 7634 bytes read, 0 seeks
[image2 @ 00000260f636af40] rfps: 0.916667 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 1.000000 0.000000
[image2 @ 00000260f636af40] rfps: 1.083333 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 1.916667 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 2.000000 0.000000
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 2.083333 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 2.916667 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 3.000000 0.000000
[image2 @ 00000260f636af40] rfps: 3.083333 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 3.916667 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 4.000000 0.000000
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 4.083333 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 4.916667 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 5.000000 0.000000
[image2 @ 00000260f636af40] rfps: 5.083333 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 5.916667 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 6.000000 0.000000
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 6.083333 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 6.916667 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 7.000000 0.000000
[image2 @ 00000260f636af40] rfps: 7.083333 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 7.916667 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 8.000000 0.000000
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 8.083333 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 8.916667 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 9.000000 0.000000
[image2 @ 00000260f636af40] rfps: 9.083333 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 9.916667 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 10.000000 0.000000
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 10.083333 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 10.916667 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 11.000000 0.000000
[image2 @ 00000260f636af40] rfps: 11.083333 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 11.916667 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 12.000000 0.000000
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 12.083333 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 12.916667 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 13.000000 0.000000
[image2 @ 00000260f636af40] rfps: 13.083333 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 13.916667 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 14.000000 0.000000
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 14.083333 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 14.916667 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 15.000000 0.000000
[image2 @ 00000260f636af40] rfps: 15.083333 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 15.916667 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 16.000000 0.000000
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 16.083333 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 16.916667 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 17.000000 0.000000
[image2 @ 00000260f636af40] rfps: 17.083333 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 17.916667 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 18.000000 0.000000
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 18.083333 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 18.916667 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 19.000000 0.000000
[image2 @ 00000260f636af40] rfps: 19.083333 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 19.916667 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 20.000000 0.000000
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 20.083333 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 20.916667 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 21.000000 0.000000
[image2 @ 00000260f636af40] rfps: 21.083333 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 21.916667 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 22.000000 0.000000
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 22.083333 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 22.916667 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 23.000000 0.000000
[image2 @ 00000260f636af40] rfps: 23.083333 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 23.916667 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 24.000000 0.000000
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 24.083333 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 24.916667 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 25.000000 0.000000
[image2 @ 00000260f636af40] rfps: 25.083333 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 25.916667 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 26.000000 0.000000
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 26.083333 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 26.916667 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 27.000000 0.000000
[image2 @ 00000260f636af40] rfps: 27.083333 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 27.916667 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 28.000000 0.000000
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 28.083333 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 28.916667 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 29.000000 0.000000
[image2 @ 00000260f636af40] rfps: 29.083333 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 29.916667 0.008681
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 30.000000 0.000000
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 31.000000 0.000000
[image2 @ 00000260f636af40] rfps: 32.000000 0.000000
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 33.000000 0.000000
[image2 @ 00000260f636af40] rfps: 34.000000 0.000000
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 35.000000 0.000000
[image2 @ 00000260f636af40] rfps: 36.000000 0.000000
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 37.000000 0.000000
[image2 @ 00000260f636af40] rfps: 38.000000 0.000000
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 39.000000 0.000000
[image2 @ 00000260f636af40] rfps: 40.000000 0.000000
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 41.000000 0.000000
[image2 @ 00000260f636af40] rfps: 42.000000 0.000000
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 43.000000 0.000000
[image2 @ 00000260f636af40] rfps: 44.000000 0.000000
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 45.000000 0.000000
[image2 @ 00000260f636af40] rfps: 46.000000 0.000000
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 47.000000 0.000000
[image2 @ 00000260f636af40] rfps: 48.000000 0.000000
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 49.000000 0.000000
[image2 @ 00000260f636af40] rfps: 50.000000 0.000000
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 51.000000 0.000000
[image2 @ 00000260f636af40] rfps: 52.000000 0.000000
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 53.000000 0.000000
[image2 @ 00000260f636af40] rfps: 54.000000 0.000000
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 55.000000 0.000000
[image2 @ 00000260f636af40] rfps: 56.000000 0.000000
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 57.000000 0.000000
[image2 @ 00000260f636af40] rfps: 58.000000 0.000000
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 59.000000 0.000000
[image2 @ 00000260f636af40] rfps: 60.000000 0.000000
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 80.000000 0.000000
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 120.000000 0.000000
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 240.000000 0.000000
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 23.976024 0.000719
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 29.970030 0.001123
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 59.940060 0.004491
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 11.988012 0.000180
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 14.985015 0.000281
    Last message repeated 1 times
[image2 @ 00000260f636af40] rfps: 47.952048 0.002874
    Last message repeated 1 times
[image2 @ 00000260f636af40] stream 0: start_time: 0.000 duration: 5.000
[image2 @ 00000260f636af40] format: start_time: 0.000 duration: 5.000 bitrate=0 kb/s
Input #0, image2, from 'input%d.png':
  Duration: 00:00:05.00, start: 0.000000, bitrate: N/A
    Stream #0:0, 5, 1/1: Video: png, 1 reference frame, rgba(pc), 500x500 [SAR 3777:3777 DAR 1:1], 0/1, 1 fps, 1 tbr, 1 tbn, 1 tbc
Successfully opened the file.
Parsing a group of options: output url output.gif.
Successfully parsed a group of options.
Opening an output file: output.gif.
[file @ 00000260f6379780] Setting default whitelist 'file,crypto'
Successfully opened the file.
detected 8 logical cores
Stream mapping:
  Stream #0:0 (png) -> palettegen
  Stream #0:0 (png) -> paletteuse:default
  paletteuse -> Stream #0:0 (gif)
Press [q] to stop, [?] for help
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
    Last message repeated 5 times
[graph 0 input from stream 0:0 @ 00000260f63cd200] Setting 'video_size' to value '500x500'
[graph 0 input from stream 0:0 @ 00000260f63cd200] Setting 'pix_fmt' to value '26'
[graph 0 input from stream 0:0 @ 00000260f63cd200] Setting 'time_base' to value '1/1'
[graph 0 input from stream 0:0 @ 00000260f63cd200] Setting 'pixel_aspect' to value '3777/3777'
[graph 0 input from stream 0:0 @ 00000260f63cd200] Setting 'sws_param' to value 'flags=2'
[graph 0 input from stream 0:0 @ 00000260f63cd200] Setting 'frame_rate' to value '1/1'
[graph 0 input from stream 0:0 @ 00000260f63cd200] w:500 h:500 pixfmt:rgba tb:1/1 fr:1/1 sar:3777/3777 sws_param:flags=2
[graph 0 input from stream 0:0 @ 00000260f63cd580] Setting 'video_size' to value '500x500'
[graph 0 input from stream 0:0 @ 00000260f63cd580] Setting 'pix_fmt' to value '26'
[graph 0 input from stream 0:0 @ 00000260f63cd580] Setting 'time_base' to value '1/1'
[graph 0 input from stream 0:0 @ 00000260f63cd580] Setting 'pixel_aspect' to value '3777/3777'
[graph 0 input from stream 0:0 @ 00000260f63cd580] Setting 'sws_param' to value 'flags=2'
[graph 0 input from stream 0:0 @ 00000260f63cd580] Setting 'frame_rate' to value '1/1'
[graph 0 input from stream 0:0 @ 00000260f63cd580] w:500 h:500 pixfmt:rgba tb:1/1 fr:1/1 sar:3777/3777 sws_param:flags=2
[format @ 00000260f6d76e80] Setting 'pix_fmts' to value 'rgb8|bgr8|rgb4_byte|bgr4_byte|gray|pal8'
[auto_scaler_0 @ 00000260f6d76b80] w:iw h:ih flags:'bilinear' interl:0
[Parsed_palettegen_0 @ 00000260f63826c0] auto-inserting filter 'auto_scaler_0' between the filter 'graph 0 input from stream 0:0' and the filter 'Parsed_palettegen_0'
[auto_scaler_1 @ 00000260f63d46c0] w:iw h:ih flags:'bilinear' interl:0
[Parsed_paletteuse_1 @ 00000260f6376f40] auto-inserting filter 'auto_scaler_1' between the filter 'graph 0 input from stream 0:0' and the filter 'Parsed_paletteuse_1'
[AVFilterGraph @ 00000260f6378880] query_formats: 6 queried, 3 merged, 2 already done, 0 delayed
[swscaler @ 00000260f63f18c0] Forcing full internal H chroma due to input having non subsampled chroma
[auto_scaler_1 @ 00000260f63d46c0] w:500 h:500 fmt:rgba sar:3777/3777 -> w:500 h:500 fmt:bgra sar:1/1 flags:0x2
[swscaler @ 00000260f6406fc0] Forcing full internal H chroma due to input having non subsampled chroma
[auto_scaler_0 @ 00000260f6d76b80] w:500 h:500 fmt:rgba sar:3777/3777 -> w:500 h:500 fmt:bgra sar:1/1 flags:0x2
[Parsed_paletteuse_1 @ 00000260f6376f40] [framesync @ 00000260f6cf4c48] Selected 1/1 time base
[Parsed_paletteuse_1 @ 00000260f6376f40] [framesync @ 00000260f6cf4c48] Sync level 2
Output #0, gif, to 'output.gif':
  Metadata:
    encoder         : Lavf58.27.103
    Stream #0:0, 0, 1/100: Video: gif, 1 reference frame, pal8, 500x500 [SAR 1:1 DAR 1:1], 0/1, q=2-31, 200 kb/s, 1 fps, 100 tbn, 1 tbc (default)
    Metadata:
      encoder         : Lavc58.52.101 gif
cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
[swscaler @ 00000260f6406fc0] Forcing full internal H chroma due to input having non subsampled chroma
[auto_scaler_0 @ 00000260f6d76b80] w:500 h:500 fmt:rgba sar:3779/3779 -> w:500 h:500 fmt:bgra sar:1/1 flags:0x2
[swscaler @ 00000260f63f18c0] Forcing full internal H chroma due to input having non subsampled chroma
[auto_scaler_1 @ 00000260f63d46c0] w:500 h:500 fmt:rgba sar:3779/3779 -> w:500 h:500 fmt:bgra sar:1/1 flags:0x2
cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
[swscaler @ 00000260f6406fc0] Forcing full internal H chroma due to input having non subsampled chroma
[auto_scaler_0 @ 00000260f6d76b80] w:500 h:500 fmt:rgba sar:3778/3778 -> w:500 h:500 fmt:bgra sar:1/1 flags:0x2
[swscaler @ 00000260f63f18c0] Forcing full internal H chroma due to input having non subsampled chroma
[auto_scaler_1 @ 00000260f63d46c0] w:500 h:500 fmt:rgba sar:3778/3778 -> w:500 h:500 fmt:bgra sar:1/1 flags:0x2
cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
[swscaler @ 00000260f6406fc0] Forcing full internal H chroma due to input having non subsampled chroma
[auto_scaler_0 @ 00000260f6d76b80] w:500 h:500 fmt:rgba sar:3779/3779 -> w:500 h:500 fmt:bgra sar:1/1 flags:0x2
[swscaler @ 00000260f63f18c0] Forcing full internal H chroma due to input having non subsampled chroma
[auto_scaler_1 @ 00000260f63d46c0] w:500 h:500 fmt:rgba sar:3779/3779 -> w:500 h:500 fmt:bgra sar:1/1 flags:0x2
cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
[swscaler @ 00000260f6406fc0] Forcing full internal H chroma due to input having non subsampled chroma
[auto_scaler_0 @ 00000260f6d76b80] w:500 h:500 fmt:rgba sar:3778/3778 -> w:500 h:500 fmt:bgra sar:1/1 flags:0x2
[swscaler @ 00000260f63f18c0] Forcing full internal H chroma due to input having non subsampled chroma
[auto_scaler_1 @ 00000260f63d46c0] w:500 h:500 fmt:rgba sar:3778/3778 -> w:500 h:500 fmt:bgra sar:1/1 flags:0x2
cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
[Parsed_palettegen_0 @ 00000260f63826c0] 255(+1) colors generated out of 269 colors; ratio=0.947955
[Parsed_palettegen_0 @ 00000260f63826c0] Dupped color: FF000000
cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
Clipping frame in rate conversion by 0.000008
[gif @ 00000260f637cc80] 304x63 image at pos (98;413) [area:500x500]
[gif @ 00000260f637cc80] 303x63 image at pos (106;135) [area:500x500]
[gif @ 00000260f637cc80] 306x62 image at pos (97;43) [area:500x500]
[gif @ 00000260f637cc80] 303x62 image at pos (91;303) [area:500x500]
[Parsed_paletteuse_1 @ 00000260f6376f40] [framesync @ 00000260f6cf4c48] Sync level 0
[out_0_0 @ 00000260f63cd740] EOF on sink link out_0_0:default.
No more output streams to write to, finishing.
frame=    5 fps=0.0 q=-0.0 Lsize=      22kB time=00:00:04.01 bitrate=  44.0kbits/s speed=36.8x
video:22kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.090843%
Input file #0 (input%d.png):
  Input stream #0:0 (video): 5 packets read (36574 bytes); 5 frames decoded;
  Total: 5 packets (36574 bytes) demuxed
Output file #0 (output.gif):
  Output stream #0:0 (video): 5 frames encoded; 5 packets muxed (22016 bytes);
  Total: 5 packets (22016 bytes) muxed
5 frames successfully decoded, 0 decoding errors
[AVIOContext @ 00000260f637da00] Statistics: 0 seeks, 1 writeouts

Attachments (3)

input and output files.zip (58.0 KB ) - added by kolopo 5 years ago.
Contains 5 input images and the resulting output image.
output_corrected.gif (18.7 KB ) - added by kolopo 5 years ago.
output gif edited with paint.net to show what the command should/what I expected it to output.
slowsmoke.gif (752 bytes ) - added by RedError 4 years ago.
Input file (transparent gif with movement between the first two frames)

Download all attachments as: .zip

Change History (11)

by kolopo, 5 years ago

Attachment: input and output files.zip added

Contains 5 input images and the resulting output image.

comment:1 by Elon Musk, 5 years ago

And how it should look instead?

in reply to:  1 comment:2 by kolopo, 5 years ago

Replying to richardpl:

And how it should look instead?

should display each frame separately. I'll edit the gif manually(with paint.net) and attach the corrected version to show more clearly what I expect to be the output.

by kolopo, 5 years ago

Attachment: output_corrected.gif added

output gif edited with paint.net to show what the command should/what I expected it to output.

comment:3 by Carl Eugen Hoyos, 5 years ago

Keywords: alpha added; overlap encoding removed
Version: unspecifiedgit-master

comment:4 by RedError, 4 years ago

Cc: rederrorsuru@gmail.com added
Keywords: disposal added; alpha removed

When creating a gif with transparency with ffmpeg, the first frame has a wrong "Gif Disposal" value (1 "Do Not Dispose" instead of 0 "No disposal" or 2 "Restore to Background" like all the other frames) and thus is always overlayed on the second frame.

How to reproduce (ffmpeg version git-2020-03-24-e5d25d1):

ffmpeg -i "slowsmoke.gif" -gifflags 0 -vf "[0:v] split [a][b]; [a] palettegen [p]; [b][p] paletteuse [r]" "slowsmoke ffmpeg.gif" -y

Input slowsmoke.gif:
https://i.ibb.co/mzSx63y/slowsmoke.gif
Output "slowsmoke ffmpeg.gif":
https://i.imgur.com/cnd96Wq.gif

Additional details:

  • The disposal info of the faulty gif can be viewed in advanced gif editors. For example, Gimp shows the second frame as being "combine". Editing that information allows the gif to be fixed. This proves that it is indeed the frame disposal that is in cause.

https://i.imgur.com/GFD9AgG.png

  • -gifflags +offsetting leaves additional traces for next frames (by reducing the frame draw area) as underlined in the OP, so it's better disabled in this case with -gifflags 0 like I did, but I don't think that's directly related to the underlying first frame disposal issue.

https://i.imgur.com/MNtPeA1.gif

  • -gifflags -transdiff or +transdiff cannot actually do anything for transparent gifs, because of the presence of transparency in the refresh area (cannot combine layers based on transparent holes), so it's also not directly related.
  • The Disposal method is different with non-transparent gifs Example, so the encoding error might be close to where the difference in Disposal is handled when saving a frame/first frame.
  • Explanation of "Do Not Dispose" Gif Disposal: «any pixels not covered up by the next frame continue to display.» http://webreference.com/content/studio/disposal.html Numerical values of each disposal mode taken from: https://www.w3.org/Graphics/GIF/spec-gif89a.txt

png's alpha transparency was unrelated so I removed the keyword.

Last edited 4 years ago by RedError (previous) (diff)

by RedError, 4 years ago

Attachment: slowsmoke.gif added

Input file (transparent gif with movement between the first two frames)

comment:5 by Carl Eugen Hoyos, 4 years ago

Keywords: disposal removed

comment:6 by Carl Eugen Hoyos, 4 years ago

Keywords: alpha added

comment:7 by byteslice, 4 years ago

Removing the first frame check, which unconditionally sets the first frame's disposal method to combine, in gif_image_write_image (libavcodec/gif.c) appears to fix the issue. I am unsure why this check was introduced; is removing it a bad idea?

comment:8 by Elon Musk, 4 years ago

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