Skip to content

Instantly share code, notes, and snippets.

@samelie
Created August 24, 2015 10:28
Show Gist options
  • Save samelie/bf28262a4b757b968376 to your computer and use it in GitHub Desktop.
Save samelie/bf28262a4b757b968376 to your computer and use it in GitHub Desktop.
A flawless way whereyou can just spit gifs out images, video, very easy. Mac only :(
----------- 1 ----------------
-First you need to open Terminal.app
(Spotlight > terminal)
- past this in and press enter: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
(this command install a package manager that lets you install two packages into your machine; they're not too big >.< )
----------- 2 ----------------
Once done paste this in: sudo brew install ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-frei0r --with-libass --with-libvo-aacenc --with-libvorbis --with-libvpx --with-opencore-amr --with-openjpeg --with-opus --with-openssl --with-rtmpdump --with-schroedinger --with-speex --with-theora --with-tools --with-x265 --with-faac --with-lame --with-x264 --with-xvid
(if this complains, try removing the 'sudo')
----------- 3 ----------------
Once this is done, paste this in: sudo brew install imagemagick
(if this complains, try removing the 'sudo')
----------- NOW WE PLAY ----------------
--------- folder of images to gifs---------
They will appear in the order within the folder.
-Using the Terminal app, type: cd <and a space after>
-Drag the folder with all the images from finder into Terminal
=== The following command will shrink your images to reduce gif file size if you have a LOT of images, OPTIONAL ==
-Paste this: for i in *.jpg; do convert $i -strip -interlace Plane -gaussian-blur 0.01 -quality 70% $i.jpg; done
(This command will overwrite all your images, so have backups)
(this command assumes all your images are jpg's: you can convert an image to another format like this (in Terminal, in the right folder), eg : jpg > png : convert <example.jpg> <output.png>)
== MAIN IMAGES TO GIF COMMAND ==
---(this command assumes all your images are jpg's: you can convert an image to another format like this (in Terminal, in the right folder), eg : png > jpg : convert <example.png> <output.jpg>) ---
-Using the Terminal app, type: cd <and a space after>
-Drag the folder with all the images from finder into Terminal
-Paste this into Terminal and enter: convert -delay 6 -loop 0 *.jpg animation.gif
(This will take all the jpgs and make a gif. Play with the delay value for speed. Also change the name from 'animation' to whatever)
--------- video to gifs---------
What I like to do here is extract chunks of video out and make that into a gif.
ffmpeg -ss 221 -i <myVideo>.AVI -codec:v libx264 -t 2.4 -vf scale=-1:480 -y -pix_fmt yuv420p -filter:v lutyuv="y=gammaval(1)" out.mov
(-ss means 'seek to 221 seconds')
(-i is the video file you are using)
(-t is the duration of the video , 2.4sec will produce a 2MB gif)
( that gammeval is a way to brighten a video, 1 is no change, lower the brighter...)
(outputs a video called out.mov, change if you want)
--- this makes the gif ----
ffmpeg -i out.mov -r 14 myGif.gif
(-r is a kind of framerate, play with it)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment