Skip to main content

A python package and CLI to turn videos into GIFs and vice-versa.

Project description

A powerful, versatile and simplistic FOSS python package and CLI to turn videos into GIFs and vice-versa.

GitHub PyPI GitHub repo size GitHub GitHub

Usage

You can use FIG's built-in CLI to convert videos to GIFs through the Command-Line.

Usage: fig.py [OPTIONS] FILENAME                                              
                                                                              
Options:                                                                      
  -o, --output TEXT               Output filename                             
  -g2v, --gif2video               Convert a gif to a video (options:          
                                  dithering, low-quality, shit-optimize,      
                                  ffmpeg are disabled)                        
  -w, --width INTEGER             Width of the gif (must be 16 or bigger)     
  -fr, --fps-reduction INTEGER    Divide fps by this number (must be bigger   
                                  than 0 and can't be bigger than the original
                                  fps)                                        
  -lq, --low-quality              Prioritize speed and size over quality      
  -dd, --disable-dither           Disable dither to increase quality but cause
                                  color banding (disables low-quality)        
  -so, --shit-optimize            Optimize the gif but change it to 256 colors
                                  (requires gifsicle)                         
  -f, --ffmpeg                    Use ffmpeg for higher quality conversion    
                                  (requires ffmpeg) (enables dithering)       
  -t, --text TEXT                 Text to add to the gif                      
  -ts, --text-style [top|bottom|caption]                                      
                                  Style of text to add to the gif
  -v, --version                   Show the version and exit.
  --help                          Show this message and exit.

Or you could use FIG as a Python package.

import figconverter

figconverter.video2gif("myvideo.mp4")  # Convert video to GIF
figconverter.gif2video("myvideo.gif")  # Convert GIF to video

Installation

pip install fig-converter
  • In order to use the shit-optimize option you'll need to install gifsicle:

    While running the installation, on MacOS the setup will automatically install gifsicle using Brew.

    On Linux you will need to install gifsicle using apt-get as follows:

    sudo apt-get install gifsicle
    

    On Windows you will need to download and install the correct port of the library for your OS.

  • In order to use the ffmpeg option you'll need to install FFmpeg:

    There are a variety of ways to install FFmpeg, such as the official download links, or using your package manager of choice (e.g. sudo apt install ffmpeg on Debian/Ubuntu, brew install ffmpeg on OS X, etc.).

    Regardless of how FFmpeg is installed, you can check if your environment path is set correctly by running the ffmpeg command from the terminal, in which case the version information should appear, as in the following example (truncated for brevity):

    $ ffmpeg
    ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
      built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
    

    Note: The actual version information displayed here may vary from one system to another; but if a message such as ffmpeg: command not found appears instead of the version information, FFmpeg is not properly installed.

Comparison

Comparison against shitty online GIF conversion tools

All GIFs are available in the gif_comparison folder for you to compare.

All of the information here was submitted in a survey.

Time Size Quality Easy To Use Versatile Ads Worked
FIG 8s (Fastest) 15.3MB (With Certain Settings FIG Can Reach 5.7MB) 9/10 (Highest Quality) Yes Yes (Most Versatile) 0 Yes (Most Worked)
ezgif.com 10s 16.4MB 8/10 Yes Yes 4 Yes
cloudconvert.com 10s 5.17MB (Smallest) 4/10 No No 0 Yes
veed.io 0 No
image.online-convert.com 13s 5.7MB 5/10 Yes Kinda (no FPS option) 3 Yes
convertio.co 15s 46.8MB (No Option to Change Resolution) 4/10 Yes No 2 Yes
img2go.com 13s 5.7MB 5/10 Yes No 2 Yes
create.vista.com 16s 14.4MB 8/10 Yes Yes 0 Yes
onlineconverter.com 8s 5.17MB (Smallest) 4/10 No No 3 Yes

About Us

We are a duo of independent university students and professional programmers who love contributing to the world of FOSS. Our goal is to improve our skills as developers and to make the world a better place by replacing shitty online GIF conversion tools with FOSS.

Credits

  • opencv-python (Special Thanks! Super Fast)
  • click (Special Thanks! Made Our CLI Amazing)
  • numpy (Special Thanks! Awesome Work)
  • pygifsicle
  • gifsicle
  • Pillow (Special Thanks! Great Project)
  • more-itertools (Special Thanks! Keep Up The Good Work)
  • tqdm (Special Thanks! Made Our CLI SOO Much Better)
  • imageio (Special Thanks! Cheers)
  • FFmpeg (Special Thanks! Amazing Project)
  • cpython (Special Thanks! Couldn't Have Done This Without You)
  • FIG (Super Mega Special Special Thanks!!! One Of The Best FOSS Projects Out There)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fig-converter-2.8.0.tar.gz (9.3 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page