What is the specifications for Motion JPEG?

Robert Sköld picture Robert Sköld · May 19, 2009 · Viewed 25.8k times · Source

I've been googling like mad and can't find any file format specifications for mjpeg.

What should the header look like? Do i just append a series of jpegs after the header?

I know it's the usually in the .avi container, does that have a standardized format for codecs that might be in it?

The goal is to make it in actionscript 3, but other languages would be good to port from. I've tried looking at ffmpeg and mplayer but c is not my strong side (yet).

Any suggestions would be appreciated!

Answer

Will picture Will · Dec 18, 2009

There isn't an official standard.

In practice, in its simplest form, an mjpeg is just a concatenation of jpeg files, one after the other in the same file.

ffmpeg supports this using the -f mjpeg or -vcodec mjpeg switches.

JPEG decoders that decode multiple images should remember and use the same jpeg tables for subsequent images if those images fail to provide replacements. The jpeg standard describes this as 'abbreviated jpeg streams', and libjpeg supports this.

So an mjpeg might contain a full jpeg image, and then subsequent SOI..EOI blocks that do not specify those headers that are duplicates to the previous frame.