Morgan M-JPEG codec V3 developer pages

Codec features ...

Codec specifications ...

Codec settings ...

DirectShow Decompressor specifications ...

  DirectShow Compressor specifications ...
Sample source code ...  
Developer forum ...  

MJPEG2000 codec: visit our MJPEG2000 LIB SDK page.

1. There's 2 APIs for programing with the codec :

Video For Windows (VFW) :

M3JPEG32.dll is a Video For Windows codec (VFW codec) it can be managed through the Video Compression Manager (VCM).

You can find information on VFW APIs at : http://msdn.microsoft.com/

VFW : http://msdn.microsoft.com/library/en-us/multimed/avifile_8dgz.asp
VCM : http://msdn.microsoft.com/library/en-us/multimed/avicomp_550y.asp

(Video Compression Manager : The Microsoft Video for Windows component that manages video codecs (compressor/decompressors). VCM can also be considered a specification for an API. A video codec must conform to VCM to work with Video for Windows.)

DirectShow :

The codec comes with two DirectShow filters

- M3JPEGdec.ax ('Morgan MJPEG Decompressor')
- M3JPEGenc.ax ('Morgan MJPEG Compressor')

You can find information on DirectShow SDK at : http://msdn.microsoft.com/DirectX/

 

2. Video For Windows samples :

Here's a standard sequence of VCM API calls for decompression :

hicd = ICOpen(ICTYPE_VIDEO, MJPG, ICMODE_DECOMPRESS);
ICDecompressBegin(hicd, lpSrcFmt, lpDecFmt);
ICDecompress(hicd, 0, lpSrcFmt, lpSrc, lpDecFmt, lpDec);
ICDecompress(hicd, 1, lpSrcFmt, lpSrc, lpDecFmt, lpDec);
ICDecompress(hicd, 2, lpSrcFmt, lpSrc, lpDecFmt, lpDec);
...
ICDecompress(hicd, n, lpSrcFmt, lpSrc, lpDecFmt, lpDec);
ICDecompressEnd(hicd);
ICClose(hicd);

Codec.c :

http://www.morgan-multimedia.com/download/codec.c

This file does not compile as-is but shows the AVIFile and VCM API structs and func to use and how to use it to compress, write to AVI, read from AVI and decompress in YUV.

CodecBench :

http://www.morgan-multimedia.com/download/codecBench.zip

CodecBench is our home made test sofware for the codec. It reads AVI files, decompress, display and compres. It uses VFW API and DirectDraw.

Avidd.cpp :

http://www.morgan-multimedia.com/download/Avidd.cpp

An older version of codecBench, maybe easier to understand.

 

3. DirectShow samples :

Full2Cif:

http://www.morgan-multimedia.com/download/Full2Cif.zip

This sample play full size M-JPEG AVI files in CIF size (Height/2xWidth/2) using the fast Full2CIF internal mode of the codec. It shows how to manage the DirectShow Decompressor via its private IIPM3JPEGdec interface (see CPlayerDoc::AddDecoderInFilterGraph in MFCDoc.cpp).

Dscap :

http://www.morgan-multimedia.com/download/Dscap.zip

Dscap is a modified version of the video capture sample of DirectX 8 SDK. Each modification is marked by // #### in the source code. The 'Capture' menu contains a 'MJPEG' section.

DV2MJPEG :

http://www.morgan-multimedia.com/download/DV2MJPEG.zip

DV2MJPEG is a transcoder from AVI DV format to AVI M-JPEG format. It only transcode the video stream.

Here's how to set compression quality :

IAMVideoCompression *pV;

...

// Query for the Video Compression Interface of the MJPEG compressor.
hr = pMJPEGComp->QueryInterface(IID_IAMVideoCompression, (void **)&pV);
if (hr != NOERROR)
{

AfxMessageBox("Problems querying IID_IAMVideoCompression. Exit !");
return -1;

}

// Here we set the MJPEG Quality
// 0 <= Quality <= 1
hr = pV->put_Quality(0.75);
pV->Release();
if(hr != NOERROR)
{

AfxMessageBox("Problems Setting Quality. Exit !");
return -1;

}

 

4. Miscelaneous sample :

MJPGtoJPG:

http://www.morgan-multimedia.com/download/MJPGtoJPG.zip

This sample application shows how to compress and save a frame in standard JPEG with the codec. Check methods CMJPGtoJPGDlg::OnCompress() and CMJPGtoJPGDlg::OnSave() in MJPGtoJPGDlg.cpp. This sample works corectly with images with heigth <= 288.

 

morgan.gif (5620 octets)