Skip to content
Convert images to movie and gif using ImageMagick and FFmpeg [Hacktoberfest 😎]
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Simply run the npm script command

Only if you are using MacOS and you have brew installed (you really should).

  • npm run download
  • ./ffmpeg

Or install ImageMagick and FFmpeg manually

1. Install ImageMagick in MacOs through brew

  • Open terminal and run the command: brew install ImageMagick

2. Download static build of ffmpeg

  • Download and unzip static build zip file
  • Open terminal
    • Go into ffmpeg/bin folder you can use ffmpeg by running the command: ./ffmpeg

Convert images to video (mov)

Using FFmpeg

  • ./ffmpeg -framerate 10 -i ./images/00%2d.png -vcodec png

Convert images to gif

Using ImageMagick

  • convert -dispose previous -delay 10 -loop 0 ./images/*.png animate.gif

Convert gif to video (mp4)

Using FFmpeg

  • ./ffmpeg -i ./gif/animate.gif -f mp4 -pix_fmt yuv420p animate.mp4

Convert mp4 to gif

Using FFmpeg

  • ./ffmpeg -i animate.mp4 -f gif animate.gif

Convert movie (mov) to images

Using FFmpeg

  • ./ffmpeg -i -f image2 image-\%d.png

Convert movie (mov) to movie (mp4)

Using FFmpeg

  • ./ffmpeg -i -vcodec h264 -acodec mp2 animate.mp4

Resize image/gif/video and keeping its aspect ratio

Using FFmpeg

  • ./ffmpeg -i animate.gif -vf scale=500:-1 animate-500px.gif


This example uses image type png, you can simply change to other image type by replacing png to jpg.

You can’t perform that action at this time.