[Back to Index] [Back to Personal]  [Back to Homepage]

 

Lesson 2

Capturing Video

High_Speed_Camera1.jpg (34339 bytes)

 

Capture basics

   Even though the RealCap software module is simple and easy to use many thing can go wrong in the capture process.  To give you a better understanding of capturing video this small guide will explanation about the various aspects of the capturing process. Maybe this could solve the problem you might experience.

   One of the most important issues in real-time video capturing is whether the PC system is capable of storing the amount of data onto the hard drive. In full size and full speed (NTSC mode) the amount of data that has to be streamed onto the harddrive is approximately 27Mb (24bit color * 720 * 480 * 30 frames/sec). This amount of data can only be streamed onto a hard drive using very expensive equipment. Not only  the hard drive must be very fast but also the data bus on the mainboard. I know that today's PCI bus and hard drives with Ultra DMA are capable of data transfer of up to 33Mb/sec of data throughput. But it must be remembered that this is in extreme cases where the system does not interfere on the bus, which is hardly the case for any Windows operating system. The real throughput on these system (in situation where the system has been optimized) is about 8-9Mb/sec which is still allot. In order to stream the video data onto the hard drive the amount of data must be reduced. In our system the reduction is done using Motion JPEG format. There is also the MPEG standard but unfortunately the equipment for full speed and size video capturing is still too expensive.
   The Motion JPEG format is similar to the all known JPEG format which is extensively used on the WEB for single images. The amount of compression can be varied depending on the capturing hardware. The Iomega Buz is capable of compressing from the normal size 900Kb/frame to as much as 4kb/frame i.e. 120K/sec or as much as 200kb/frame i.e. 6Mb/sec. Off course the image quality depends on the amount of compression. A higher compression means that you have to throw away allot of information in order to use less space for each image.
   Choosing small compression, the system will have to stream an amount of data to the hard drive which is close to the actual throughput of the hard drive system. In cases where the hard drive has not been defracmentated (cleaned up) for some time the head of the drive will have to jump around on the drive to find space for the video data. The RealCap module uses a pre-allocated data which has been created contiguously. Meaning that the head of the hard drive does not have to move too much and jumping in order to store the video data on the drive. The RealCap software utilize state of the art software algorithm to take care of these problems. It took the Ariel Dynamics staff many programming hours to develop such a sophisticated software. This software today is used by NASA and various Air Forces as some of our premier customers.

   When displaying the video data on the monitor there are two options that can do the trick. First option is called preview mode, which means that the computer forcibly extracts a video image from the video stream each .5 sec and renders the image on the screen/monitor. This is off course time consuming because the processor is part of the whole process. Also when searching on the video it is not always easy to find the location from where you want to capture using only 2 images/sec. Most current technologies utilize this mode which is not accepted in real time video capturing unless you do not have another choice.  The second option is called overlay mode and it is a special no processor depended operation, where the capture card is capable of streaming the video data directly to the display card memory. This is a very powerful option and leaves allot of idle processor time for other programs and the current running application - The RealCap.
In order to have this overlay mode it is important that the graphics adapter in the computer has enough video memory (At least 8MB)  and is capable of running a refresh rate that is high enough. Also the graphics card must support the DirectX technology from Microsoft. Using the Iomega Buz, there has been reported some difficulties using various graphical adapters. Please check the following link to ensure that your hardware is compatible with the Iomega Buz:

buzpict.jpg (3403 bytes) Iomega Hardware compatibility!   (Discontinued, we changing to the Matrox Marvel G200-TV)

   After the video has been captured it is unlikely that the start position of the captured video will mach any other captured video sequence from another angle/view. In 3D biomechanical analysis it is required to use more than 2 view in order to transform image coordinates to spatial coordinates. Even if taking advantage of VCR synchronization the VCR mechanism will not always respond with the same time delay. This means that the start position will have to be modified/trimmed in order for them to correspond. After the video sequence has been captured the RealCap proceeds directly to a trimming process which enables you to modify the video sequence, selecting a synchronization image and the amount of pre and post images.

   For more Video Essentials with the APAS please click heere.

   In the following are more resources of information about Video and Video drivers utilized in the APAS System. However, the only thing you need is to install the software as described above. You do not need to understand it, but I reccomend it so you know what is going on. The following driver is needed for computers that cannot have the Buz card, such as a notebook. You may want to be able to digitize and sychronize video sequences that were captured on the desk top, with your Notebook sitting on the beach, or on airplan. Or, maybe on the weekend at your home. (don't tell your wife, I suggest that....). Or let your students work at home. Why would you want them around you all the time... I am doing this allot... For that reason, you must have a MJPEG drivers to be able to see the video on your notebook.

 

The MJPEG-Software-Codec Guide

 

Video Perfection

Compression technology allows you to achieve the highest video quality at a minimal cost to both your hard drive and your wallet

Digital Video is a rich new universe of creative ventures limited only by your imagination. Before you make video editing a hobby, you should familiarize yourself with some of the basic concepts behind video itself that make it fun and extremely easy to learn.

The most important thing to consider when choosing a video editing solution is video compression. Even better is hardware compression which, not only produces the best possible video quality, but saves you hard drive space and hard earned money that would otherwise be spent on extra memory.

What is compression?
Compression is simply a way of shrinking video so that more of it can be saved on your hard drive. How much you compress directly affects the quality of your video when you record and playback your movie production. Transforming video into digital information requires a lot of data, especially if you don’t compress it. To achieve the best looking video, free of any jitter, video should be captured and viewed at 30 frames per second (fps), a standard adopted by the National Television Standards Committee (NTSC) created for the video industries in Japan and the U.S. The video standard in Europe is called Phase Alternating Line (PAL) and produces video at rates of 25 fps.

No compression means poor quality, less detail
After you hook up your VCR or video recorder directly to your computer, it would be a daunting task to save your video onto your hard drive without using compression. To do so at full resolution means your system has to be able to handle an enormous amount (15-20 MB/second) of incoming data (see Compression Chart below). Most home and corporate systems built in the last 12 to 18 months are only powerful enough to receive a maximum of 3 MB/second of video information. Anything more will most probably result in dropped frames or lost image information, further reducing the image quality of your video.

Quite simply, no compression means you have to capture video at lower resolutions and lower frame rates. If you capture video uncompressed onto your computer within the 3MB/sec maximum, then you can only capture your video at a low resolution of 352x240 and only at a frame rate of 15 fps. For the same video to be captured uncompressed as full-motion video, such as 30 fps, then your video can only be captured at a resolution of 176x120. The result is your viewing screen is 16 times smaller than the fullest screen resolution of 704x480. That’s a full 16 times less detail than your original video clip!

Software compression solutions don’t compare
So, it’s clear you need to compress video in order to make video editing on the PC more feasible. Today’s compression techniques are driven either by hardware or software. Software compression applications are growing, but they still perform well below the required minimum to achieve acceptable video quality for editing. Another "quirk" is that their performance is highly dependent on the speed of your system’s CPU. So, when it comes to editing the video recording of your recent trip to, say, Las Vegas, you could only capture video at a resolution of 320x240 with potential dropped frames. In this case, your trip to Vegas becomes nothing more than a choppy recording of fear and loathing.

So what you need is hardware compression. Among the existing hardware-driven compression techniques, the one you should consider the most is hardware MJPEG CODEC (Compression/Decompression) technology.

Do it right the first time with hardware MJPEG compression
Hardware MJPEG (Motion-Joint Photographic Experts Group) is the same standard used in all high-end, professional broadcast solutions sold on the market today. So, if you’re going to edit your vacation video on your computer, opt for a hardware MJPEG solution which allows you to capture full resolution video at a full 30 fps for the highest quality video that is as close to the original source as possible.

Not only does hardware MJPEG compression give you the superb image quality you want, but it goes a long way to saving space on your computer’s hard drive. Consider a 30 minute uncompressed video clip at a full resolution of 740 x 480 at 30 fps. It would consume a whopping 52GB of drive space, roughly 10 times the size of a typical hard drive! Even if you owned a computer with that much hard drive space, using it for 30 minutes of video is obviously impractical and unrealistic. Conversely, hardware MJPEG compression saves you plenty of disk space, bringing that astronomical figure down to just over 5GB, while still maintaining excellent video quality. MJPEG is also flexible enough to modify the rate of incoming data, or compression factors, to vary the video quality to the level you want.

What about MPEG?
MPEG is yet another compression solution on the market but is somewhat limited. Hardware MPEG1 encoders are primarily for capturing and storing video, plus publishing video for Web-based distribution. However, they can not go back out to tape. At its best, MPEG1 captured video only has a resolution of 352x240 (30 frames/sec), which means less resolution and lower video quality.

MPEG video can also be very difficult to edit with any amount of frame accuracy. MPEG uses an Intra-frame encoder to create a small number of actual "full" frames used as a reference frame for the frames that follow it. In between each I-frame are a series of calculated frames – called Predicted frames and Bi-directional frames – which contain only the differences between two complete I-frames. Editing MPEG video currently requires multiple recompressions which degrade video quality. MPEG is more suitable a method for distributing video. But you should first edit using MJPEG and then transcode it back to MPEG once the clip is completed.

Matrox uses hardware MJPEG
The cost for many consumer video editing solutions using hardware MJPEG can be high, somewhere between the $500 to $1,000 range. Also, they may not be compatible with your graphics card. Matrox, on the other hand, offers a fully integrated solution combining hardware MJPEG and 2D/3D graphics technology for only $299.00.

So, make sure video editing is a pleasurable pursuit by choosing a Matrox video editing solution with hardware MJPEG compression.

Matrox products that use hardware MJPEG compression
Two such video editing solutions using hardware MJPEG compression are the Matrox Marvel G200-TV and Matrox Marvel G200 video cards. But they do so much more than just video editing. They are the ultimate all-in-one solutions that provide peak performance in 2D, 3D, video and multimedia applications. With all the key features you could possibly want on one card, you don’t have to worry about any compatibility issues – one card does it all. As a result, the Matrox Marvel G200 Series are ideal for home users, Small Office/Home Office entrepreneurs, corporate users, and for multimedia authoring.

A third video editing product is the Matrox Rainbow Runner G-Series. This is a video editing and TV-Tuner upgrade card for the Matrox G100/G200 series of graphics and video accelerators.

Compression Chart

Resolution

Frame Rate

Com.
Factor

MB per sec

MB per 30 min

X

Y

Com-
pressed

Uncom-
pressed

Com-
pressed

Uncom-
pressed

176 120 30 20 0.06 1.81 109 3263
176 120 30 10 0.12 1.81 218 3263
352 240 15 20 0.12 3.63 218 6526
352 240 30 20 0.24 7.25 435 13052
352 240 30 10 0.48 7.25 870 13052
352 480 30 10 0.97 14.50 1740 26104
704 480 30 20 0.97 29.00 1740 52207
704 480 30 10 1.93 29.00 3480 52207
704 480 30 6.5 2.97 29.00 5355 52207


About the Morgan Multimedia and Paradigm Matrix M-JPEG codecs


This text is written for all people who want to use other MJPEG-codecs with their RR.
What is a codec and how does it work ?
Why should you use another/additional codec ?
What are the advantages/disadvantages ?
 

What on earth is a codec ?


   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 its 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 avis 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 its 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. Lets 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 its 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-drivers 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 gets 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 drivers "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 dont have to patch any avi-files. Avi-files played with ActiveMovie, Matrox PC-VCR or MSP5 (best Preview) make use of the RRs 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 cant 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 didnt 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 Morgans "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 RRs 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 Mordrids 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

Morgan Multimedia M-JPEG codec

Paradigm Matrix M-JPEG codec

My RR-directory with avi.exe, MJPG.exe and the latest version of this article

 

Last edited 19.11.1998 by Uwe Roeder.

   The above information is a detail description of installing different video drivers. The APAS system in most cases doing it for you automatically. The only time when you have to install these drivers is when you do not have the capture card installed on your computer. In this case you can digitize and analyze the data but you cannot capture. Obviously, you cannot capture without a capture card. But you can analyze data that was capture with another computer capture card.  These allow a situation in a classroom, for example, where there is one master system with a capture card and all the students have only the drivers to analyze the results.  That means, that you do not need to purchase more then one APAS system. You purchase one, and use it on as many as you want.   This is one of the uniqueness of the APAS and one of the most important factor to consider when purchasing any Biomechanical System.

 

Tips For Better Capture

Steps:


To ensure that you capture the highest quality video you may want to follow these steps. If you system is not optimized, the result may be dropped video frames. Video with dropped frames will look jittery and will have audio dropouts.


1) Run Disk Defragmenter. Creating, modifying and deleting files causes fragmentation of your hard drive.You should defragment your hard disk every month to maintain an optimal disk. Depending upon the size and speed of your hard drive, this process could take up to an hour or more.

a) Close all applications.

b) Click Start.

c) Click Program.

d) Click Accessories.

e) Click System tools.

f) Click Disk Defragmenter.

g) Select the drive you would like to defragmet.


2) Don't run other applications while your are capturing video to your hard disk.

3) Change your "Typical Role" settings from desktop computer to Network Server. This will increase the size of the file and directory cache. This results in increased speed when accessing the hard disk.


a) Right click on "My Computer".

b) Click Properties.

c) Click Performance.

d) Click File System.

e) Click arrow next to "Typical Role of this machine" and select "Network Server".

f) Click and drag the "Read –ahead" optimization slider all the way to full.

g) Click OK.

h) You must restart your machine for these changes to take effect.


4) Be sure that DMA is enabled for IDE hard disks. DMA access has lower CPU overhead and transfers data faster.

Note: Not all hardware supports DMA access. If DMA is not supported by your hardware you will need to restart your PC in safe mode to disable DMA.


a) Right click on "My Computer".

b) Click Properties.

c) Click Device Manager tab.

d) Double click Disk Drives.

e) Double click your hard disk. It will be labeled Generic IDE type XXX.

f) Click the Settings tab.

g) Enable DMA by clicking the mouse in the check off box.

h) Click OK.

i) Click OK.


5) Modify the minimum and maximum memory size for the Windows 98 32 bit disk cache. Windows reserves all memory not in use for disk caching, loading additional applications will cause the disk cache to shrink and enlarge. Manually setting the size of the disk cache can improve efficiency.

Note: RAM allocated to the cache cannot be used by applications.


a) Click on Start\Run. Type in SYSEDIT. Click OK.

b) Click on the SYSTEM.INI window.

c) Search for [vcache] section

d) If you do not have this section add the following lines to system.ini.

e) [vcache]

f) MinFileCache=

g) MaxFileCache=


6) The more RAM you have the higher you should make these settings.


a) If your PC has 32 MB of RAM set min to 2048 (2MB) and the maximum to 4096 (4MB)

b) If your PC has 64MB RAM or more set min to 4096 (4MB) and the maximum to 16384 (16MB)

c) If your PC has 128MB RAM or more set min to 4096 (4MB) and maximum to 32768 (32MB)


7) Close the window and click YES to save your changes.

8) Restart the computer to activate the new settings.







[Return to online index page] email to onlinesupport


 

[Go Back to Lesson 1] [Go to Lesson 3] [Go to Home Page apas2_icon.gif (2351 bytes)]

 

 

[Back to Personal]  [Back to Homepage]