Staaarter

GIF to AVI Converter

Decodes every frame of an uploaded GIF, encodes each one as a real JPEG image via the browser's canvas, and muxes them into a hand-rolled but genuinely valid RIFF/AVI container using the Motion-JPEG codec: verified during development with ffprobe (correct codec/dimensions/frame count) and ffmpeg (correct frame extraction). A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-29
By Staaarter Team
convertervideogif

Overview

Introduction

This tool converts an animated GIF into a genuine, playable AVI video file using the Motion-JPEG codec, one of the few video conversions in this category that's actually achievable entirely from scratch, in the browser.

Unlike this category's honest refusals for MP4, MKV, MOV, and WMV (all of which need a full modern video codec this project can't implement), AVI's RIFF container plus Motion-JPEG needs only a JPEG encoder, which every browser already provides.

What Is GIF to AVI Converter?

A real AVI muxer: it takes every frame your browser encodes as JPEG and wraps them in a hand-rolled but spec-following RIFF container using the well-documented Motion-JPEG ('MJPG') video codec tag.

It is not a video re-encoder in the modern sense: it doesn't do inter-frame compression or motion estimation; every frame is independently JPEG-compressed, exactly like Motion-JPEG has always worked.

How GIF to AVI Converter Works

The GIF is decoded with this category's shared GIF89a codec, fully compositing every frame (respecting disposal methods) into flat RGBA pixel buffers, alongside each frame's original delay.

Each composited frame is painted onto a canvas and encoded as real JPEG bytes via canvas.toBlob('image/jpeg'). Those JPEG byte strings are then wrapped by a hand-rolled function into AVI's RIFF structure: a main header, a video stream header declaring the MJPG codec, a movi list holding one 00dc chunk per frame, and an idx1 index for seeking.

When To Use GIF to AVI Converter

Use it when you need a genuinely playable video file from a GIF, and Motion-JPEG's larger file size (compared to modern codecs) is an acceptable tradeoff for something that actually works without a server-side encoder.

Don't use it if you need small file sizes or modern H.264/HEVC compatibility: for that, a real tool like ffmpeg outside the browser is the right choice.

Features

Advantages

  • Produces a genuinely valid, playable AVI file, not a container with fake or missing video data.
  • Verified for real during development against ffprobe (correct codec/dimensions/frame count) and ffmpeg (correct frame extraction, correct frame order, correct colors), not just unit-tested in isolation.
  • Runs entirely client-side using the browser's own JPEG encoder; nothing is uploaded to a server.

Limitations

  • Motion-JPEG produces noticeably larger files than modern video codecs (H.264/HEVC/AV1), since every frame is independently compressed with no inter-frame prediction.
  • AVI's main header only supports one constant frame rate; per-frame delay variation in the source GIF is flattened to the average across all frames.
  • Very old or unusual AVI players may expect stricter conformance than this hand-rolled muxer implements beyond what was verified (a correctly-structured hdrl/movi/idx1 layout); most modern players (including ffmpeg-based ones) handle it correctly.

Examples

Converting a 4-frame animated GIF

Input

banner.gif (4 frames, 64x48, delays: 20cs/25cs/30cs/35cs)

Output

converted.avi (RIFF/AVI, MJPG codec, 4 frames, constant rate averaged to 27.5cs/frame)

Verified during development: ffprobe reported codec_tag_string=MJPG, width=64, height=48, nb_frames=4, and ffmpeg extracted 4 correctly-colored, correctly-ordered PNG frames from the output.

Best Practices & Notes

Best Practices

  • Expect larger file sizes than the source GIF for longer or higher-resolution animations, since Motion-JPEG has no inter-frame compression.
  • If your source GIF has very different delays per frame, be aware the AVI output will play at one averaged constant speed.
  • Test playback in your target player if you have unusual compatibility requirements: mainstream players (VLC, ffplay, most OS-native players) handle Motion-JPEG AVI correctly.

Developer Notes

buildMotionJpegAvi hand-writes the RIFF/AVI structure byte-for-byte: a 'hdrl' LIST containing the 56-byte MainAVIHeader ('avih') and a nested 'strl' LIST with the 56-byte AVIStreamHeader ('strh', fccHandler='MJPG') and 40-byte BITMAPINFOHEADER ('strf', biCompression='MJPG'), followed by a 'movi' LIST of '00dc' chunks (one real JPEG per frame) and an 'idx1' index. dwMicroSecPerFrame/dwRate/dwScale are derived from the average of the source GIF's per-frame delays. This was verified with real ffprobe/ffmpeg runs during development, not just internal round-trip tests against this category's own avi-to-gif-converter.ts parser.

GIF to AVI Converter Use Cases

  • Getting a genuinely playable video file out of an animated GIF for use in software that doesn't accept GIF as a video format
  • Producing a video file entirely client-side, with no server-side ffmpeg dependency
  • Testing round-trip fidelity by converting a GIF to AVI and back with avi-to-gif-converter

Common Mistakes

  • Expecting file sizes as small as a modern H.264 MP4: Motion-JPEG is much less efficient, by design of this tool's honest scope.
  • Assuming per-frame GIF delays are preserved exactly; they're averaged into one constant AVI frame rate.

Tips

  • If you need smaller output and don't need it produced client-side, ffmpeg's H.264 encoder will always produce a smaller file than this Motion-JPEG approach.
  • Pair with avi-to-gif-converter to round-trip check that your AVI's frames come back looking right.

References

Frequently Asked Questions