How To Convert Animated .gif Into .webm Format In Python?
I have a web application built on Django where images and animated Gif can be uploaded. However GIF takes long time to load. I was thinking of converting all uploaded gif into webm
Solution 1:
With MoviePy:
import moviepy.editor as mpclip= mp.VideoFileClip("mygif.gif")
clip.write_videofile("myvideo.webm")
You can also use any other format (mp4, ogv, etc) and add parameters like bitrate='5000k' or any other parameter supported by FFMPEG. You can also use ffmpeg directly for the conversion instead of moviepy, it will be slightly faster.
Post a Comment for "How To Convert Animated .gif Into .webm Format In Python?"