[FFmpeg-user] PNG-->GIF produces weird color aliasing?

Steven Kan steven at kan.org
Sun May 19 20:02:09 EEST 2024


I have a series of 476 PNGs, exported from Excel in a loop through a series of values to control the plotted range:

https://www.kan.org/download/1.png
https://www.kan.org/download/2.png
https://www.kan.org/download/3.png
https://www.kan.org/download/4.png
https://www.kan.org/download/5.png
etc.

If I convert them to MP4:

ffmpeg -i %d.png -vf "pad=ceil(iw/2)*2:ceil(ih/2)*2,scale=1920:-1" -c:v libx264 -y WeightLogLapse.mp4

the resulting video looks as I would expect:

https://www.kan.org/download/WeightLogLapse.mp4

But if I convert to GIF:

ffmpeg -i %d.png -vf "pad=ceil(iw/2)*2:ceil(ih/2)*2,scale=1920:-1" -y WeightLogLapse.gif

I get this weird color aliasing:

https://www.kan.org/download/WeightLogLapse.gif

Am I doing this incorrectly? Thanks!

ffmpeg -i %d.png -vf "pad=ceil(iw/2)*2:ceil(ih/2)*2,scale=1920:-1" -y WeightLogLapse.gif
ffmpeg version 7.0 Copyright (c) 2000-2024 the FFmpeg developers
  built with Apple clang version 13.1.6 (clang-1316.0.21.2.5)
  configuration: --prefix=/Volumes/tempdisk/sw --extra-cflags=-fno-stack-check --arch=arm64 --cc=/usr/bin/clang --enable-gpl --enable-libvmaf --enable-libopenjpeg --enable-libopus --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libvpx --enable-libwebp --enable-libass --enable-libfreetype --enable-fontconfig --enable-libtheora --enable-libvorbis --enable-libsnappy --enable-libaom --enable-libvidstab --enable-libzimg --enable-libsvtav1 --enable-libharfbuzz --enable-libkvazaar --pkg-config-flags=--static --enable-ffplay --enable-postproc --enable-neon --enable-runtime-cpudetect --disable-indev=qtkit --disable-indev=x11grab_xcb
  libavutil      59.  8.100 / 59.  8.100
  libavcodec     61.  3.100 / 61.  3.100
  libavformat    61.  1.100 / 61.  1.100
  libavdevice    61.  1.100 / 61.  1.100
  libavfilter    10.  1.100 / 10.  1.100
  libswscale      8.  1.100 /  8.  1.100
  libswresample   5.  1.100 /  5.  1.100
  libpostproc    58.  1.100 / 58.  1.100
Input #0, image2, from '%d.png':
  Duration: 00:00:18.64, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: png, rgba(pc, gbr/bt709/iec61966-2-1), 2808x1550 [SAR 5669:5669 DAR 1404:775], 25 fps, 25 tbr, 25 tbn
Stream mapping:
  Stream #0:0 -> #0:0 (png (native) -> gif (native))
Press [q] to stop, [?] for help
Output #0, gif, to 'WeightLogLapse.gif':
  Metadata:
    encoder         : Lavf61.1.100
  Stream #0:0: Video: gif, bgr8(pc, gbr/bt709/iec61966-2-1, progressive), 1920x1060 [SAR 6201:6200 DAR 1404:775], q=2-31, 200 kb/s, 25 fps, 100 tbn
      Metadata:
        encoder         : Lavc61.3.100 gif
[out#0/gif @ 0x600001210000] video:13110KiB audio:0KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.000149%
frame=  466 fps= 31 q=-0.0 Lsize=   13110KiB time=00:00:18.64 bitrate=5761.8kbits/s speed=1.23x    


More information about the ffmpeg-user mailing list