PapaJohn's Newsletter #36 - Jan 15, 2006

Movie Maker 2 and Photo Story


 Intro to AviSynth
I've mentioned a number of times that I've been working on the introductory chapter to a book about the world of VirtualDub... and learning much as I go.
VirtualDub has been in my video editing toolbox for a long time. I included it the 'Do Amazing Things' book, and used it to rotate the embedded airplane clip in the video on the main web page for the book's online companion.
In the weekly newsletters it was featured in issue #16, and just last week in issue #35 was one of the apps used  to adjust a dark video.
The book work introduced me to more of the VirtualDub world, especially to two related but different apps, VirtualDubMod (VDubMod) and AviSynth... new to me and just added to my toolbox. I'll make one comment about VDubMod in the section with notes, and devote the heart of this issue to AviSynth.
One thing that makes AviSynth different is that, on first glance, it appears to be something only for real geeks who love the hand-coding of things like XML files for transitions and effects. But that's just with a cursory look... when you dig in a bit, you're quickly amazed at what doors you can open with it.
Rehan recommends AviSynth on his site: as the easiest way to reverse a clip; I agree with him and changed my site the other day to say so... it's method #4 on the page, and is now the preferred one.
In this newsletter I'll cover downloading, installing and using it, and encourage you to adopt it too. It's free from the world of open source software.
... before getting into it, a couple long notes about things going on...

 First the comment about VDubMod. It's VirtualDub with lots of extra features. One extra is its ability to Parsing MPEG-2use MPEG-2 files as inputs, something VirtualDub can't. As I wrote about it for the book chapter, I had to check... yes it opens MPEG-2 files. More than that, I tried opening the VOB files on two different DVDs and saving them to AVI files for use in Movie Maker. Here's how it went:
The first one I tried was a computer-made DVD from someone in California... a Movie Maker movie burned onto a DVD disc by Sonic's MyDVD 4.5, the same app I use. VDubMod took a while to open it... it parses the interleaved MPEG-2 file as it does so (whatever that means). Once opened, I had it save it as an AVI file, choosing the Panasonic DV codec for compression. The rendering went well, and the video and audio in the Panasonic DV-AVI file played fine... and worked as a source file in Movie Maker.
Panasonic DV Codec ErrorThe second disc was a mini-disc my son gave me from his Sony DVD camcorder. This time I got an error message... the Panasonic DV codec couldn't handle it.
I changed the compression setting to try the Microsoft Windows Media Video 9 codec and got another error message, this one pointing to the need for the Windows VCM... that option used to work before my laptop went off to the shop for its new hard drive.
My records show the Windows VCM codec package was released 1-1/2 years ago, and did these two things: (1) Legacy encoding and editing applications can now support the WMV9 codec in file containers such as AVI, (2) WMV 9 content can now reach desktops running Windows Media Player 6.4. Yes, this fits the case. I downloaded the VCM package, installed it again on my laptop, and the encoding went fine (note that aborted the rendering due to time, so I didn't get as far as checking it's playback quality).
So I had gone directly from the VOB files on DVDs to a DV-AVI file in one case and a WMV9 file in another. 
If you're interested in the VCM package, the link is:
 My website will be 2 years old in March and it still had it's first priority on problem-solving... until earlier today. With the roll-out of a new venture I have with Neptune, it's time to change. I moved the priorities around. Doing Amazing Things in your videos is now first, the Photo Story 3 tutorial aspect of the site is second, and problem solving is third.
What's with Neptune? We're working toward a PapaJohn Gallery at Neptune that will show some of my videos and selected others, with a link from Neptune to my website. On my website, I'm adding more links to Neptune and working on a tutorial about how to use the Neptune service.
Neptune is the only web-hosting service so tied into Movie Maker that it appears in the list of providers when you opt to save to The Web in the Save Movie Wizard. If we're going to make and exhibit amazing movies, Neptune is the best place for the gallery.

About AviSynth(esizer)
If you're familiar with AviSynth, then you're way ahead of where I was a few weeks ago. But I've been studying to catch up.
The heart of the software is its frame server engine, a DLL in your Windows/System32 folder... waiting for you to double-click on a file with an AVS extension... you don't run the engine directly.
There are two kinds of files with AVS extensions and unless you have installed this app, you can search your hard drive for AVS files and probably not find one of either type.
 One is a video file that you rename to add the .AVS extension... I rename them like this: from videofile.avi to videofile.avi.avs
Why would you want to do this? I don't have any good answers yet. I've read about some reasons but haven't been able to confirm one yet or come up with others on my own. Just realize that you can redirect a video file to go through the AviSynth frame server engine by adding an AVS extension to it (after you've installed the software of course).
 The other is a small text script file that you rename to give it the extension. Now we get into the instant usefulness of the app.

'Frame Server' engine
The DLL takes each frame of a video file and sends (serves) it to whatever software you associate AVS files with. The default at installation is Windows Media Player 6.4.
Installing and testing it taught me that XP has two versions of the Windows Media Player installed - 6.4 and the newer 9 or 10.
I reassociated the AVS files to use WMP10 on my laptop. The software playing it (sometimes WMP10)thinks it's coming directly from some video file, but it's really coming from the frame server.
This sets the stage for the scripts and the neat things you can do with them.

AviSynth Scripts
Create a simple text file in Notepad and save it with an AVS extension (maybe it'll be a TXT file first - then rename it). In the script you tell the frame server to do something to each frame as it passes through from the source video file to the playing software.
Here's a script to illustrate it:
This script has 3 lines or commands (I squeezed the first line to wrap into 3 lines for the snapshot):
1 - StackVertical - play the source videos on top of each other, vertically with the first one on top. This isn't Picture-in-Picture... it's Picture-on-Picture.
2 - Subtitle - add my URL in the upper left corner (default position). The text isn't in the source file; it's being added by the script.
3 - ShowFrameNumber - add the frame number on each.
When I saved the script and double-clicked it, WMP10 opened and played what you see in the following figure.
I took the snapshot as frame 51 went by. You can see that each of the 3 commands in the script are working.
Script Playing
Let's check the file properties in WMP10. Both of the source files are DV-AVI of 720x480 pixels... the combined height of both is 960 pixels and the File Propertiesaspect ratio is an unusual 3:4.
WMP10 is opening automatically because I associated it with the AVS script file extension.
What other apps can use the AVS script as a proxy for a video file?
Virtual Dub, Rad Video Tools and TMPGEnc open them fine. Movie Maker 1 and 2 don't.
If you want to save the file as you see it, use one of the apps that accepts the script and save it as a new file. The new file will have all the attributes you see playing in the player.
WMP10 serves as my preview app... while cycling thru it, I keep the script file open in Notepad, tweaking the commands and trying different source files until it's doing what I want.

Reverse a Clip
Back to Rehan's recommendation, which provides a more useful example of a script. If all I wanted to do to my countdown car clip is have it play in reverse, the two line script would read:

I won't go through other things you can do with the scripts... there are lots. I just wanted to introduce you to the idea of using the utility.

Downloading and Installing AviSynth
The download is a 1.71 MB file AviSynth_255.exe - from (I used a server in Australia as the USA site took forever and timed out).
Run the executable... it'll put the frame server engine, the AviSynth.DLL, in the Windows/System32 folder and create a new AviSynth 2.5 folder under Program Files, with 3 subfolders - Docs, Examples and plugins...
Use whatever folder you want and wherever you want it for your script files.

Online info about AviSynth and the help files with it seem a bit dated. They suggest that any file that runs in the Windows Media Player can also be used as an AVS file... to kind of force it to open in an app that wouldn't otherwise accept it.
I didn't find it that way. The WMV and DV-AVI type I files from Movie Maker certainly play in the Windows Media Player, yet renaming them to AVS doesn't make a difference when it comes to trying to open them in Virtual Dub... I believe the current info about Virtual Dub. It checks the file itself to see what type it is and doesn't go by the extension. Renaming a WMV file to AVS will drive it to the frame server engine but you'll get an error message saying it can't play that type of file.

Have a great week...