I am trying to find some way for converting GIF to mp4 using Python or library. I didn't found any solution for it. I found a library for generating gifs from videos but not the other way round.
Can anyone please give me some information on how to do it.
Try MoviePy:
import moviepy.editor as mp
clip = mp.VideoFileClip("mygif.gif")
clip.write_videofile("myvideo.mp4")
If you don't have MoviePY installed then first install it:
pip install MoviePy
There are many ways to do this. Relatively simple way is to use ffmpeg
. There are many python bindings. ffmpy
is one of them. Please check here for the documentation. Basic example:
Installation:
pip install ffmpy
Usage:
>>> import ffmpy
>>> ff = ffmpy.FFmpeg(
... inputs={'input.gif': None},
... outputs={'output.mp4': None}
... )
>>> ff.run()
Again, there are many other ways to do this. Please find the related references here:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With