Making Animated GIF Image from a Video Scene

– people who like to create animated GIF from video scenes using free softwares
– windows os (operating system) user
– basic familiarity with windows command prompt
– you need the following
MPlayer on windows –
Gimp – (i choose the portable version)
AnimStack –
– then put mplayer.exe on a directory for this example will put them all to “C:\” directory
– then install gimp portable somewhere for example on “C:\” too
– then put the AnimStack filter file “animstack.scm” inside the Gimp Scripts directory by going to
GIMPPortable folder -> Data folder -> .gimp folder-> scripts folder
the basic idea is to use mplayer to extract the frames/images of the video scene
then use GIMP to compile the extracted frames/images to an animated GIF with the help of AnimStack plugin that will
efficiently delete duplicate frames/images, since the lesser the frames the faster
the animation of the GIF will be and it will have lower filesize output too, the details of how 
to do that are below
now lets use mplayer to extract every frame of the video scene,
put this commandlines on a .bat file, to do that open notepad and copy & paste this
mplayer "[gg]_Chuunibyou_Demo_Koi_ga_Shitai!_-_01_[5B6EFD1F].mkv" -ao null -ss 00:05:22 -endpos 15 -vo png:z=9:outdir=out -vf pp=al,scale=-3:240
*** [gg]_Chuunibyou_Demo_Koi_ga_Shitai!_-_01_[5B6EFD1F].mkv is the filename of the video source so change it accordingly
*** -ss 00:05:22 (the format is “hours:minutes:seconds”) is the starting time of the video scene you want to make GIF with, so to find the starting time of a video just play it with your media player and then remember the times then change the 00:05:22 example accordingly
*** -endpos 15 means 15 seconds duration beginning from the starting time or -ss so just change that 15 seconds accordingly
*** scale=-3:240 is the resolution output of the images (or frames) the -3 number is a constant value that means the Width will be automatically calculated according to the Height value which is 240 (or 240p) in this example, you can set higher resolutions like 360 or 480 or 720 but the higher the resolution means the higher the filesize will be of the outputted frames/images and the animated GIF later on, so choose the value accordingly
*** the output folder is named “out” on this command-line indicated by the command “outdir=out
– now save this as a “extract-frames.bat” for example and then double click it to run it
– a command prompt showing the progress will appear and after its done just close it and
  go to the “out” folder on thesame directory in this case the “C:\”, you will see a lot of
  images on the “out” folder 
– now open GIMP and do this 
– click menu File -> Open as Layers -> select all the images on the “out” folder (in this example the “out” folder is located on the “C:\”)
NOTE: when opening the images, “Name” column sorting arrow should be up, the triangle looking arrow besides the “Size” column should be pointing upwards (to sort the images from first down to last and when it opens as layers it will be sorted from last down to first), after sorting it accordingly just select all the images or use the keyboard shortcut “Ctrl+A” and then click “Open” button
– rename 1st layer (starting from lower numbered layer, this should be the very bottom layer) to [delete:2:1] where 2-1 will remove 1 duplicate frame/layer

– then go to menu Filters -> Animation -> Process AnimStack Tags, and watch the layers decrease (hence increasing speed of GIF playback)

after that test the animation by going to menu Filters -> Animation -> Playback
if the animation is a little to slow that means you have to delete more frames so do the whole process of deleting frames again and afterwards check the animation via the playback option, i ended up with 78 remaning layers by running the [delete:2:1] process 2 times as seen on the screenshot below

– then now go to menu Image -> Mode -> Indexed -> select optimize to 255 colors and set the dithering option to “Floyd-Steinberg (reduced color bleeding)” as well as checking “Enable dithering of transparency” and then click “Convert” button

after the conversion process is finished just then go to menu File -> Export -> rename to “sample.gif” and then save in the “Desktop” and then save as gif and then click “Export” button

now check animation and set it as loop forever and then set 10ms for all layers/frames and then check other option you think its needed and after that click “Export” button 

and your done making an animated GIF

Leave a Reply

Your email address will not be published. Required fields are marked *