VirtualDub, as a video program, is a very heavy user of MMX integer vector math instructions in x86 CPUs; in fact, most of the inner processing loops are almost exclusively MMX. Part of the reason is ease of coding, since it's easier to operate on an (R,G,B) triplet with one MMX instruction than with three separate ones and trying to juggle three times as many values in only eight registers. Another, though, is the significant performance gains that result.
A problem with using MMX, and its successor instruction set extensions SSE and SSE2, is that you have to pay careful attention to what CPUs support what extensions and how they perform on each. Here is a braindump on what my experiences have been throughout the years while working on VirtualDub.(Read more....)
While I'd like to say that the reason I'm posting this is to republish some info I dropped from the old help file, the real reason is that I want to stem the flow of comments about watermelons. I had no idea that salting watermelon was so common. One of my friends suggested that the salt draws water out and makes the melon taste sweeter, but I buy that about as much as the diarrhea-prevention theory a commenter posted. When I tried it I all I tasted was salty watermelon. Maybe I used the wrong kind of salt.
Anyway, about VirtualDub's command-line parameters....
VirtualDub exposes a few switches on its command line that can be used to automate its behavior. Nearly all of them are centered around running scripts, so you cannot do much that is not scriptable -- in particular, you cannot script capture mode at all. However, you can run jobs automatically, which is how the various front-end apps work.(Read more....)
In the prelude episode to the Japanese anime series Mahoromatic, the android maid Mahoro slices a watermelon up, sprinkles some salt on the slices while singing a cute song, and hands one of them to the young master Suguru. The two then enjoy melon while talking about the upcoming series.
I had some watermelon lying around and decided to try salting it a little bit.
Bleccccch. I'm not trying that again.
I think salted watermelon is inappropriate.(Read more....)
"VirtualDub currently isn't multithreaded and only takes 50% of my hyperthreaded CPU. Would it run twice as fast if it were?"
No, and the premise is incorrect anyway.
VirtualDub is multithreaded -- if it weren't, the UI would lock every time it rendered a frame. Rendering operations use three threads: UI, I/O, and processing. Preview operations also create a fourth thread for timing blits. The reason for low CPU utilization on second and subsequent logical CPUs during a render is that all video operations are serialized in the processing thread; audio operations take place on the I/O thread however so if you have audio filtering or compression those will execute in parallel. To take full advantage of dual CPUs you have to balance operations across multiple threads and make sure you're not just wasting time ping-ponging data between the CPUs. VirtualDub isn't written to do this currently.
But what about Pentium 4 CPUs with Hyperthreading Technology? Everyone has one, so VirtualDub should be tuned for dual CPUs soon, right?
Well, not quite.(Read more....)
While trying to find a way to set the frame rate on a WDM capture device in DirectShow and not have it just return S_OK and ignore my setting, I came across the following documentation in the DirectX 9.0c SDK for IAMVideoControl::GetFrameRateList():
Returns an HRESULT value that depends on the implementation of the interface.
Whew, that's a relief. I thought it would return random values instead.
(It isn't easy to write documentation, and it's even harder when a technical writer who's not the API designer is doing it. However, some of the documentation in MSDN is downright silly.)(Read more....)
Another common question I get is why VirtualDub can't encode MP3 above 56Kbps. Remember, VirtualDub has no audio encoding support of its own -- it relies solely on codec installed in the Windows Audio Compression Manager (ACM) to compress audio, and that usually means the Fraunhofer-IIS MP3 codec. (You may also have the Lame ACM and/or Creative MP3 codecs, but these are known to trigger hangs and crashes on some systems.) There are at least five major versions of the MP3 codec in existence:
- l3codecx.acm: Cannot encode at all.
- l3codeca.acm (Advanced): Encodes up to 56Kbps.
- l3codecp.acm (Professional, older version): Encodes up to 128Kbps.
- l3codecp.acm (Professional, newer version): Encodes up to 320Kbps.
- l3codecp.acm (so-called "Radium" version): Encodes up to 320Kbps. If I remember correctly, this version was actually ripped from an Opticom application that contained it internally, and so its legality is... ahem... interesting.
All versions will decode any format, but because they all register under the entry "msacm.l3acm" only one can be installed at a time. What often happens is that some application will install and overwrite the entry with the Advanced codec, thus dropping your encoding capability to 56Kbps. This will break any older application that might have installed and relied on the Professional codec. Changing the l3acm entry back to l3codecp.acm under Drivers32 in system.ini (95/98/ME) or the Registry (NT/2000/XP) will restore the higher bandwidth modes.
The good news is that for those of you who have lost the Professional version, there is a safe and easy way to obtain it again: install Windows Media Player 10. This installs the recent revision of the Professional version that encodes up to 320Kbps.(Read more....)
A couple of days ago I got an email asking what "sparse AVIs" were and how to fix one that wasn't playing properly. The person had converted his AVI to a .sparse file using the "Create Sparse AVI" option in VirtualDub's Tool menu, deleted the original AVI, then discovered that the new file did not open properly in any player or in VirtualDub itself, even after being converted back through the "expand sparse AVI" command. The answer, unfortunately, is that you cannot recover the original AVI from the .sparse file -- it cannot be played in any player. So what are they?
A .sparse file is an AVI file that has had its audio and video chunks emptied and the remaining data swizzled for better compression. The file only contains the header, index, and structure of the AVI file, but none of its payload. Expanding the .sparse file results in a .AVI file that is the same as the original except that all 00dc and 01wb chunks are zeroed. The result looks like an AVI file and can be parsed by any AVI parser, but it cannot be played back as there is no data to decode.
So what are .sparse files good for?(Read more....)