Relative Content

Tag Archive for pythonpython-imaging-librarygifanimated-gif

Losing audiovisual sync when processing an animated GIF with ImageIO and PIL

I am trying to chromakey a GIF and the result is weird. The GIF should have a framerate of 30 FPS, but when I put the chromakeyed and transparent frames back together the GIF isn’t what it should be. The GIF displays a waveform which should sync up to a specific song. When I play the input GIF under the waveform it does sync up correctly, the output GIF does not. It feels like it’s to fast, or even the frames are not in order. It is hard to describe but the GIF changes rapidly, the “loudness” of the waveform starts earlier than the song gets “loud”. This is the code I am using to chromakey and save the frames.

Chromakeying a GIF and saving its frames using python

I am trying to chromakey a GIF and the result is weird. The GIF should have a framerate of 30 FPS, but when I put the chromakeyed and transparent frames back together the GIF isn’t what it should be. This is the code I am using to chromakey and save the frames.

How to set the animation speed of a transperent GIF using python

I made a python script that takes a GIF, chromakeys each of its frames and saves them in a folder. Those frames now contain transparency and are PNGs. But i don’t know how to make a GIF from transparent frames using python, every time i try the framerate (which should be 30 FPS) is off. At least i think so because if i check the GIF metadata the duration and frame count is correct. But the GIF should be synced to music, but when i play the song under the GIF it doesn’t sync up at all. The frames were derived from a non transparent GIF which was derived from a video. Both the video and non transparent GIF do however sync up with the music.
I will attach a clip of the GIF below as the GIF is too large to upload.
Thank you in advance!