diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..db71aa1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/.idea +sample.mp4 +sample.gif diff --git a/README.md b/README.md index 63883de..61a3255 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,18 @@ # video2gif - A batch script for convert video to GIF files by FFmpeg.exe on Windows +A batch script for convert video to GIF files by FFmpeg.exe on Windows + +## Installation +* Clone the repo +* Install [FFmpeg](http://ffmpeg.zeranoe.com/builds/) for Windows. +* Make sure the `ffmpeg.exe` and `video2gif.bat` are on your systems path. + +## Usage +Anywhere you can use it be like this example: +``` +video2gif myvideo.mp4 +``` +Then you have `myvideo.gif` in current directory. +If `myvideo.gif` there is existed, question from you for overwrite it. + +## Tips +Special thanks to [this article](http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html). diff --git a/video2gif.bat b/video2gif.bat new file mode 100644 index 0000000..945419e --- /dev/null +++ b/video2gif.bat @@ -0,0 +1,10 @@ +@echo off +rem by: nabi karamalizadeh +rem description: video to gif converter +rem version: 0.0.1 +rem license: The MIT License (MIT) +set arg1=%1 +set arg2=%arg1:~0,-4% +ffmpeg -y -i %arg1% -vf fps=15,scale=-1:-1:flags=lanczos,palettegen %TEMP%\palette.png +ffmpeg -i %arg1% -i %TEMP%\palette.png -filter_complex "fps=10,scale=-1:-1:flags=lanczos[x];[x][1:v]paletteuse" %arg2%.gif +del /f %TEMP%\palette.png