0

Why would FFmpeg create these artifacts like remaining pixels on the edges of the animation where objects have already removed and how to remove these?

Why would it create this magenta/red colored borders and how to remove these?

Why does it choose magenta/red color for semi-transparent pixels?

This is the command:

ffmpeg -pattern_type sequence \
-i "project_1_%05d.png" \
-vf "fps=30,scale=-1:-1:flags=lanczos,palettegen" \
"pallete_1.png" \
&& \
ffmpeg -pattern_type sequence \
-i "project_1_%05d.png" -i "pallete_1.png" \
-filter_complex "fps=30,scale=-1:-1:flags=bicubic[x];[x][1:v]paletteuse" \
"animation_bicubic_1.gif"

FFmpeg version:

ffmpeg version 4.2.3 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9.3.1 (GCC) 20200523
  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. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100

The first PNG frame of a sequence I created:

The result(palette) from the first command:

The result(animation) from the second command which previews 2 issues:


As requested in the comment section by Tetsujin, appended more variants with different effects:

The first PNG frame of a version without the glow effect:

A version without the glow effect in a PNG sequence(only artifacts exist):

A version without the transparency in the PNG sequence(no issues):

Indeed, it seems the transparency processing adds artifacts and magenta/red borders to the result.

1 Answers1

3

Try recreating it using images without transparency.
gifs handle transparency badly. Any pixel can either be fully visible or fully transparent, so your nice little fades at the edges of each star get destroyed. This is quite possibly causing the other artefacting too.

This…
enter image description here

becomes this…
enter image description here

Tetsujin
  • 50,917