The Anal-Retentive Obsessive-Compulsive's Guide to Perfect Laserdisc Captures AVI Edition by Kris Kelley 1. Introduction This is yet another "how-to" on video capture, with a specific focus on capturing programs from laserdisc. I chose to write about laserdiscs because, quite simply, there are a ton of good movies and other programs still not available on DVD! Examples are the 'Indiana Jones' trilogy, the first 'Star Wars' trilogy, and a number of old television cartoons. I expect they will be released on DVD eventually, however, I am not holding my breath, especially when I know George Lucas has vowed not to release the early 'Star Wars' movies until 2005! Until then, watching laserdiscs is fine, but CD- sized discs are much easier to handle and carry. In fact, depending on the format used, it is often possible to use one single-sided disc to store programs that require two or more laserdisc sides! Of course, it is quite possible to use this guide to make captures from VHS tape. However, laserdiscs are ideal for those who want their captures to be as clean as possible without going out and hunting down the original film master. Laserdiscs do not degrade with each playback like VHS tapes do, and many laserdiscs have features movie-philes love, such as letterboxing and CD- quality digital audio. 2. Things to Know before Starting I must warn you that it is absolutely impossible to talk about video capture without spouting off a host of technical terms. Any attempt to explain what these terms mean, while at the same time using them to explain other things, would kill all hope of being understood. Therefore, I'm not even going to try. I have added some sections to the end of this guide, to better explain certain words and concepts. However, if you are new to the world of A/V capturing, please do not expect this guide to cover everything. I will be as clear as I can, however, I am writing for one particular project, and to thoroughly explain everything would require a very thick book. In fact, several very thick books have already been written on these topics. This guide is intended for North American, Japanese, and other audiences who live where the "NTSC" standard for home video is used. The rest of the world follows the "PAL" standard, with different technical specifications. There are three editions of this guide, each one focusing on saving to different file and disc formats. This is the AVI edition. Finally, I do not call this an "Anal-Retentive, Obsessive-Compulsive" guide for nothing. This is not the best reading material for someone looking for a quick and casual way of recording movies on their computer. 3. What Is the Primary Goal? Before starting a new project, one important question needs to be answered: What disc format should be used for storing and watching the captured program? There are a lot of options here, and the final decision should be based on the level of quality desired versus how "portable" the disc should be (some disc formats are more widely supported than others). Some choices are: * VCD (Video Compact Disc) A predecessor to DVD, VCD uses standard CD-ROMs to store up to 74 (or 80) minutes of digital audio and video on a single disc. VCD video, based on the MPEG1 video codec, is roughly similar in quality to a VHS tape that has been played a few times. VCD audio, based on the MP2 codec (also known as MPEG1 Layer 2, older than the popular MP3 or MPEG1 Layer 3 codec), is somewhat inferior to CD audio, though the difference is largely negligible. VCDs have very wide support. They are by far the easiest to create, with many video editing and CD creation tools offering VCD support. They are also by far the easiest to play; most stand-alone DVD players will play VCDs, and there is software available to play VCDs on computers and even some game consoles like the Sega Dreamcast. The disadvantage is that VCD uses older digital video technology, and the the difference in quality is very noticeable. I do not consider VCD to be a high quality format. * SVCD (Super Video Compact Disc) When DVDs were first coming out, several institutions, most notably the government of China, sought an alternative that wasn't quite as restricted by royalties and license agreements. The SVCD format was spawned from this desire. SVCD offers greater quality control, and yields better results than VCD. Like VCD, SVCD uses the same media as audio CDs. SVCD video is based on the same codec used for DVD video (MPEG2), while SVCD audio is basically the same as VCD audio. Depending on the quality settings used, a single SVCD can hold anywhere from 30 to 80 minutes of digital audio and video. Unfortunately, SVCDs are not as widely supported as VCDs. Fewer stand-alone DVD players play SVCDs, though some do. Most computer DVD programs will play SVCDs, though sometimes a little trickery is needed. Also, because SVCD uses the MPEG2 video codec, which is licensed technology, there are fewer tools available for creating SVCDs, and these tools are not free. However, there are high quality tools available at decent prices. An SVCD created with the right amount of care will look *much* better than a VCD created from the same source. If you want to use a stand-alone DVD player to watch laserdisc captures, and the stand-alone player has SVCD support, then I highly recommend using the SVCD format. (NOTE: To find out all the abilities of your stand-alone DVD player, including whether or not it will play home-made VCDs and SVCDs, check out the player database at http://www.dvdrhelp.com. This is a very helpful site, offering all sorts of information, tutorials, and links to software concerning digital audio and video.) * AVI (Audio Video Interleaved) AVI technically isn't a disc format. However, people often create AVI files with the intention of storing them on CD-ROM. This makes AVI a disc format of sorts, at least for the purposes of this guide. AVI offers the greatest creative freedom, with virtually no restrictions on codecs or level of quality. The only limits are personal preference and the intended amount of storage space. Nowadays, a popular way to use AVI is to create CD-sized AVI files using the DivX video codec and the MP3 audio codec. A single 700MB CD can store a 90-minute DivX-based AVI with excellent quality, and a 2-hour DivX-based AVI with good quality, which neither the VCD nor SVCD formats can offer. (NOTE: The DivX video codec is free for personal use, and is available at http://www.divx.com. The MP3 audio codec is technically not free, but it does come bundled with many audio software and hardware packages, and people have found other ways of acquiring it.) The biggest disadvantage of AVI files is their reliance on a computer. Specifically, they can only be played on a computer that supports the codecs used to create the files. Some programmers are working on bringing DivX-based AVI support to the Sega Dreamcast and the Sony PlayStation 2 video game consoles, however, these projects tend to require quality settings lower than what I personally would be happy with. Having said all that, I do expect AVI support to broaden in the future. There will probably be a day when AVIs can be played on a stand-alone player, or at least something more easily integrated into a home entertainment system. * DVD (Digital Video Disc) DVDs are currently the pinnacle of digital video, at least compared to other formats used by stand-alone players. The video and audio quality is very high, and the list of possible features is enormous. With recordable DVDs, proper care will yield a disc that plays indistinguishably from the original laserdisc, except the DVD will not have to be flipped over! The disadvantage to using DVDs is the obvious hardware and media requirements, namely, a recordable DVD drive and recordable DVD discs. These are more expensive than recordable CD drives and discs, making inevitable mistakes that much more costly. DVD mastering software is also required, and this is usually not cheap, although some DVD recordable drives come bundled with this software. To make matters even more confusing, there are multiple, competing standards for recordable DVD discs, and care must be taken to use discs that are compatible with both the recordable drive and the stand-alone player to be used. (NOTE: The DVD player database mentioned above at http://www.dvdrhelp.com also includes information about which players support which types of recordable DVD discs.) This is by no means a complete list of available formats, but it is a list of the most popular. This edition of the guide focuses on the AVI format; other editions focus on VCD and SVCD. I may write a DVD edition in the future, once I have more experience using the DVD format. 4. Setting Up Getting the system ready is necessary before any capture project can begin. 4.1. Gathering Supplies To capture laserdisc programs, the following are needed: * A computer. A relatively fast computer and *plenty* of hard drive space are necessary for working with high quality captures. If any part of the computer is too slow, the capture will drop frames, resulting in video that skips. If hard drive space is skimped on, lower quality settings will have to be used during capturing, and this will be evident in the final file. My system sports a Pentium Celeron 900, an IDE 7200RPM 120 gigabyte hard drive, and 256 megabytes of PC-100 RAM. 80 gigabytes of the hard drive is reserved for A/V projects. During the capture process, the CPU typically hovers between 40% and 60% utilization. * Video and audio capture hardware. Quality is essential here. The video hardware should be capable of capturing 29.97 frames per second at a resolution of 640x480. The audio hardware should be capable of recording stereo audio at a 48kHz sampling rate with 16 bit sample sizes. I use the ATI All-in-Wonder Radeon video card and the Soundblaster Live! sound card. * Software. For capturing, I use VirtualDub, available at http://www.virtualdub.org. I have found VirtualDub to be the best free capture program for Windows, and it also provides editing and encoding tools. I run VirtualDub on Windows 2000 with NTFS support, so that my A/V files are not limited in size to 4 gigabytes. Sometimes I am working with files well over 30 gigabytes! (NOTE: Some programs, VirtualDub included, are capable of automatically spanning large A/V files across multiple smaller files, to work around file-size limitations. However, I do not like using this feature, because not all AVI-based programs offer support for automatically stringing multiple files together.) (NOTE: VirtualDub uses the AVI file format to save its captures. This means there is an excellent amount of freedom over the audio and video within these captures, and plenty of free tools available to work on them. I take advantage of this freedom by exerting powerful control over the capturing and editing processes, to preserve the highest amount of quality possible. The money I save using free software doesn't hurt, either. Some capture programs, including a few that come bundled with video capture cards, use the MPEG2 file format to save their captures. Capturing with these programs is relatively easy compared to using VirtualDub, because there are less decisions to make, and these programs often have convenient configuration presets. However, these advantages come at a price. MPEG2 technology is not free, therefore there are few, if any, legally free programs with MPEG2 file support. Also, the MPEG2 file format uses lossy codecs; repeatedly saving the same A/V file as an MPEG2 will significantly degrade its quality. If you decide to use an MPEG2-based capture program, please note that the rest of this guide contains instructions specific to VirtualDub and the other software packages I use. This guide will still be good for general tips and ideas, however, you will need to read the documentation provided with your software to learn how to edit and convert your captures with minimal loss of quality. By the way, if you are thinking about using an MPEG1-based capture program, forget it. MPEG1 quality is just too low.) Other software packages used in this guide are the Huffyuv video codec (no web site currently; use a search engine), and AVISynth (http://www.avisynth.org). More details about these packages are provided in the appropriate sections of the guide. * The laserdisc(s) of the program to capture. * A laserdisc player. For best results, use a player capable of reading digital audio tracks, and supporting S-video output. A dual-sided player is not essential. I use the Pioneer DVL-919. * Cables for connecting the laserdisc player to the computer. 4.2. Putting It Together Getting the system ready should be a matter of following the instructions for installing the capture hardware and software, and then making the necessary connections between the computer and laserdisc player. For my system, a couple of extra steps are necessary: * VirtualDub uses an older standard known as Video for Windows (VFW) to communicate with video capture hardware. This standard is not natively supported by Windows 2000, however, Windows 2000 Service Pack 2 includes wrapper code that allows VFW-compatible programs to work. This code is not enabled automatically, so follow the instructions at http://www.virtualdub.org/docs_vfwwdm to utilize the wrapper. * While the ATI All-in-Wonder Radeon includes hardware for capturing audio as well as video, the cables actually work as a pass-through, and the computer's sound hardware (the SoundBlaster Live! in my case) is responsible for the recording. However, for whatever reason, connecting the cables as prescribed by the All-in-Wonder Radeon's instructions allows only mono audio to be captured when using VirtualDub under Windows 2000. This is perhaps due to the Windows 2000 VFW wrapper not offering full support for stereo audio. The simple workaround is to not use the All-in-Wonder Radeon's pass-through technique, and instead connect the laserdisc player's audio output directly to the sound card's audio input. This requires an extra adapter to go between the SoundBlaster Live!'s 1/8" (headphone style) jack for audio input, and the laserdisc player's RCA jacks for audio output. 5. Capturing Everything for capturing should now be in place. 5.1. Configuration Configure the system and the capture program, using settings ideal for AVI. For a Windows 2000 system running VirtualDub, this involves the following: (NOTE: Enterprising users will definitely want to read VirtualDub's documentation, to find out what all the little knobs and switches do. These instructions are the result of my experience in capturing laserdisc programs, and may not suit everyone's tastes.) * Using the sound mixer applet in the Windows system tray, select for recording the audio source the laserdisc player is connected to (usually "Line-in"), and make sure the volume slider is as high as it can be without clipping the incoming audio. (NOTE: Newer versions of VirtualDub also provide a link to the sound mixer applet. When in capture mode [see below], use "Audio" -> "Windows mixer".) * Start VirtualDub and select "File" -> "Capture AVI..." This switches VirtualDub to capture mode. Before capturing for the first time, VirtualDub requires a significant amount of configuration, which is outlined in the following steps. Fortunately, most of this configuration is a one-time process, and preferences can be saved to allow future captures to progress much more quickly. * Select "Audio" -> "Compression..." In the window that appears, use the "Format" pull-down menu to select which audio codec VirtualDub will use during capturing, then use the "Attributes" menu to configure that codec. I strongly recommend using uncompressed, high quality audio. Therefore, select "PCM" for the audio codec, and "48,000 kHz, 16 Bit, Stereo" for configuration. Click "OK" when finished. * "Audio" -> "Volume meter" brings up a window where the level of incoming audio can be changed. This ties directly into the controls provided by the sound applet in the Windows system tray, therefore, adjusting the controls here may not be necessary. However, this window also displays level meters for both channels of stereo audio, and can therefore be used to troubleshoot audio problems. If desired, begin playing a laserdisc, and monitor the level meters during this time. If the meters never max out, the volume can be increased without fear of degrading the sound quality. If the meters are constantly maxing out, the volume should be decreased, otherwise it will sound awful in the capture. If one or both of the meters are not moving at all, there is a problem either in the hardware connections, or in the selection of which audio source to record from. Check the cables and use the system tray applet to investigate. Close this window when finished. * There are two ways to set the video resolution and color standard used during capturing, "Video" -> "Format..." and "Video" -> "Set custom format..." Only one method needs to be used. "Video" -> "Format" is the easiest, as it will offer only the most common resolutions, and only the color standards supported by the video capture hardware. For resolution, I recommend 640x480. I only have one color standard available, so I leave it set at UYVY. I am not familiar with the intricasies of the different color standards, so I cannot offer much advice. When using a capture card that offers more than one option here, my advice is to find out which one does the best job of preserving color information while also allowing use of the desired video codec (see below). The author of VirtualDub has a more informed opinion on selecting a color standard; read his take at http://www.virtualdub.org/docs_capture, under the question "Which capture format should I choose if I'm going to use video compression?" "Video" -> "Set custom format..." offers every choice of resolution and color standard possible, including some that may not be supported by the video capture hardware. This method can be used if a more exotic resolution is desired. Note that VirtualDub will complain if you try to select a resolution or color standard not supported by the video capture hardware. In either case, click "OK" when finished. * Use "Video" -> "Source" to select the video source and perform some additional configuration to the video capture hardware. This option will present a new window with three available tabs. The "Capture Source" tab, first displayed when the new window appears, is where the video source is selected. The capture hardware to be used should be selectable under "Select a Video Device". If the hardware has more than one available video input, such as offering both composite video and S-video, select the active connection under "Select a Video Source". S-video is greatly preferred! The "Device Settings" tab offers controls such as brightness, contrast, and other such picture manipulation tools. Any such configuration not supported by the video capture hardware will have its control greyed out here. It is generally safe to leave all of the controls at their defaults, value 128, right in the middle. However, experienced users may want to fiddle with these controls. In my case, I have found that my All-in-Wonder Radeon captures somewhat more darkly than I would like, so I move the brightness slider a little higher to make up for it. I then move the contrast slider slightly higher as well to compensate. The "Camera Controls" tab is relevant only to digital cameras, and does not apply here. Click "OK" when finished. * Select "Video" -> "Compression..." In the window that appears, use the list on the left side to select the video codec that VirtualDub will use during capturing. Only the codecs compatible with the selected color standard will be listed. After selecting a codec, click the "Configure" button to adjust the settings relevant to that codec. While I would strongly recommend using uncompressed video, the storage space and transfer rate required are obscene. Therefore, I instead recommend using a codec that uses lossless compression. The best I have found is Huffyuv. Note that Huffyuv will only work with YUV-based (YUY2, UYVY, YVYU) and RGB-based (RGB16, RGB24, RGB32) color standards. Configuring Huffyuv is easy. If capturing with a YUV-based color standard, choose one of the options from the left pulldown menu; if capturing with an RGB-based color standard, choose one of the options from the right pulldown menu. The options are similar for both, with the top option ("Predict left") being the least CPU intensive, and the bottom option ("Predict gradient") potentially creating the smallest (but still very large) files. There is an extra option for RGB-based color standards, "Convert to YUY2". If selected, an option from the left pulldown menu will also have to be selected. Converting to YUY2 will result in a slight, probably unnoticeable loss of color information, but will also result in significantly smaller files. The checkboxes can be left alone or experimented with as desired. Click "OK" on all windows when finished. (NOTE: The "Video" -> "Compression (compatibility)" option is relevant only to those who need to use VirtualDub's compatibility mode for capturing. This mode relies solely on the VFW standard for capturing to an AVI file, whereas VirtualDub normally handles the AVI file itself, allowing for more features. The author of VirtualDub offers more information at http://www.virtualdub.org/docs_capture, under the question "What's the difference between compatibility mode and normal (internal) capture?" In short, I have never used compatibility mode, and I doubt I would want to. Therefore, this guide does not go into any detail about the settings specific to compatibility mode.) * The remaining options listed in the "Video" menu provide additional picture manipulation tools. However, I do not feel it is wise to make the computer work any more than necessary while capturing. Therefore, leave the rest of these options alone. Any necessary editing can be done after the capture is finished. * Use "Capture" -> "Settings..." to set the frame rate. In the space provided, enter "29.97" to match the frame rate used by North American and Japanese laserdiscs. Make sure the box for "Capture audio" is checked, also. The remaining options here can be left at their defaults. Click "OK" when finished. * Use "Capture" -> "Preferences..." to select where the capture file will be stored. Either use the browse button next to the space labelled "Default capture file", or enter a path in that space, to select the name and location of the capture file. Make sure there is plenty of room free! Additional options here can be used to define most of VirtualDub's capture configuration as the default. The four checkboxes of "Save current capture settings as default", "Save current audio format as default", "Save current video format as default", and "Save video compression settings" can all be used to preserve the relevant set of configurations, so those steps can be skipped during future captures. I have found that the only settings not preserved are the volume slider under "Audio" -> "Volume meter" and the video source settings under "Video" -> "Source". The rest of the settings here can be changed as desired; they will not affect the capture process. Click "OK" when finished. * Use "Capture" -> "Stop conditions..." to enable automatic capture stopping, if desired. For example, since no laserdisc side exceeds 60 minutes, the checkbox for "capture time exceeds" could be used to automatically stop capturing after 60 minutes (3600 seconds). Click "Accept" when finished. * Under "Capture" -> "Timing..." make sure the box is checked for "Adjust video clock dynamically to match audio clock". Because separate hardware is responsible for audio and video capturing, they are not always guaranteed to be in sync with each other. This option enables VirtualDub to exert more control over keeping the audio and video in sync. More on audio and video sync in section 6 of this guide. * I have not used most of the remaining options of the "Capture" menu, and largely they do not directly affect the quality of the capture. In particular, I do not use the "Capture drives..." or "Enable multisegment capture" features, because I prefer to keep each capture in a single file. However, I do have the "Show information panel" feature enabled, so that I can keep an eye on VirtualDub's status while it is capturing. If any of these features look useful, read the author's documentation for more information on them. 5.2. Capturing, Really This Time Now the capture is ready to begin. Because I am leery of A/V synchronization problems, and also to keep the capture files as small as possible without breaking up the audio and video, I capture no more than one side of a laserdisc at a time. This means most movies will be stored in two or three capture files by the time I am finished. After configuring VirtualDub, capturing is easy: * Start the laserdisc and verify the computer is receiving both audio and video. * At the right moment, press F6 to begin the capture. Then, sit back. Do not try to use the computer while it is capturing. During the capture process, if the "Show information panel" feature is enabled, information about the capture will be displayed on the right side of VirtualDub's window. Of particular importance is the "Frames dropped" number. Zero is the ideal number of frames dropped, however, seeing this number increase is not necessarily a reason to panic; in fact, sometimes frames are not really dropped at all (more information about that in section 6). Generally, because the laserdisc program is being captured at almost 30 frames per second, a single-digit or even double-digit number of dropped frames will not be very noticeable, provided the drops occur evenly throughout the capture. * When the capture has completed, and assuming no automatic stopping features are being used, press the escape key to stop the capture. There will now be an AVI file containing the captured audio and video. 5.3. Additional Captures? Again, I prefer using only one side of a laserdisc to create each capture. However, because a good quality DivX-based AVI can be up to two hours and still fit on a single CD, I usually make two captures for each project. So, a capture of the next laserdisc side can be made at this point. Make sure there is sufficient room to store the second capture, and to edit both captures later. Note that if CAV laserdiscs (30 minutes maximum per side) are being used instead of CLV laserdiscs (60 minutes maximum per side), up to four captures can be used for one DivX-based AVI. 6. Editing Most likely the capture file or files are not ideal for archiving as is. Despite the capture program's best efforts, the audio and video may still be slightly out of sync. There may be extra audio and video at the beginning and/or end of the capture that can be removed. And that's just the beginning. This is where my control-freak nature really shines. Read on to discover how I go about editing my captures. (NOTE: Do not take any of the instructions in section 6 as mandatory. They are here to give an idea of the possibilities of laserdisc capture editing. You are free to exert as much or as little effort as you like here. In fact, you can skip this section entirely and go on to section 7 if you are happy with the way your captures look and sound, and you plan on using only one capture for teach AVI. However, if you are as obsessive and compulsive as I am, read on.) 6.1. Getting the Audio and Video Back in Sync VirtualDub is also an AVI editor in addition to being a capture program. When a capture is finished, I open the AVI file in VirtualDub (first selecting "File" -> "Exit capture mode" if necessary). Then, before I do anything else, I resave the capture using a different frame rate. For whatever reason, even with VirtualDub's attempts to keep the audio and video in sync, I find that they still skew a little; after 50 minutes, the audio is off by a fraction of a second, just enough to be annoying. So, I perform these steps to fix the skew: * Select "Video" -> "Frame Rate..." The first section of the resulting window offers three options: "No change", which shows the current frame rate; "Change to _____", which allows a new frame rate to be entered; and "Change so video and audio durations match", which shows what the frame rate would be in that case. On my system, captures always end up with a 29.971 frame rate initially, the result of VirtualDub tweaking the frame rate in an attempt to keep the audio and video in sync. The third option usually suggests a frame rate of 29.969. Using the second option and entering a frame rate of 29.970 often does the trick for my captures. (NOTE: One might think that since 29.970 happens to be the frame rate originally requested, perhaps VirtualDub shouldn't be given the ability to change the frame rate. In my case, however, disabling that feature in VirtualDub resulted in captures where the audio and video were even *more* out of sync! This is just one of many idiosyncrasies to be found in the world of digital audio and video, and the only way to discover them is through experience, hopefully somebody else's.) Leave the remaining options in this window as they are: "Process all frames" should be checked in the second section, and "None (progressive)" should be checked in the third section. Click "OK" when finished. * Under the "Audio" menu, make sure "AVI audio" and "Direct stream copy" are selected. * Under the "Video" menu, make sure "Direct stream copy" is selected. * Select "File" -> "Save as AVI...". Decide on a name and a place where the new AVI will be saved. This new file will be virtually the same size as the initial capture, so make sure there is enough room. The save may take a while. Once it is complete, the original capture file can be deleted to free up space. If working with more than one capture file, repeat the above steps for each capture file. 6.2. Removing Unwanted Audio and Video After I have corrected the audio/video sync problem, I open the new AVI in VirtualDub, this time to remove any parts at the beginning and end of the file that are not a part of the program, and also to remove duplicate frames. During the capture process on my system, VirtualDub records a number of "dropped" frames that in reality are frames duplicated to achieve the 29.971 frame rate. These duplicate frames do not offer any extra video information, and their removal is necessary for my other editing tricks. * To remove a section at the beginning of the AVI, use the slider at the bottom of the screen, the "Backward" and "Forward" navigation buttons, and/or the arrow keys on the keyboard to find the last frame of the part to be removed at the beginning of the file. Then, press the "End" key on the keyboard. Next, drag the slider to the very beginning, or use the "Start" navigation button, and press the "Home" key on the keyboard. The section to remove has now been marked. Press the "Delete" key on the keyboard to remove it. * To remove a section at the end of the AVI, use the slider at the bottom of the screen, the "Backward" and "Forward" navigation buttons, and/or the arrow keys on the keyboard to find the first frame of the part to be removed at the end of the file. Then, press the "Home" key on the keyboard. Next, drag the slider to the very beginning, or use the "End" navigation button, and press the "End" key on the keyboard. The section to remove has now been marked. Press the "Delete" key on the keyboard to remove it. * To remove dropped frames, use the "{" and "}" keys on the keyboard (the shift key is required) to move to each frame marked as dropped in the AVI. Then, press the "Home" key followed by the "End" key on the keyboard to highlight this single frame. The "Delete" key on the keyboard can then be used to delete this frame. (NOTE: Deleting frames in this manner also deletes the related section of audio. However, this only amounts to about 1/30th of a second of audio, which is usually not noticeable.) (NOTE: Do not delete frames marked as dropped if they really are dropped frames!) * To save the AVI after doing all desired removals, perform the last three steps in section 6.1. Again, make sure there is enough space for the new file. If working with more than one capture file, repeat the above steps for each capture file. 6.4. Fine-Grain Editing with AVISynth Once I have put each capture file through the steps of sections 6.2 and 6.3, I use a marvelous tool called AVISynth, written by the same author as Huffyuv, to do the rest of my editing. AVISynth is a scripting language that allows very fine-grained editing. While the scripts themselves are only text files, almost any AVI-based tool can use them as if they were AVIs themselves. AVISynth is good for many editing tricks, including the following: * Masking or removing letterbox bars. Letterboxed laserdiscs often have a few distracting "speckles" in the black areas of the picture, usually due to scratches or other imperfections on the disc that are picked up by the laser. AVISynth offers the ability to mask these areas with true, solid black bars, removing any extraneous noise. The letterbox bars can also be removed entirely, since AVIs are not restricted to specific resolutions or aspect ratios. Besides making the letterbox areas less distracting, masking or removing them will also potentially improve the overall picture quality of the final archive, because less of the allocated data will be spent encoding the speckles and any other video noise that appears in the letterbox areas. Solid color takes up less room than noise when run through a compression routine. * Joining captures into a single virtual A/V file. When working with multiple captures, AVISynth can be used to glue them together. * Splitting captures along new boundaries. AVISynth can also be used to split programs differently than the way they were on laserdisc. I often do this for programs that span three laserdisc sides, so that I can save the program in two AVIs, each one holding an equal amount of audio and video. When saving AVIs to CD, this reduces the number of blank discs needed, and balancing the program equally across the two AVIs ensures the quality will be the same through-out. * Untelecining. Theatrical releases that were originally run at 24 frames per second have to be put through a process known as "telecining" before being released on home video. Basically, this process alters the movie's frame rate, so that it can be stored on conventional media (laserdiscs, VHS tapes, etc.) and viewed on conventional televisions, all of which use the 29.97 frames per second frame rate. AVIs, however, are not restricted to a single frame rate, and could be created to run at 24 frames per second. Doing so would offer two big advantages: One, an AVI running at 24 frames per second requires 20% fewer frames than an AVI running at 29.97 frames per second playing for the same amount of time; this means the frames could be stored with better quality while using the same amount of storage space. Two, modern computers and computer monitors, as well as some newer televisions, can be made to play at the lower frame rate if desired; this gives the effect of smoother, more fluid motion in movies that were originally meant to be played at 24 frames per second. The good news is, it is possible to "untelecine" a movie captured from laserdisc without any loss of picture information. For technical reasons, the resulting frame rate will actually be 23.976 frames per second, which is still more preferable than leaving the movie telecined. To determine if a movie has been telecined, play a section of the capture frame by frame. If for every five frames there are three frames that look normal followed by two frames that appear to have different pictures mixed together, the movie has been telecined. (NOTE: By the way, looking for the telecine pattern was how I determined VirtualDub was often duplicating frames instead of dropping them. Removing the duplicated frames restored the pattern.) In theory, untelecining is an easy process for a computer, and many video editing programs, including VirtualDub, offer filters to automatically detect the telecine pattern and splice the mixed frames back into their original form. Unfortunately, in practice it is difficult for an automatic routine to untelecine a movie perfectly. This is because the telecine pattern breaks frequently during the course of most movies released on laserdisc. These filters are programmed to tell when the pattern has broken, and adjust accordingly, but the code can never be foolproof. Instead of automatic untelecining, I use AVISynth to do some frame-by-frame editing of my captures, deleting some frames and duplicating others, so that the telecine pattern is perfectly preserved through-out the entire movie. I then use AVISynth's function for untelecining, which does not rely on automatic pattern detection. Of course, there are disadvantages to doing it this way. Sometimes the edits are more noticeable in the final archive than I would like, especially when the sound is also being clipped or looped along with each dropped or added frame. More importantly, sitting down and actually finding where every break in the telecine pattern occurs is a royal pain, and sometimes requires several attempts before they are all discovered. However, being the control freak that I am, I feel the end results are far better than either leaving the frame rate as is or being at the mercy of an automatic function. Many times the effects of these edits are no worse than artifacts that stem from the capturing and encoding processes. These are only a few examples of what can be done with AVISynth. I recommend reading through the author's documentation for more information. Also, here are some example AVISynth scripts, created during my projects: * 'Doc Hollywood' - http://www.skunkworx.org/guides/DocHollywood.avs.txt * The second half of 'Raiders of the Lost Ark' - http://www.skunkworx.org/guides/RaidersOfTheLostArk-Disc2.avs.txt * The first half of 'Star Wars' - http://www.skunkworx.org/guides/StarWars-Disc1.avs.txt * 'The Last Unicorn' - http://www.skunkworx.org/guides/TheLastUnicorn.avs.txt One important thing to keep in mind while editing: Many video codecs require, or at least work best, with a final resolution that meets certain criteria. In particular, DivX requires the horizontal resolution to be a multiple of 4, and the vertical resolution to be a multiple of 2. DivX works best when both horizontal and vertical resolutions are multiples of 8, which is a safe rule of thumb for all video codecs. 7. Encoding At this point, there should be either an AVI file or an AVISynth ready for final encoding. In either case, VirtualDub can be used to save the A/V file to its final AVI format. Open the AVI file or AVISynth script in VirtualDub, then follow these steps: * Under the "Audio" menu, make sure "AVI Audio" and "Full processing mode" are checked. Then, select "Audio" -> "Compression..." In the new window that appears, select the desired codec from the list on the left. Then, if the codec can be configured, select the desired configuration from the list on the right. I use the MPEG Layer-3 (MP3) audio codec. If the A/V file to encode is less than 90 minutes long, I usually select "192 kBits/s, 48,000 Hz, Stereo" for configuration. For A/V files longer than 90 minutes, I select "160 kBits/s, 48,000 Hz, Stereo" for configuration. Click "OK" when finished. * Under the "Video" menu, make sure "Full processing mode" is checked. Then select "Video" -> "Compression..." In the window that appears, select the desired codec from the list on the left. Then, click the "Configure" button to configure the codec. I use the DivX 5 video codec (version 5.05, to be specific). There are many different options available in configuring this codec, and reading the documentation that comes with the codec installer is highly recommended. However, I limit my configuration to two features: the "Variable bitrate mode" and the "Encoding bitrate." (NOTE: Earlier releases of the DivX 5 video codec had slightly different options than those mentioned below. In particular, multiple-pass encoding was not available; only one-pass and two-pass. If using an earlier version of DivX 5, the instructions below should give a general idea of how to properly configure the codec.) The "Variable bitrate mode" pull-down menu essentially offers a choice between one-pass and multiple-pass video encoding. One-pass encoding is simple; after the encoder finishes, the final AVI is ready. Multiple-pass encoding is slightly more complex. During the first pass of a multiple-pass encode, the encoder creates information files instead of encoded video. The encoder must then be run again. With each new pass of a multiple-pass encode, the information files are updated. Finally, when the last pass is run, the information files and the original source are used to create the final AVI. Needless to say, multiple-pass encoding takes much longer than one-pass encoding. However, multiple-pass encoding produces better quality video encoding, even at the same bitrate. Two passes are usually sufficient to get high quality video without taking forever to create an AVI. Use the pull-down menu to select either "1-pass" or "Multipass, 1st pass" encoding. Then, enter the desired encoding bitrate in the space provided. If "Multipass, 1st pass" is selected, click the "Select..." button next to the space labelled "Log file:" to define where the encoder will store its log file. I also recommend checking the box labelled "Use MV file" and then clicking the second "Select..." button to define where the encoder will store the MV file. (NOTE: To get a specific final file size, such as 700 megabytes for storing on CD, a bitrate calculator can be used to determine the ideal video bitrate. I recommend using Gordian Knot, available at http://www.doom9.org/ for calculating bitrates; it is the only calculator I know of that can determine audio and video duration directly from an AVI file or AVISynth script, instead of requiring the duration time to be entered manually. Gordian Knot is actually a multi-purpose program that not only offers a lot of neat tools, but also works as an interface to several other programs, mostly concerned with DVD ripping and transcoding. Be sure to read the documentation to learn how to make bitrate calculations, and to discover all of Gordian Knot's other features. Note that a complete install of Gordian Knot and all related packages will provide all the software used in this guide, including VirtualDub, Huffyuv, and AVISynth.) (NOTE: Selecting "1-pass quality-based" from the pull-down menu changes the "Encoding bitrate" option to "Quantizer". This can be used when a certain percentage of the original picture's quality needs to be preserved. I do not use this method of encoding, because it becomes impossible to know ahead of time what the final file size will be.) Click "OK" to exit out of all windows. (NOTE: If using multiple-pass encoding, audio encoding can be disabled entirely during every pass except the last one, to speed up processing. Under VirtualDub's "Audio" pull-down menu, select "No audio".) * Click "File" -> "Save as AVI", and decide on a name for the new AVI, and a place to put it. Make sure there is enough room. Click "Save" when ready. The save will probably take a long while. (NOTE: All but the final pass of a multiple-pass encode will produce a dummy AVI file with the name entered in this step. This file is useless, and can be removed or overwritten without worry.) After the save process finishes, the final AVI should be ready, if this was a single-pass encode. Otherwise, repeat the steps in this section as necessary, making the adjustments relative to each pass. In particular, if multiple-pass DivX 5 encoding was selected, select "Multipass, nth pass" when configuring the DivX 5 codec for all additional passes, and also make sure the box for "Update log file" is checked for all except the final pass. If audio encoding was disabled, be sure to reenable it for the final pass. The AVI will then be ready after the final pass finishes. (NOTE: Selecting "Multipass, nth pass" will allow a maximum bitrate to be entered in addition to the average bitrate. The maximum bitrate defaults to 10 times the average bitrate. There is usually no need to change this setting, though it may come in handy if you know you will be using older, slower CD-ROM drives to watch your AVI files.) 8. Disc Creation Test the AVI file with an AVI player, such as Windows Media Player. If the file plays cleanly, it can now be saved to CD, or simply remain stored on the hard drive. All project files used to create the AVI, including the source AVI(s) and any AVISynth scripts and codec log files, can now be removed, unless they are needed for future projects. 9. Is It Possible to Be Even More Anal? The process outlined in this guide can produce AVIs that look and sound very good, and are small enough to fit on CD. However, perfectionists may object to the way the audio gets nipped and tucked along with the video during the editing process. One remedy is to save the audio to a separate WAV file immediately after the capture finishes, editting the audio and video independently of each other, and then merging the audio and video back together after all edits have been taken care of. Care must be taken to ensure the audio lines up properly with the video after merging them back together, and even then, they may not stay properly in sync. In that case, audio software capable of changing the audio playback rate could be used, or, the video frame rate could be adjusted to compensate. VirtualDub supports exporting audio to a WAV file, and also supports importing external audio into an AVI, so VirtualDub can be used for splitting and remerging audio and video. As described earlier, VirtualDub can also be used to change the frame rate, if desired. Unfortunately, I am not familiar with any free audio tools capable of modifying audio to play at a different rate, however, CoolEdit (http://www.cooledit.com), among other commercial applications, does provide such support. Some laserdiscs offer advanced surround sound, in the form of six-channel DTS or Dolby Digital soundtracks. Some laserdiscs also boast alternate soundtracks, in the form of foreign language dubs or running commentary by the filmmakers. AVI files are capable of storing more than one audio track, and some audio codecs offer support for multi-channel sound. It is possible, with the right hardware and software, to capture this extra audio and create an AVI with it. I am unfamiliar with the software tools necessary to do this, so I cannot make any recommendations. Note that multiple audio tracks and/or multi-channel audio tracks require higher bitrates, reducing the length of audio and video that can be stored in a fixed amount of space, such as a CD-R. 10. Final Words This guide covers a lot of ground. I hope I didn't write too confusingly. If you have any questions or comments about this guide, especially if you see an error that needs correcting, feel free to email me at skunkworx@kingwoodcable.com. Appendix A - A Brief Explanation of Audio/Video Files When it comes to computer files containing digital audio and video (A/V files), there are three things to keep track of: the video codec, the audio codec, and the file format. The video codec determines how the video is encoded. Most video codecs support a variety of resolutions and bitrates. The higher the resolution and bitrate, the higher the quality of the picture, but also the more storage space the video will require. Examples of video codecs include MPEG1 (used in VCDs), MPEG2 (used in SVCDs and DVDs), and DivX (a popular choice for home-made A/V files). The audio codec determines how the audio is encoded. Most audio codecs support a variety of frequency ranges (equivalent to sampling rates in uncompressed audio) and bitrates. Some audio codecs also support more than two channels of audio. Broader frequency ranges and higher bitrates give higher quality audio, but again, they also take up more storage space. Examples of audio codecs include MP2 (or MPEG1 Layer 2, used in VCDs and SVCDs), MP3 (or MPEG1 Layer 3, popular for home-made audio and A/V files), and AC3 (or Dolby Digital, used in virtually all DVDs). The file format defines how the audio and video are mixed together and stored in a single computer file. AVI is the most popular file format, and the audio and video contained in an AVI can be encoded with any codec the computer has been set up to play. Quicktime Movie is another popular file format, and also supports a variety of audio and video codecs. MPEG1 and MPEG2 are file formats as well, but they are more limited than AVI and Quicktime. MPEG1 files can only have MPEG1 video and MP2 audio. MPEG2 files can only have MPEG2 video and MP2 audio. What people call "DivX" files are actually AVI files with DivX video and usually either MP3 or AC3 audio. What I call "disc formats" go a step further; each disc format not only requires a specific A/V file format to be used, but also defines how the A/V file is stored together with other information on a disc. VCD, SVCD, and DVD are disc formats. AVI is not really a disc format, however, AVI quality can still be compared to the quality offered by disc formats. Appendix B - Glossary These terms are defined with respect to digital audio and video (computer files, DVDs, audio CDs, and so on). They may mean different things with respect to analog audio and video. aspect ratio A relative measurement of a picture's width compared to its height. This measurement is *independent* of the picture's resolution (see "resolution"). Conventional televisions and computer monitors use a 4x3 or 1.33:1 aspect ratio. VHS, laserdisc, VCD, SVCD, and many DVD titles conform to this aspect ratio. "Widescreen" televisions and computer monitors use a 16x9 or 1.78:1 aspect ratio. Some DVD releases are geared to use this aspect ratio. Most theatrical-release movies use aspect ratios wider than 4x3 and 16x9. There are a variety of tricks used by the movie studios to fit presentations of these movies onto a home television or monitor. Discussion of these aspect ratio modifications is largely beyond the scope of this guide, however, they generally fall into one of two categories: either the original picture is modified to a different aspect ratio, or it is "letterboxed," adding black bars above and below the picture until the desired aspect ratio is achieved. Letterboxing is also how DVD players adjust programs using a 16x9 aspect ratio to play on a 4x3 screen. bitrate A measurement of the amount of data used to store or present a certain amount of audio or video. The bitrate of uncompressed audio is tied directly to its sampling rate, sample size, and number of channels. The bitrate of uncompressed video is tied directly to its frame rate, resolution, and color standard. For compressed audio and video, the bitrate can vary depending on the codecs and settings used, and is usually significantly smaller than for uncompressed audio and video. capturing Basically, using a computer to record audio and/or video from an outside source. The resulting A/V files are called "capture files." channels The number of discrete audio sources within a given audio or A/V file. Stereo audio files, for example, have two channels. codec Short for "code decode". Generally speaking, a codec controls how a set of data is encoded for storage, and then later decoded for presentation. Audio codecs (such as MP3) are used for audio data, and video codecs (such as DivX) are used for video data. Codecs are used primarily to save space. Uncompressed audio and video can gobble up space in a hurry. Most codecs compress the audio and video, resulting in smaller file sizes and lower bitrates, allowing more audio and video to be stored in a given space. In order to achieve the smallest sizes and bitrates possible, many codecs employ what is called "lossy" compression, resulting in some reduction in quality. The amount of quality sacrificed can be controlled by configuring the codecs' settings, and some "lossy" codecs are better at preserving quality than others. For those who don't like the idea of lossy compression, other codecs provide the ability to compress data with little or no reduction in quality. However, the storage space required for files using these "lossless" codecs is often enormous, making them best suited for temporary, intermediate files, where preservation of quality is important until the final file is ready. color depth / color space / color standard "Color depth" and "color space" are often used to describe how the color information is stored in a video or A/V file, that is, how each pixel (see "resolution") of each frame (see "frame") should be colored. There are many different standards for storing color information in both compressed and uncompressed video, and the terms "color depth" and "color space" mean mean different things for different standards. For simplicity's sake, I use the term "color standard" in this guide when referring to these standards, and I try to describe each standard with enough detail as is necessary, without going too overboard. To give one example, the color standard of "RGB24" uses 24 bits of information to store each pixel's color information. Eight of these bits describe how much red to use, eight describe green, and eight describe blue. Due to the physical properties of light, and also due to how monitors and televisions are built, these levels of red, green, and blue light will mix together to form the appropriate color on screen. compression The process of running audio or video data through a codec to use a lower bitrate, and take up less storage space. This is similar to storing computer files in ZIP archives, however, audio and video are usually (but not always) compressed in such a way that they may not be perfectly recreated when uncompressed. See also "codec." frame What we call "motion video" is actually a collection of individual pictures played in rapid succession. Each one of these individual pictures is called a "frame." frame rate A measurement of how often the frame changes when video is played back. The faster the frame rate, the smoother and more convincing movement appears on screen. Theatrical films usually have a 24 frames per second frame rate. Television signals in North America and Japan have a 29.97 frames per second frame rate. letterboxing See "aspect ratio." resolution A measurement of how many individual dots, or pixels, are used to create a picture seen on screen. For example, 640x480 means 640 rows and 480 columns of pixels are used to create the picture, for a total of 307,200 pixels. Higher resolutions mean larger and/or sharper images, but also higher file sizes and memory requirements. VCDs in Japan and North America use a 352x240 resolution. SVCDs in Japan and North America use a 480x480 resolution. Region 1 DVDs can employ a variety of resolutions, but most of them use 720x480. Conventional televisions use analog signals to recreate video and audio, therefore it is technically inaccurate to say what resolution they have. However, high quality North American televisions can display a picture comparable to 704x480. This means DVDs use a high enough resolution that individual pixels should not be visible when watching a DVD program. Higher resolutions would not make any noticeable difference in video quality. See also "aspect ratio." sample size A measurement of how many bits are used for each digital "sample" of an audio source. Simply put, higher sample sizes mean less noise is heard when the audio is played back. Conventional audio CDs, for example, use a sample size of 16 bits. This measurement is meant for uncompressed audio that has not been run through a codec. Compressed, encoded audio will sometimes boast a sample size, such as the 20-bit sample size of DTS audio CDs. This simply means the audio data is meant to be unencoded and played back using 20-bit samples, and has been compressed with enough quality preserved to do so. sampling rate A measurement of how often an audio source is "sampled" digitally. Simply put, higher sampling rates allow for a broader spectrum of audio frequencies to be captured. Conventional audio CDs, for example, use a sample rate of 44,100 samples per second. This measurement is meant for uncompressed audio that has not been run through a codec. Compressed, encoded audio will sometimes boast a sample rate, such as the 48,000 per second sampling rate of DVD audio. This simply means the audio data is meant to be unencoded and played back using 48,000 samples per second, and has been compressed with enough quality preserved to do so. uncompressed / raw Audio or video that has been stored exactly as captured by the hardware. The quality of uncompressed audio or video is tied directly to the quality of the capture hardware, and the settings used when capturing (sampling rate, sample size, and number of channels for audio; resolution, frame rate, and color standard for video). Guide Revision History 4/29/03 - First release. 6/12/03 - Updated the guide to reflect new releases of DivX 5 and VirtualDub, as well as a new AVISynth web site and the removal of the old web sites for AVISynth and Huffyuv. 6/14/03 - Added configuration instructions for the Huffyuv codec.