The MJPEG-Software-Codec Guide
What on earth is a codec ? (Or how does my RainbowRunner work
?)
If you want to process a video, you first have to record/capture to a
digital video file. With the RR you can choose between recording to a RGB-avi or
to a Matrox-MJPG-avi file. The result of your capturing is a video file in the
AVI-format with RGB or MJPEG as subformat. The RGB format is a format where the
picture data keep uncompressed. On the one hand this means best quality, but on
the other hand you have a very high data-rate during capturing/playing and the
files are very large. The pictures of MJPEG-avi files are compressed and because
of that this format is the better way for us to handle video-files on our PC.
The files need less place on the harddisk and even the data-throughput
between harddisk and RR is smaller. Well ok, the quality is less, too, but we
can choose our compromise between quality and disk-space ourself.
The compression is done during capturing in realtime by a Zoran-chip on the
RR. Your captured video file contains an identifier (called FourCC) in it´s
header that shows the subformat. For Matrox-MJPEG the identifier tag is
"dmb1". If you open a avi file, the Video-for-Windows routines examine
the avi file header and read this identifier tag at first.
Then they have a
look in the system.ini to the [drivers32] section and watch the VIDC.xxxx
settings to see which driver must be used to process the file.
The
Matrox-MJPEG-codec can be found at VIDC.dmb1=....RRicm.dll. Whenever you want to
play a Matrox-MJPEG-avi with the MediaPlayer or you want to process it with any
video-editing software, this driver ,called codec, will be activated for
decompressing the pictures.
After processing your avi, when creating a new
avi, the video-editing software lets you choose one of the VIDC.xxxx codecs to
(re)compress the data.
The identifier-tag of that codec will be written into
the avi´s file-header. If you compress (and save) your file with the
Matrox-MJPEG-codec the id-tag is "dmb1" again, but if you have chosen
e.g. the "Indeo 5.0"-codec, the id-tag will be "IV50".
Interesting excursion: If you disable the VIDC.dmb1 setting by inserting a
semicolon before it´s entry in the system.ini, the video-editing software
will still be able to handle avi-files with the dmb1-tag, and both the
ActiveMovie-Player and the Matrox PC-VCR software can play and output those
files ! We even can record avis with the PC-VCR and other capture programs
without the system.ini entry.
OK, let us draw some conclusions. Whenever we record a MJPEG-avi file with
the RR it contains the dmb1 tag independent of any system.ini settings.
The
ActiveMovie-routines (and all programs making use of them like Matrox PC-VCR,
MediaStudio 5, etc.) use the hardware decompression (Zoran-chip) for all
MJPEG-compressed avi files containing the dmb1 (Matrox) tag independent of any
system.ini settings, too. Let´s keep in mind that the MJPEG-format is a standard
format and not a special Matrox format.
Why should I use another codec ?
If you are satisfied with your system and with the results of your work
with the RR, I guess there is no need to change the system.
The Morgan- and the Paradigm-codec produce MJPEG-avi files (with a higher
quality and certainly higher data-rate if you want). If your system is fast
enough, you can improve the quality of your videos and reduce artefacts. Some
actions are faster with those codecs and some not...
I recommend to use the
Morgan Multimedia codec because of it´s better quality. You have many
possibilities to influence the performance and quality of this codec by choosing
between different numerical methods and activating hardware support (MMX,
3Dnow).
There are two groups of RR-users who should use one of the software codecs.
Windows NT users and users of a Millennium II+RR having trouble with the
"snowy-frames" problem. Windows NT users suffer from the NT-driver´s
lack of MJPEG-support. With the software-codecs they get the possibility to
process and playback their MJPEG-videos in NT. They still have to record the
MJPEG-videos with Windows 9x.
The "snowy-frame" problem is a bug
in the Matrox-MJPEG-codec, which appears on some Millennium II+RR systems. If a
program opens a Matrox-MJPG avi and get´s the pictures to recompress them or to
show them in the timeline (MSP5/Premiere) the codec produces corrupted (snowy)
frames although the avi-file is ok.
There are some different ways to install the drivers depending on your needs.
At first you have to install the additional codec(s). (Paradigm: Do not use
the secondary setting.)
After that you have many possibilities how to
combine the codecs in your system.
You can replace the Matrox-codec by the Morgan-codec (recommended
method)
You must make the following changes to the system.ini:
[drivers32]
vidc.mjpg=m3jpeg32.dll
;VIDC.dmb1=C:\PROGRA~1\MATROX~1\RAINBO~1\RRIcm.dll
The driver´s "user FourCC"-field must be
enabled and set to "dmb1". After that you can work with your RR like
before but without "snowy-frames" and with better quality
("Integer" or "Float" method for "Compression" in
Morgan codec settings and "Higher Quality" in Paradigm codec settings)
. You don´t have to patch any avi-files. Avi-files played with ActiveMovie,
Matrox PC-VCR or MSP5 (best Preview) make use of the RR´s hardware-accelleration
and can be recorded on tape etc.
You can replace the Matrox-codec by the Paradigm-codec
You must make the
following changes to the system.ini:
[drivers32]
vidc.dmb1=pmmjpeg.dll
;VIDC.dmb1=C:\PROGRA~1\MATROX~1\RAINBO~1\RRIcm.dll
And you must make an additional entry to the registry with regedit:
Path: HKEY_CURRENT_USER\Software\Paradigm Matrix\Software
M-JPEG Codec
Entry: Compress FourCC=31626d64 (hex)
64=d 6d=m 62=b 31=1 => 31626d64=dmb1
The Matrox-codec is disabled and the Paradigm-codec is made responsible for
all avi-files with the Matrox dmb1 identifier tag.
If you record to a
MJPEG-file the dmb1-tag is set by the Matrox capture driver indepent from these
settings. If you process your videos with MSP5 or Premiere the Paradigm-codec is
used to decompress the files. If you create a new avi-file from your
video-project and choose the Paradigm-codec, the registry setting makes the
Paradigm-codec write the Matrox dmb1-tag in the avi header. You can play your
new file with the Matrox PC-VCR with the hardware acceleration of the RR.
With this setting it is very simple to work. You have to install the driver,
edit the system.ini and registry once and you will not have to change any
settings or fileheaders in future. You only have to remember that your new
processed file can´t be longer than 2 GB in order to be played with the RR. I
tried to play a video project with the MSP 5, but I didn´t manage it. I only was
able to create a avi-file. This limitation is a great disadvantage. If you are
processing only small files, this is no problem for you and this way works fine.
You can use the Morgan- and the Paradigm-codecs as additional
codecs
Your system.ini entries must look like the following:
[drivers32]
vidc.dmb2=pmmjpeg.dll
vidc.MJPG=m3jpeg32.dll
VIDC.dmb1=C:\PROGRA~1\MATROX~1\RAINBO~1\RRIcm.dll
Registry:
HKEY_CURRENT_USER\Software\Paradigm Matrix\Software M-JPEG
Codec\
Compress FourCC = 32626d64 (hex)
This value stands for 'dmb2' ! Don't confuse with 31626d64 for 'dmb1' !!!
The Morgan´s "user FourCC"-field has to be disabled or if you like
to enable it set it to "MJPG". If you use avi.exe you must change the
content of the Morgan-button from "mjpg" to "MJPG".
"mjpg" was used in earlier driver versions but it has changed to
"MJPG" because of the specs.
All codecs are active and can be used to decompress and compress avi-files.
You can define which codec will be used for which file by changing the
identifier tag in the file header of each file. If you want the avi to be
decoded by the Matrox-codec the identifier tag must be "dmb1". If you
want it to be decompressed by the Paradigm-codec the id-tag must be
"dmb2" and "MJPG" for the Morgan-codec. You should use the
avi.exe Windows program to change the identifier.
You can play your
video-projects with MSP and do not need to create avi-files. So you are not
limited to 2 GB with your projects. If you want to create avi-files from your
project you can choose the compression. This can be the Matrox, Morgan, Paradigm
(all MJPEG) or some other codec (like Intel Indeo).
If you have chosen
the Morgan- or Paradigm-codec, your generated avi-file contains the dmb2 or MJPG
identifier in the file-header. You must change this with avi.exe to dmb1
(Matrox) to play the file with the RR´s hardware accelaration. Otherwise the
file will be played back only with the power of your CPU and it could be, that
your system is not fast enough for 25/30 fps.
For playback it is better to
use the Matrox-identifier; for further processing you should use the other
identifiers. The disadvantage of this method is the changing of the file-header,
but I think that this is no problem with avi.exe. The advantage is the great
flexibility, because you can decide which codec will be used for a file.
General info about using the other codecs
When creating avi-files from your video-projects with the any codec, you
can choose the compress-quality with a slider. If you want the avi be processed
with other programs later, you can choose the maximum setting, but you have to
be aware of the longer filesize and greater data-rate. It could be that your
system is not fast enough to playback those avis in realtime.
You must keep in mind that the MJPEG format is a compression format. MJPEG
stands for Motion JPEG. I guess all of us have used pictures in the JPEG (.JPG)
format. The file size is very small after converting a tiff (uncompressed) to
JPG and the quality is decreased. The more you compress the less is the quality.
When we use MJPEG we must know that we pay for the small file size and the
smaller datarate with picture-quality. This is typical for the JPEG-compression.
If you want to increase the quality of your captured videos you can try to
use Doc Mordrid´s overclocking method, which is described at TIGRR. If you are not familiar
with editing the registry you can use the tool MJPG.EXE to change the
registry-settings.
Links
My RR-directory with
avi.exe, MJPG.exe and the latest version of this article
Paradigm Matrix M-JPEG codec
Morgan Multimedia M-JPEG
codec
Last edited 19.11.1998 by Uwe
Roeder.