VideoHelp Forum
+ Reply to Thread
Results 1 to 6 of 6
Thread
  1. 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?
    Quote Quote  
  2. 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
    Quote Quote  
  3. Member thecoalman's Avatar
    Join Date
    Feb 2004
    Location
    Pennsylvania
    Search PM
    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.
    Quote Quote  
  4. Banned
    Join Date
    Apr 2024
    Location
    US
    Search Comp PM
    Originally Posted by The Enigma View Post
    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?
    The difference in the quality of GIFs created with tools like ffmpeg and Shutter Encoder compared to other GIF creation tools often comes down to how they handle color palettes and optimization during the conversion process.
    Quote Quote  
  5. 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.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!