M-JPEG codec V3 developer pages
Codec features ...
Codec settings ...
|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 :
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.)
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);
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 is our home made test sofware for the codec. It reads AVI files, decompress, display and compres. It uses VFW API and DirectDraw.
An older version of codecBench, maybe easier to understand.
3. DirectShow samples :
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 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 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 :
// 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 !");
// Here we set the MJPEG Quality
// 0 <= Quality <= 1
hr = pV->put_Quality(0.75);
if(hr != NOERROR)
AfxMessageBox("Problems Setting Quality. Exit !");
4. Miscelaneous sample :
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.