Skip to content

Animated gif writer via ffmpeg #220

Closed

Description

@almarklein

As mentioned in #219, ffmpeg can also export animated gif (ffmpeg 2.6+). Would be a nice addition. http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html

Advantages are speed and maybe quality, we'd have to do some testing to see how the paletting related to PIL's paletting. Disadvantage is that it needs the ffmpeg exe, which is not available by default (though easy enough to install using one function call).

Activity

  1. almarklein commented on May 21, 2017

    @almarklein
    MemberAuthor

    Also see #115

  2. FirefoxMetzger commented on Feb 14, 2022

    @FirefoxMetzger
    Contributor

    The pyAV plugin I am writing supports filters, so this should - in theory - be possible.

    In practice, it depends on me figuring out how to send an EOF signal to palettegen, which is the FFmpeg filter that does all the magic here. See PyAV-Org/PyAV#886 for details.

    Edit: Note that this only affects the global palette. Generating single palettes (using palettegen with stats_mode=single) works fine.

  3. FirefoxMetzger commented on Mar 5, 2022

    @FirefoxMetzger
    Contributor

    I submitted a PR to pyAV a few days back that allows sending EOF to a filter, so we will be able to use palettegen with the next pyAV release. From this point on it should be possible to generate GIF via ffmpeg, too.

  4. FirefoxMetzger commented on Mar 10, 2022

    @FirefoxMetzger
    Contributor

    pyAV released v9 recently which includes my changes to send EOF to filters (among other goodies). I've updated our pyAV plugin, and now we can indeed create GIF using ffmpeg (that use an optimized global palette):

    test

    (at the moment it's grayscale only until I work out how to handle frames with palette in pyav)

  5. linked a pull request that will close this issueFEAT: New Plugin for pyAV #745on Apr 5, 2022
  6. FirefoxMetzger commented on Apr 5, 2022

    @FirefoxMetzger
    Contributor

    And now we can do colored GIFs, too:

    test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions