I noticed that both ffmpeg and Shutter Encoder are able to create gifs that, despite being only being 8bit, look much cleaner and similar to the input video than most GIF making tools, because they either use a different method to select the gif color palette, or even change the palette in each frame, but why is that? And how do I apply them for other GIF making tools?
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 6 of 6
Thread
-
-
ffmpeg offer such feature - i can give my script - it use crude form of spatial antialiasing also it is tailored for producing animations with lower frame rate than source and using some crude form of temporal antialiasing but feel free to modify it.
It will produce two files - apng with single palette and gif with each frame with own optimal palette
max colors used set as you wish (max 256)
Code:@setlocal @set FFMPG=%CD%;C:\FF @set PATH=%FFMPG%;%PATH% @set max_colors=255 @set h_siz=320 @set /a dh_siz=%h_siz%*2 @set fps=50/4 @set dither=1:bayer_scale=2 @rem set dither=8 @rem set dither=5 @set contrast=1.0 @set brightness=0 @set saturation=1.0 @set sharpen=1.25 @set fa=4 @set weights='3 6 12 32' @set crop=null @rem set crop=crop=1920:800:0:140 @rem set crop= @set filename=%1 @rem APNG @set stats_mode=0 @ffmpeg.exe -y -hide_banner -v 32 -stats -i %filename% -an -sn -dn -sws_flags +accurate_rnd+full_chroma_int -filter_complex "%crop%,hqdn3d=6:6:4:4,zscale=d=ordered:f=spline36:r=full:w=%dh_siz%:h=-2,tblend=all_mode=average,tmix=frames=%fa%:weights=%weights%,fps=%fps%,tblend=all_mode=average,eq=contrast=%contrast%:brightness=%brightness%:saturation=%saturation%,unsharp=5:5:%sharpen%:3:3:0:3:3:0,format=pix_fmts=rgb24,zscale=d=1:f=5:r=1:m=0:w=%h_siz%:h=-2,xbr=3,zscale=d=1:f=5:r=1:m=0:w=%h_siz%:h=-2,transpose=1:none,xbr=3,transpose=2:none,zscale=d=1:f=5:r=1:m=0:w=%h_siz%:h=-2,split[v1][v2]; [v1]palettegen=max_colors=%max_colors%:stats_mode=%stats_mode%:reserve_transparent=false [palette]; [v2][palette]paletteuse=dither=%dither%" -fps_mode auto -q:v 100 -f apng -plays 0 -compression_level 32767 -pred 5 "%~n1_a.png" @rem GIF @set stats_mode=2 @ffmpeg.exe -y -hide_banner -v 32 -stats -i %filename% -an -sn -dn -sws_flags +accurate_rnd+full_chroma_int -filter_complex "%crop%,hqdn3d=6:6:4:4,zscale=d=ordered:f=spline36:r=full:w=%dh_siz%:h=-2,tblend=all_mode=average,tmix=frames=%fa%:weights=%weights%,fps=%fps%,tblend=all_mode=average,eq=contrast=%contrast%:brightness=%brightness%:saturation=%saturation%,unsharp=5:5:%sharpen%:3:3:0:3:3:0,format=pix_fmts=rgb24,zscale=d=1:f=5:r=1:m=0:w=%h_siz%:h=-2,xbr=3,zscale=d=1:f=5:r=1:m=0:w=%h_siz%:h=-2,transpose=1:none,xbr=3,transpose=2:none,zscale=d=1:f=5:r=1:m=0:w=%h_siz%:h=-2,split[v1][v2]; [v1]palettegen=max_colors=%max_colors%:stats_mode=%stats_mode%:reserve_transparent=false [palette]; [v2][palette]paletteuse=dither=%dither%:new=1" -fps_mode auto -q:v 100 -f gif -plays 0 -compression_level 32767 -pred 5 "%~n1_a.gif" @endlocal @pause
-
Try and find a copy of Ulead Photoimpact and make sure it includes the .gif animator. It's basically a video editor for .gif's. You would be hard pressed to find a better tool for working with gif's. I know it will run under Windows 10, not sure about 11.
-
-
Also read up on dithering and error diffusion.
https://en.wikipedia.org/wiki/Dither
https://en.wikipedia.org/wiki/Error_diffusion -
I don't think it's part of the original GIF standard but there are some extensions that allow multiple palettes. For example you could split an image into four quadrants and use a different palette for each. In theory you could extend this to splitting the image into 16x16 pixel blocks and use a different palette for each block to get lossless encoding (256 pixels, 256 colors). But the result would probably be larger than just leaving the image as RGB and encoding lossless.
Similar Threads
-
Gifs/Apngs With Forced Subtitles
By Jay123210599 in forum Newbie / General discussionsReplies: 2Last Post: 11th Jan 2024, 13:46 -
Subtitles with Gifs, Apngs, and image sequences
By Jay123210599 in forum Newbie / General discussionsReplies: 2Last Post: 25th Dec 2023, 08:44 -
ffmpeg: How to overlay two gifs to play at once?
By Mugunga in forum Video ConversionReplies: 1Last Post: 1st Jun 2023, 07:51 -
How do I use ffmpeg to create the highest quality animated gifs from video
By Bruce Banner in forum EditingReplies: 13Last Post: 11th May 2019, 00:26 -
Need advice about making short tutorial gifs
By wooku in forum Newbie / General discussionsReplies: 3Last Post: 24th Mar 2019, 11:40