{"id":16105127,"url":"https://github.com/intgr/keep-on-giffing","last_synced_at":"2026-02-09T07:05:21.628Z","repository":{"id":139071103,"uuid":"138519936","full_name":"intgr/keep-on-giffing","owner":"intgr","description":"Convert videos to GIF format using FFmpeg. The gif-tool that keeps on giffing!","archived":false,"fork":false,"pushed_at":"2021-09-20T20:39:11.000Z","size":33,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-05T10:48:29.403Z","etag":null,"topics":["conversion","ffmpeg","gif","python","video"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/intgr.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-24T22:32:51.000Z","updated_at":"2024-11-04T00:28:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"f187aa97-55f5-4ef6-99d5-d02010b0e8e9","html_url":"https://github.com/intgr/keep-on-giffing","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/intgr/keep-on-giffing","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intgr%2Fkeep-on-giffing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intgr%2Fkeep-on-giffing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intgr%2Fkeep-on-giffing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intgr%2Fkeep-on-giffing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/intgr","download_url":"https://codeload.github.com/intgr/keep-on-giffing/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intgr%2Fkeep-on-giffing/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270856562,"owners_count":24657688,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-17T02:00:09.016Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["conversion","ffmpeg","gif","python","video"],"created_at":"2024-10-09T19:08:31.831Z","updated_at":"2026-02-09T07:05:21.273Z","avatar_url":"https://github.com/intgr.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Keep on Giffing (also kogif)\n============================\n\n.. pull-quote:: Is the gif-tool that keeps on giffing!\n\nKeep on Giffing is a wrapper around FFmpeg for converting video clips from any format to optimized ``.gif`` files.\nFFmpeg has excellent support for outputting optimized GIF files (optimal palette generation, dithering, scaling,\ncropping, denoising, etc) but those features are very difficult to use directly. *Keep on Giffing* to the rescue, it has\na simple command line syntax and many features for working with GIF files.\n\n.. image:: https://travis-ci.org/intgr/keep-on-giffing.svg?branch=master\n   :alt: Travis CI\n   :target: http://travis-ci.org/intgr/keep-on-giffing\n\n.. contents:: Table of contents\n    :backlinks: none\n\nTutorial\n========\n\n.. pull-quote:: Keep calm and gif on!\n\nAt its most basic, kogif simply takes video files as command line arguments and outputs those files in ``.gif`` format::\n\n    % keep-on-giffing big_buck_bunny_trailer.webm\n    Converting big_buck_bunny_trailer.webm to big_buck_bunny_trailer.gif...\n    Completed big_buck_bunny_trailer.gif (5.92MB)\n\n.. image:: https://raw.githubusercontent.com/intgr/static/master/keep-on-giffing/big_buck_bunny_trailer.gif\n\nSince the GIF format has poor compression, kogif applies some *default* restrictions already:\n\n* Clip length is **10 seconds**. (To override use ``--length=max``)\n* Frame rate is capped at **20 FPS**. (To override use ``--fps=max``)\n* Video scaled down to limit width/height to **500 pixels**. (To override use ``--scale=max``)\n* Output can have only 256 unique colors (due to limitations of the GIF file format).\n* GIF does not support audio.\n\nIt often takes some trial and error to get everything right; use ``--play`` to see the result immediately after\nconversion is finished. (Requires the ``mpv`` program)\n\nTo cut out certain part of the video, note the time codes in your video player and use ``--start`` and ``--length``\narguments. These accept seconds or HH:MM:SS.nnn format::\n\n    keep-on-giffing big_buck_bunny_trailer.webm --play --start=0:14.2 --length=3.4\n\n.. image:: https://raw.githubusercontent.com/intgr/static/master/keep-on-giffing/big_buck_bunny_clip.gif\n\nOptimization\n````````````\nTo reduce the size of the generated GIF file, there are a few tricks...\n\nPlay around with the ``--dither`` option. This determines how the limited color palette will be used in the file.\nRule of thumb: use the default (``sierra2_4a``) for fast-moving videos. Use ``--dither=bayer`` if there is static\ncontent (e.g. static background and non-moving camera angle). If that causes too much \"crosshatch\" pattern for your\ntastes then ``bayer3``...``bayer5`` will reduce that. Occasionally ``--dither=none`` leads to better results too.\n\nReduce noise using ``--ppdenoise``, or if that causes artifacts, ``--atadenoise``. This removes tiny differences across\nframes and improves the compression ratio; the difference is mostly imperceptible to the eye.\n\nIf you want to reduce the file further, try changing the values of ``--colors``, ``--fps`` and ``--scale``.\n\nWith that we have::\n\n    keep-on-giffing big_buck_bunny_trailer.webm -p -s0:14.2 -l3.4 --dither=bayer4 --ppdenoise\n\nWhich reduces the size from 3.99 MB to just 1.42 MB!\n\n.. image:: https://raw.githubusercontent.com/intgr/static/master/keep-on-giffing/big_buck_bunny_optimized.gif\n\nAdditional tuning\n`````````````````\nKeep on Giffing also allows you to crop out a portion of the original video using the ``--crop-left``, ``--crop-right``,\n``--crop-top`` and ``--crop-bottom`` arguments. For example, ``--crop-right=50`` only keeps the left half of the video.\nNote that the ``--scale`` limit is applied *after* cropping.\n\nThe video can be sped up or slowed down with ``--faster`` or ``--slower`` arguments, which also take a percentage value.\nAll together::\n\n    keep-on-giffing big_buck_bunny_trailer.webm -p -s19.9 -l4 --dither bayer4 --play \\\n        --crop-top 25 --crop-bottom 25 --slower 40\n\n.. image:: https://raw.githubusercontent.com/intgr/static/master/keep-on-giffing/big_buck_bunny_crop.gif\n\nThat's it! For the curious, the generated FFmpeg command is::\n\n    ffmpeg -y -loglevel 24 -ss 19.9 -t 4 -i big_buck_bunny_trailer.webm -filter_complex \\\n        'setpts=1.4*PTS,fps=20,crop=in_w*1.0:in_h*0.5:in_w*0.0:in_h*0.25,scale=min(iw\\,500):min(ih\\,500):\\\n        force_original_aspect_ratio=decrease:flags=lanczos,split[tmp1][tmp2];[tmp1]palettegen=max_colors=256:\\\n        reserve_transparent=off:stats_mode=diff[pal];[tmp2][pal]paletteuse=dither=bayer:bayer_scale=4' \\\n        big_buck_bunny_trailer.gif\n\n\nInstallation\n============\n\n.. pull-quote:: Gif it a chance!\n\nTested on Linux and macOS. Most Linux installations will already have the following requirements:\n\n* Python 3.5 or newer\n* FFmpeg\n* mpv (only if you want to use ``--play``)\n\n\nCredit is due\n=============\n\n* Keep on Giffing is written by Marti Raudsepp\n* Thanks to FFmpeg for doing all the actual hard work!\n* `Several \u003chttps://superuser.com/a/556031\u003e`_ `StackOverflow \u003chttps://superuser.com/a/1275521/18382\u003e`_\n  `answers \u003chttps://stackoverflow.com/a/34338901/177663\u003e`_.\n* Inspired somewhat by the `Gifcurry tool \u003chttps://github.com/lettier/gifcurry\u003e`_, by David Lettier.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintgr%2Fkeep-on-giffing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fintgr%2Fkeep-on-giffing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintgr%2Fkeep-on-giffing/lists"}