Windows Phone Thoughts - Daily News, Views, Rants and Raves

Check out the hottest Windows Mobile devices at our Expansys store!


Digital Home Thoughts

Loading feed...

Laptop Thoughts

Loading feed...

Android Thoughts

Loading feed...




Go Back   Thoughts Media Forums > WINDOWS PHONE THOUGHTS > Windows Phone Customizations & Content

Reply
 
Thread Tools Display Modes
  #1  
Old 10-15-2005, 08:39 PM
Menneisyys
5000+ Posts? I Should OWN This Site!
Join Date: Jun 2007
Posts: 5,067
Default TUTORIAL: resizing/downsampling .AVI videos

When you may need this tutorial? If you have full-resolution (PAL/NTSC) videos in AVI files and a QVGA PDA, you most probably will want to resize them before playing.

There's no point in trying to watch full resolution videos on QVGA Pocket PC's (as opposed to VGA PPC's) because the screen has too small a physical resolution to be able to display the video at its full glory (full resolution). It will only cause tons of dropped frames, annoying pauses in playback and a lot of excessive CPU utilization (resulting in really short battery life and, sometimes excessive, CPU heating).

When may you run into full-resolution videos and not QVGA-optimized ones? A lot of the video playing-related questions I've run into on various Pocket PC boards (see for example http://www.pocketpcmag.com/forum/top...TOPIC_ID=18720 and http://www.pocketpcmag.com/forum/top...TOPIC_ID=14426 ) concern playing full-resolution videos (while, of course, the 'How do I put my DVD to my Pocket PC?' question is the most often asked. In this tutorial, I do not explain the latter only the case of resizing/downsampling source AVI videos. Please read the excellent reviews/tutorials/comparisons of DVD to Pocket PC converters). This clearly shows this problem is indeed acute for many. This is both the case of third-party videos available on, say, p2p networks and with encoded videos you've done yourself (unless they are in WMV I don't think any video should be encoded to WMV as Pocket Windows Media Player is so inferior to Pocket Media Player (TCPMP; http://tcpmp.corecodec.org/about) and the WMV format - because it's a closed, proprietary format and is, therefore, pretty hard to convert to other formats or even resize/downsample - is so much worse than DivX/XviD. Please note that I'm not saying anything about the quality of WMV, which is very good, just its openness and Pocket PC support.)

Note that this tutorial can also be used by VGA device owners for a very simple reason: sometimes, they will also run into video files that are not exactly 640-pixel-wide. With videos like these, it may (I haven't done excessive benchmarking on this question; therefore, I may be wrong) be, in cases, advantageous to resize these videos to be exactly 640-pixel-wide so that TCPMP doesn't need to do the streching itself, which may be a CPU-intensive task.

To achieve the best results, you should use either DivX or XviD as the video codec and use videos that have the same width as your screen (and the above-mentioned/linked TCPMP as the video player).

To convert your AVI (that is, mostly, DivX/XviD videos) to this optimized format, you'll need to do the following:

1. Get the trial version of DivX Create ( http://www.divx.com/divx/create/download/ ); it has a 6-month-long trial period so you will have plenty of time to decide it if you need it or not after this period. Install it.

Note that if you don't want to pay anything and don't want to use trial versions either, you still have several choices:

- get the free PocketDivXEncoder (PDE; http://divx.ppccool.com/ ); which makes the conversion even easier (no need for height computation; batch mode etc) and, because it already contains the necessaary codecs, doesn't require separate codec installs. The reason I'm still recommending using the DivX (or, XviD) + VirtualDub combo because the latter is far more flexible and you'll be able to use it for a lot more purposes not just for converting for your gadgets. The other reason is that PDE isn't developed further (much as the latest beta version is dated a month back) and, therefore, doesn't necessarily contain the best-quality, latest, most effective codec. Note that Lathe, the successor to PDE, is a commercial program and doesn't even have a trial version; it's very cheap, though.

- get the free XviD codec from http://www.xvidmovies.com/codec/ and install it. I'll explain its usage later it's pretty similar to the DivX codec.

2. Get the free VirtualDub (http://virtualdub.org/ ). Current version is 1.6.11; this tutorial is also based on it. Unzip it to a directory and start the unzipped VirtualDub.exe .

3. Once in, load (Ctrl-O) the file you want to edit. In this example, I use the freely downloadable Star Wreck (see http://www.firstloox.org//forums/showthread.php?p=41492 for more info) as it's a "problematic" movie on old, slow(er) PDA's because it's a full-resolution video, which must be resized before watching, especially on aging Pocket PC's.

You'll get the following screen (the video area is black because it shows the first screen of the movie. You can move the slider at the bottom to switch to other screens):



Go to Video/Compression . Choose DivX 6.0 Codec :



Press the Configure button and enter 300 (300 kbps is pretty good for quarter-size videos; if you still encounter dropped frames which are pretty common with really old/slow Pocket PC's; for example, the Casio E-115/E-125, you can go as low as, say, 150-180 kbps) in the textfield on the right of Encode mode :



Note that if you've downloaded the XviD codec, you'll need to choose XviD MPEG-4 Codec instead. To set the target video speed, click the Configure button and set the Target quantizer slider. Make sure you don't go above 10 (you may want to experiment with it a bit); then, the quality will quickly become very bad.

Go to Video/Filters. Click the Add button. Choose resize from the list on the left:



Click OK. In the next dialog,



leave the default 320 of New width intact (it's the vertical screen size of your PDA). The New height value is a bit more problematic. To compute it, you'll need to do some math, based on the values you get at File/ File Information...:



Here, pay special attention to the first row, Frame size, fps. You'll need the value at the left, which is, in this case, 640x272, which means the width of the frames in the video is 640 pixels, while the height is 272.

Now, for the math. To get the new height (NH; the old width/height will be accordingly abbreviated as OW/OH) that must be entered to VirtualDub, use the following formula:

NH = OH * 320 / OW

(Note that you must use the same formula if you resize (in most cases, enlarge, because most videos are either 640, 608 or 576 pixels) videos for VGA. Then, just change 320 to 640.)

That is, in the case of the Star Wreck video,

NH = 272 * 320 / 640

That is, NH is exactly 136. This is what you must enter in the New height field. (Leave the Expand frame and letterbox image checkbox disabled. BetaPlayer/TCPMP automatically centers/letterboxes videos, so, you won't need this feature.)

Also make sure Direct stream copy is checked in the Audio menu. (The high-quality MP3 stereo soundtrack that mostly come with DivX/XviD rips, unless it's AC3 (which is quite common with DivX/XviD rips), puts, in most cases, very little burden on the CPU (TCPMP has very processor-effective decoders see for example my article on generic Pocket PC sound recording at http://www.winmobiletech.com/mp3 ), compared to high-resolution video, so, we don't downsample the audio here. Let me know if you need downsampling, and then, I also elaborate on that subject.)

Now, just start the conversion by going to File/Save As....

It's this easy.

Note that you may also want to make quick tests, especially if you want to see the quality of the output. To do this, you don't need to convert the entire video: you can easily tell VirtualDub what part of the source video to convert. To do this, just press the Home button at the starting position. After you've set the starting position, move the slider at the bottom to the right and, when you're at the end position of the block you'd like to encode, press the End button. (These two keys are both above the cursor block on standard PC keyboards and their functionality can also be accessed via Edit/Set selection start and Edit/Set selection end.) Now, if you choose File/Save As..., only the selected section will be encoded; this way, getting the best results will be made much faster.

Please also note that, if you get the previous DivX version, 5.x, it still had a free encoder (as opposed to the commercial-only in this version). Using it is pretty much the same as with the current, 6.0 version. (Much as the page at http://www.divx-digest.com/software/divxcodec5.html says the standard version is only capable of playback, I think it's also able of encoding. I haven't tested it myself; previous Standard versions of the DivX codec have always been able to do so.) Alternatively, use the XviD codec.

Feedback is welcome.

Links to other sources of information:

http://tcpmp.corecodec.org/about - the two tutorials and the three application links on the TCPMP page

http://www.pocketmatrix.com/guides/dvd/ - the PocketMatrix guide of ripping DVD's. If you "only" want to resize DivX/XviD input, you won't need it.

http://discussion.brighthand.com/sho...hreadid=119114 a new, hx4700 (VGA)-related thread with some links to commercial, mostly DVD-converter apps

http://www.pocketpcthoughts.com/foru...ic.php?t=39743 a review of Pocket DVD Wizard you may find it useful if you don't want to "manually" convert your files and/or want to convert your DVD's

http://www.pocketpcthoughts.com/foru...ic.php?t=40413 - Getting TV shows on PPC easily

http://forum.doom9.org/forumdisplay....amp;forumid=52 the home of XviD-related discussion

http://www.pocketpcmag.com/forum/top...TOPIC_ID=15632 generic questions on Pocket PC videos

etc. You may also want to pass 'virtualdub', 'divx' to the search engines of Pocket PC sites. (And, naturally, 'dvd', if you want to know more about converting DVD's to the Pocket PC.)

To look for more info (you will really want to do this, especially if you want to encode DVD's instead of plain AVI files), direct links to the search pages of major PPC boards:

PPCT
Pocket PC Mag
FirstLoox
BrightHand (note that the search engine, as of Oct-16-2005, won't likely to give you results between 2002 and 2005!)
AximSite
iPAQ HQ

EDIT at 8:50AM CET, 16-Oct-2005: added XviD, PDE and search sections, corrected a mistake and cleaned up the text a bit
 
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:36 AM.