How to convert a GIF file to a AVI file?

40 views (last 30 days)
I want to convert a GIF file to a video file (AVI or mp4). How can I do that using MATLAB?
Anjan Goswami
Anjan Goswami on 26 May 2020
Edited: Anjan Goswami on 26 May 2020
Sorry sir, I have gone through the example loop but it is not convincing for my case. The number of images was already mentioned as Eight in the example. However, how can I know the number of images of my gif animation. Also, are you recommending to use im2frame to convert the images of the gif animation to movie frames and then calling all frames to write a video? Sorry for my ignorance.

Sign in to comment.

Accepted Answer

Adam Danz
Adam Danz on 26 May 2020
I've written a function that converts GIF --> AVI based on Walter's 2018 answer.
gif2avi(file) will convert the gif file to avi and will save it to your current directory. See the documentation for that function for additional inputs.
Let me know if you have an problems.

Sign in to comment.

More Answers (0)


Find more on Convert Image Type in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by