views:

1480

answers:

4

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!

+1  A: 

The IETF has the standard defined as RFC 2435. I don't know what codecs will support this, but this appears to be the data spec.

Kekoa
+4  A: 

Apparently there is no single specifiaction. From wikipedia:

Criticisms

Unlike the video formats specified in international standards such as MPEG-2 and the format specified in the JPEG still-picture coding standard, there is no document that defines a single exact format that is universally recognized as a complete specification of “Motion JPEG” for use in all contexts. This raises compatibility concerns about file outputs from different manufacturers.

hlovdal
I guess that would explain why it's so hard to find. Strange though since a lot of "common" cameras record in mjpeg, do they just make their specs up then?
Robert Sköld
That's the fun thing about standards - there's so many to choose from!
scraimer
A: 

MJPEG over HTTP at least has a pretty standard implementation. It is returned as a multi-part HTTP response.

See http://www.jpegcameras.com/ for some good details.

jdmichal
A: 

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.

Will