Lesson 2 - Capturing Video
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 defragmented (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.
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 go here.
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 recommend 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 synchronize video sequences that were captured on the desk top, with your Notebook sitting on the beach, or on airplane. 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.
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.
The MJPEG-Software-Codec Guide
About the Morgan Multimedia and Paradigm Matrix M-JPEG codecs
What on earth is a codec ?
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 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.
Why should I use another codec ?
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:
HKEY_CURRENT_USER\Software\Paradigm Matrix\Software M-JPEG
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
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.
General info about using the other codecs
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.
Morgan Multimedia M-JPEG codec
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
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.