Thursday, January 29, 2004

MPEG to XVid


Mucking around with trying to convert some of the MPEG1/MPEG2 video captures that I have into a smaller and open-source format. DivX v5.1 has ticked off the author of VirtualDub (back in Sep 2003) because their driver will now refuse to run if you have any development tools installed (e.g. a debugger). The gist of Avery's stance is that it's impossible to troubleshoot any problems that might arise between VirtualDub and DivX v5.1 - hence, no support. Personally, I think that will pretty well kill off use of DivX in the community-at-large (not a good idea to tick off the developers). Of course, since the free version of their codec is ad-supported (ad-ware beware!), I'd say they already have one foot in the grave.

But! I digress... having written off DivX, I now am looking at XVid which is a close competitor and is open-source (or at least the codec that I use is). Now, a word of warning, the last time I attempted to use a XVid codec back in September/October, it caused some problems until I uninstalled it. However, there is a new version, the 1.0 release candidate, which was released recently and I'm currently testing. You'll want to download the file called "XviD-1.0-RC1-25012004.exe". and install it onto your system.

For the other half of the equation, you'll need a version of VirtualDub that understands how to read MPEG1/MPEG2 files. I'm using build 18183 which was released Jan 29 2004 (today!). There is no install script to run, just create a folder in your Program Files directory and extract the contents there. AFAIK, you can have both vanilla VirtualDub as well as VirtualDub-MPEG2 installed at the same time -- just put them into seperate program folders and create seperate shortcuts for the two different EXE files.

Here's the quick-n-dirty recipe for converting an MPEG file to a XVid-encoded AVI in VirtualDub-MPEG2.

1. Open up VirtualDub-MPEG2 (VirtualDub.exe)

2. Open up your MPEG2 file (File, Open...), might take a minute or two for it to parse the file.

3. Cut out any portions of the video that you don't want to see in the output. Do this by sliding the marker at the bottom of the screen back and forth until you find your cut points. When you've found a cutting point (either start or end), use the buttons marked with a key symbol and a left/right arrow to move to the nearest key frame. (Key frames are the only point where you can properly cut an MPEG video stream.) If you're marking the start of a section that you want to chop, hit the Home key. Otherwise, use the End key to mark the end of a section that you want to delete. Use the Delete key to drop that segment of video. With practice it will take you but a minute to cut out commercials, extra footage. If you screw up cutting, you'll have to exit VirtualDub and reload the MPEG file (dunno if there's a faster way).

4. Add your video filters to the mix. If you have black borders around your video, you should use the "null transform" filter, to crop off those edges (Video, Filters...). In general, you should crop in multiples of 4 pixels (e.g. 2 on the left and 2 on the right, or 5 left and 3 right), some codecs need the output video to be in multiples of 4 (or some other value). Sometimes you'll need to deal with 3:2 pulldown or inverse-telecine to fix differences in FPS. If "Filters..." is greyed-out, switch to "Video, Full Processing Mode"

5. Set your compression (Video, Compression...), choose the XVid codec from the list and hit "Configure". Wow, look at all of the options! For right now, leave it on "AS@L5, Single Pass, Target Quantizer of 4.00" (more on that later). Hit "OK" and head back to the main screen.

6. Set your Audio mode to "Full Processing", then go into "Audio, Conversion". If your source is other then 22kHz, select that under "Sampling Rate", tick off the "High Quality" box and hit "OK". Then go to "Audio, Compression" and pick Microsoft ADPCM, 22kHz 4bit (stereo or mono, whatever matches your source or personal taste). You'll only be able to see formats that match what you set in "Audio, Conversion". For an hour of footage, this compression method will use around 70Mb for the audio data.

7. Use F7 to convert the video to a new AVI file. Sometimes it's handy to queue up 2 or 3 clips at once and convert them "en masse" later.

Notes on quantization levels and my tests. My source video was a 640x480 MPEG1 stream captured at 5Mbps from a S-VHS recorder. (Basically, a moderately noisy source stream.) The source file was 28 min 55 sec and 933 Mb, however I cut it down to 27 min 45 sec and cropped the image to 564x420. On my Athlon XP 2600+, 166Mhz PC2700 memory, I got around 22-24 FPS conversion rate. Not quite real-time, but not bad either (80 minutes to convert an hours worth of footage). Here's the file sizes for a few different Q levels:

Q=12.00 - file size 106Mb, but blocky
Q=8.00 - file size 136Mb, decent quality
Q=4.00 - file size 293Mb, pretty close to original but text is blurry

Q=6.00 - file size 200Mb, difference is that I added the "Smoother" video filter, setting of "0" with the noise pre-filtered enabled, this dropped my conversion rate down to 16fps. The "Blur" filter was too strong (I wanted to clean up the screen text).

I also found a slick site describing how to convert DV to DVD (e.g. captured using a Canopus ADVC-100).

posted by Wuphon's Reach at 11:58 PM

Tuesday, January 27, 2004

Utada Hikaru Travelling PV


One of the things I've stumbled across recently is Utada Hikaru's Travelling PV. Definitely one of the more original music videos that I've seen in a while, and I'll have to see if I can't track it down on DVD (as you'll see from the screen caps, I have a very low-res copy).

Utada Hikaru - Travelling PV

Utada Hikaru - Travelling PV

Utada Hikaru - Travelling PV

Utada Hikaru - Travelling PV

Utada Hikaru - Travelling PV

Utada Hikaru - Travelling PV

Utada Hikaru - Travelling PV

Utada Hikaru - Travelling PV

Utada Hikaru - Travelling PV

Utada Hikaru - Travelling PV

Utada Hikaru - Travelling PV

Utada Hikaru - Travelling PV

(oh, and Utada Hikaru is one of my current favorites)

posted by Wuphon's Reach at 7:52 PM

Japan in 2005?


I'm thinking I might actually manage to take a trip to Japan in mid-late 2005, if I can get all of my debt paid off by the end of 2004. (50-50 odds of that happening, might take me until mid-2005 to finish pay-down, but after August I'll have finished paying off my car loan which will accelerate the process.) Of course, I'll also need to save up a bit of cash to pickup a Sony Mini-DV camcorder to match up with my Sony digital camera (the Sony Mini-DVs use the same batter pack as my Sony camera, which makes life easier). The DCR-PC105 or the DCR-PC330 seem like nice options (and they'll both drop in price quite a bit by next year).

There are some 8-day guided tour packages that are anywhere from $1600-$2400 and depart from the west coast, which means probably $2000-$3000 for the trip. (Sounds like a lot, but once the car is paid off and the debt is cleared, that won't take long to save up for.) For my first trip over, I don't think I want to try and piecemeal a trip on my own. Too many pitfalls, especially since my Japanese would be far from fluent even if I studied non-stop between now and then.

So while it's 18-30 months away, it means I'd better get cracking on studying and saving up the cash.

posted by Wuphon's Reach at 3:52 PM

Powered by Blogger Who's linked to me?