[FFmpeg-user] PNGs with transparent pixels to GIF

MediaMouth communque at gmail.com
Sun Dec 20 20:56:54 EET 2020


On Dec 20, 2020, at 7:25 AM, pdr0 <pdr0 at shaw.ca> wrote:
> 
> For gif use -vf palettegen and paletteuse to reserve 1 color for
> transparency
> 
> https://ffmpeg.org/ffmpeg-filters.html#palettegen-1
> https://ffmpeg.org/ffmpeg-filters.html#paletteuse
> 
> You can combine the two by using -filter_complex, instead of creating a
> palette png intermediate
> 
> eg.
> ffmpeg -r 12 -i toile4-4-%d.png -filter_complex
> "palettegen[PG],[0:v][PG]paletteuse" toile4.gif
> 

pdr0 -- thanks for that
Suggesting both ffmpeg & imagemagick can convert a png sequence to gif
Very cool.

Following up on the documentation links provided, I wasn't able to work out what the details of your "-filter_complex" entries were about.
I ran it against a test png seq it did work  -- I got a gif that preserved the PNG transparency -- but I got some artifacts.

Attaching both the PNG seq and the resulting GIF in PngSeq.zip (below) (hopefully it posts)
The command I used was based on your example:
> ffmpeg -i PngSeq/Frame_%05d.png -framerate 12 -filter_complex "palettegen[PG],[0:v][PG]paletteuse" PngSeq.gif

Questions:
	- What caused / how to avoid the artifacts?
	- What is PG in your example?

Thanks again.



More information about the ffmpeg-user mailing list