Opened 4 years ago

Closed 4 years ago

#8633 closed defect (duplicate)

First frame of scaled GIF partially persists on subsequent frames' transparent area

Reported by: David Joseph Guzsik Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
Provided a GIF with pixels that are transparent in some frames but not others, scaling said GIF in the current git-master build of ffmpeg causes pixels of the first frame to stick around until the end of the loop.

How to reproduce:
Run the below command on the attached GIF, which should result in a similarly sized version of the same motion. Note how the first frame's content remains (at least partially) visible on all subsequent frames. The same effect can be observed at larger or smaller w and h values.

% ffmpeg -y -i dot.gif -lavfi "[0:v] scale=w=100:h=100:flags=lanczos,split [a][b]; [a] palettegen [p]; [b][p] paletteuse" scaled.gif
ffmpeg version N-52056-ge5d25d1147-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 8 (Debian 8.3.0-6)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
  libavutil      56. 42.101 / 56. 42.101
  libavcodec     58. 76.100 / 58. 76.100
  libavformat    58. 42.100 / 58. 42.100
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 77.100 /  7. 77.100
  libswscale      5.  6.101 /  5.  6.101
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Input #0, gif, from 'dot.gif':
  Duration: 00:00:00.90, start: 0.000000, bitrate: 5 kb/s
    Stream #0:0: Video: gif, bgra, 50x50, 10 fps, 10 tbr, 100 tbn, 100 tbc
Stream mapping:
  Stream #0:0 (gif) -> scale
  paletteuse -> Stream #0:0 (gif)
Press [q] to stop, [?] for help
Output #0, gif, to 'scaled.gif':
  Metadata:
    encoder         : Lavf58.42.100
    Stream #0:0: Video: gif, pal8, 50x50, q=2-31, 200 kb/s, 10 fps, 100 tbn, 10 tbc
    Metadata:
      encoder         : Lavc58.76.100 gif
[Parsed_palettegen_2 @ 0x704da00] 2(+1) colors generated out of 2 colors; ratio=1.000000
frame=    9 fps=0.0 q=-0.0 Lsize=       2kB time=00:00:00.81 bitrate=  24.7kbits/s speed= 272x    
video:2kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.804829%

Attachments (1)

dot.gif (634 bytes ) - added by David Joseph Guzsik 4 years ago.

Download all attachments as: .zip

Change History (3)

by David Joseph Guzsik, 4 years ago

Attachment: dot.gif added

comment:1 by David Joseph Guzsik, 4 years ago

Correction to the command: the output is actually a result of the following scale options:

ffmpeg -i dot.gif -lavfi "[0:v] scale=w=50:h=50:flags=lanczos,split [a][b]; [a] palettegen [p]; [b][p] paletteuse" scaled.gif

I ended up copying the output under the wrong run, but the version and all other information besides the input/output size is correct.

comment:2 by Carl Eugen Hoyos, 4 years ago

Keywords: gif scale trailing ghosting transparency alpha removed
Resolution: duplicate
Status: newclosed

Duplicate of ticket #7902.

Note: See TracTickets for help on using tickets.