Batch Animated GIF Creation - How to?

For the developers that use FFmpeg in their software.
Post Reply
Posts: 1
Joined: Thu Nov 16, 2017 1:46 pm

Batch Animated GIF Creation - How to?

Post by colink » Thu Nov 16, 2017 2:10 pm

Is there any way to batch create Animated GIF's from multiple images?

Ideally I would like to create a CSV file or Excel file where each row (line) would list the files to include in the animated GIF (plus if necessary parameters like speed and number of cycles)

Does some script exist that will do this?

Where do I start to find what would be required to create such a script?

I am not a competent coder, but can do a bit of copy, paste and edit to make some things work.

Or - can anyone suggest a stand alone windows application that will do this?

Thanks ColinK

Posts: 92
Joined: Mon Feb 24, 2014 1:46 pm

Re: Batch Animated GIF Creation - How to?

Post by pandy » Sat Dec 02, 2017 4:25 pm

ffmpeg is capable to create animated gif files - not sure however if it will meet your expectations.

I use something like this (it is two pass conversion, source is processed - resize, frame rate conversion and fake antialiasing, temporary lossless file is created - some storage space required). Last stage is gif optimization so gif can be smaller (it is optional) - Gifsicle required :

Code: Select all

@set /p CLUT=How Many Colors (4..256): 
@echo Number of colors: %CLUT%

@set /p BS=Bayer_Strength (0..5 lower is stronger): 
@echo Bayer Strength: %BS%

@ffmpeg.exe -y -stats -hide_banner -i "%1" -an -sn -dn -sws_dither ed -filter_complex "crop=1920:784:0:148,scale=640:-2:sws_flags=spline+accurate_rnd+full_chroma_int+full_chroma_inp:in_range='mpeg/tv':out_range='jpeg/full/pc',hqdn3d=5,smartblur=lr=1.75:ls=-0.50:lt=-5.5:cr=0.5:cs=1.0:ct=0.5,minterpolate=fps=25/2:mi_mode=mci:me_mode=bidir:me=epzs:vsbmc=1,scale=320:-2:sws_flags=spline+accurate_rnd+full_chroma_int+full_chroma_inp,xbr=2,scale=iw/2:-2:sws_flags=spline+accurate_rnd+full_chroma_int+full_chroma_inp,format=pix_fmts=rgb444le,split=2[vid][clut];[clut]palettegen=max_colors=%CLUT%:reserve_transparent=0:stats_mode=diff[out2]" -map [vid] -c:v ffv1 "%~n1_ll.mkv" -map [out2] "%~n1_CLUT%CLUT%_D.png"

@ffmpeg.exe -y -stats -hide_banner -i "%~n1_ll.mkv" -i "%~n1_CLUT%CLUT%_D.png" -lavfi "paletteuse=dither=bayer:bayer_scale=%BS%" -loop 0 -vsync 0 "%~n1_CLUT%CLUT%_D_BS%BS%.gif"

@rem  Optimizing GIF...
@gifsicle.exe -V -O3 "%~n1_CLUT%CLUT%_D_BS%BS%.gif" -o "%~n1_CLUT%CLUT%_D_BS%BS%_o.gif"

Post Reply