Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Animated gif writer via ffmpeg #220

Closed
almarklein opened this issue Feb 6, 2017 · 5 comments · Fixed by #745
Closed

Animated gif writer via ffmpeg #220

almarklein opened this issue Feb 6, 2017 · 5 comments · Fixed by #745

Comments

@almarklein
Copy link
Member

almarklein commented Feb 6, 2017

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).

@almarklein
Copy link
Member Author

Also see #115

@FirefoxMetzger
Copy link
Contributor

FirefoxMetzger commented Feb 14, 2022

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.

@FirefoxMetzger
Copy link
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.

@FirefoxMetzger
Copy link
Contributor

FirefoxMetzger commented Mar 10, 2022

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)

@FirefoxMetzger FirefoxMetzger linked a pull request Apr 5, 2022 that will close this issue
@FirefoxMetzger
Copy link
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants