2023-08-14 11:03:25 -04:00
# vid2ani
2017-04-23 02:33:56 -04:00
2024-11-16 07:39:10 -05:00
*Video to GIF/APNG/WEBP converter*
2023-08-13 05:40:34 -04:00
![sample gif file generated ](sample.gif )
2023-08-11 17:27:31 -04:00
A batch script for converting video files to GIF/APNG/WEBP using FFmpeg on Windows.< br >
2017-04-23 02:33:56 -04:00
2024-11-16 07:39:10 -05:00
By MDHEXT, Nabi KaramAliZadeh, Pathduck
2017-04-22 20:05:13 -04:00
2023-08-11 17:12:10 -04:00
## Installation
2017-04-22 20:05:13 -04:00
* Clone the repo
2021-09-24 13:11:31 -04:00
* Install [FFmpeg ](https://www.ffmpeg.org/download.html#build-windows ) for Windows.
2023-08-11 17:12:10 -04:00
* Make sure that the path to `ffmpeg.exe` is
[configured in your system environment variables control panel ](https://www.wikihow.com/Install-FFmpeg-on-Windows )
2023-08-14 11:03:25 -04:00
or that you run the `vid2ani.cmd` file in the same folder as `ffmpeg.exe` .
2017-04-22 20:05:13 -04:00
2023-08-11 17:12:10 -04:00
## Usage
2017-04-22 20:05:13 -04:00
```
2023-08-14 11:03:25 -04:00
vid2ani [input_file] [arguments]
2017-04-23 01:54:26 -04:00
```
2023-08-11 17:12:10 -04:00
## Arguments
2017-04-23 01:54:26 -04:00
```
2024-11-11 08:19:14 -05:00
-t Output file type.
Valid: 'gif' (default), 'png', 'webp'.
2024-11-16 07:39:10 -05:00
2023-08-20 10:20:16 -04:00
-o Output file.
The default is the same name as the input video.
2024-11-16 07:39:10 -05:00
2023-08-20 10:20:16 -04:00
-r Scale or size.
2023-08-11 17:12:10 -04:00
Width of the animation in pixels.
The default is the same scale as the original video.
2024-11-16 07:39:10 -05:00
2024-11-11 08:19:14 -05:00
-s Start time of the animation (HH:MM:SS.MS)
2024-11-16 07:39:10 -05:00
2024-11-11 08:19:14 -05:00
-e End time of the animation (HH:MM:SS.MS)
2024-11-16 07:39:10 -05:00
2023-08-20 10:20:16 -04:00
-f Framerate in frames per second.
2023-08-11 17:12:10 -04:00
The default is 15.
2024-11-16 07:39:10 -05:00
2023-08-20 10:20:16 -04:00
-d Dithering algorithm to be used.
The default is 0 (None).
2024-11-16 07:39:10 -05:00
2024-11-11 08:19:14 -05:00
-b Bayer Scale setting.
2023-08-11 17:12:10 -04:00
This can only be used when Bayer dithering is applied.
2024-11-11 08:19:14 -05:00
Range 0 - 5, default is 2.
2024-11-16 07:39:10 -05:00
2024-11-11 08:19:14 -05:00
-m Palettegen mode - one of 3 modes listed below.
The default is 1 (diff).
2024-11-16 07:39:10 -05:00
2023-08-20 10:20:16 -04:00
-c The maximum amount of colors useable per palette.
2024-11-11 08:19:14 -05:00
Range 3 - 256 (default)
2024-11-16 07:39:10 -05:00
2024-11-11 08:19:14 -05:00
-k Enables paletteuse error diffusion.
2024-11-16 07:39:10 -05:00
2024-11-11 08:19:14 -05:00
-l Enable lossy WebP compression and quality.
The default for WebP is lossless.
Range 0 - 100, default 75.
2024-11-16 07:39:10 -05:00
2024-11-11 08:19:14 -05:00
-v Set FFmpeg log level, for troubleshooting.
The default log level is 'error'
2024-11-16 07:39:10 -05:00
2023-08-11 17:12:10 -04:00
-p Opens the resulting animation in your default Photo Viewer.
2024-11-11 08:19:14 -05:00
Dithering Modes:
2023-08-20 10:20:16 -04:00
0: None
2021-12-10 16:08:28 -05:00
1: Bayer
2: Heckbert
3: Floyd Steinberg
4: Sierra2
5: Sierra2_4a
2023-08-13 05:40:34 -04:00
6: sierra3
7: burkes
8: atkinson
2023-08-11 17:12:10 -04:00
2024-11-11 08:19:14 -05:00
Palettegen Modes:
1: diff - only what moves affects the palette
2: single - one palette per frame
3: full - one palette for the whole animation
2021-12-10 16:08:28 -05:00
About Bayerscale:
2023-08-11 17:12:10 -04:00
When bayer dithering is selected, the Bayer Scale option defines the
scale of the pattern (how much the crosshatch pattern is visible).
A low value means more visible pattern for less banding, a higher value
means less visible pattern at the cost of more banding.
2017-04-23 01:54:26 -04:00
```
2023-08-11 17:12:10 -04:00
## Examples
2017-04-23 01:54:26 -04:00
```
2023-08-14 11:03:25 -04:00
vid2ani sample.mp4
vid2ani sample.mp4 -t png
2024-11-11 08:19:14 -05:00
vid2ani sample.mp4 -t webp -l 50
2023-08-14 11:03:25 -04:00
vid2ani sample.mp4 -f 20 -r 450
2024-11-11 08:19:14 -05:00
vid2ani sample.mp4 -s 5:40 -e 5:45
2023-08-14 11:03:25 -04:00
vid2ani sample.mp4 -o babydance -m 2 -k -b 3
2017-04-23 01:54:26 -04:00
```
2017-04-22 20:05:13 -04:00
## Tips
2023-08-11 17:30:22 -04:00
This tool uses ffmpeg, you can download that here: [FFmpeg Windows builds ](https://www.ffmpeg.org/download.html#build-windows )< br >
2024-11-16 07:39:10 -05:00
You can download this fork from here: [Pathduck/vid2ani ](https://github.com/Pathduck/vid2ani )< br >
You can download the original release here: [MDHEXT/video2gif ](https://github.com/MDHEXT/video2gif )< br >
2023-08-11 17:30:22 -04:00
This tool wouldn't be possible without the research listed here: [High quality GIF with FFmpeg ](https://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html )< br >