Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Development
Register FAQ Calendar Today's Posts Search

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 25th November 2003, 07:16   #1  |  Link
zambelli
Doom9ing since 2001
 
zambelli's Avatar
 
Join Date: Oct 2001
Location: Seattle, WA, USA
Posts: 2,002
Encoding Avisynth (.avs) sources with WME9

(I apologize for the re-post... I figured this might interest readers of this forum too.)

If you ever tried using Avisynth scripts as sources in the Windows Media 9 Encoder, you probably discovered that it simply didn't work. In all likelyhood you received an error message "No such interface supported".

This bothered me for the longest time. I always assumed the error message was indicating that somehow .avs files weren't supported as sources in WME9. And yet, I knew from Nic's practical implementation of the WM encoder object model that it was possible to feed .avs files to WME9.

So I finally decided to explore the problem more closely. I analyzed the VBScript-based encoder sample that shipped with WME9 - wmcmd.vbs - and found nothing in the source code that would theoretically prevent WME9 from reading .avs files. I then ran wmcmd.vbs under the Visual Studio script debugger and waited for the script to error out. When it did, I was somewhat surprised to find out that the error had nothing to do with the source reading method.

Apparently, the script-based WME9 was trying to read the duration property of the source object - and it was finding that the duration property did not exist. It errored out every time it attempted to print out the progress of the encoding process. Doh! I assume the GUI-based encoder was doing a similar thing - trying to access properties of the video source object that Avisynth simply wasn't supplying - at least not in the way that WME9 expected it.

Well, with that figured out, the fix became easy. Considering source duration was only being used for the trivial progress printout, I simply took out the few lines of code out of wmcmd.vbs that dealt with source duration. The upside: WME9 (script-based only) now accepted Avisynth scripts as input. The downside? Progress percentage disappeared from the printed output. Not a big loss, I think you will agree.

So, what do you need to do to make WME9 work with Avisynth? It's quite simple, really. First make a copy of the wmcmd.vbs file that shipped with WME9. Call it something like WME9AVS.vbs, perhaps. Now open the file in Notepad or any text/code editor and find the text "Compute file duration". Beginning with that line, delete every line of code up until (but not including) "intSleepDuration = 2000". The deleted section should count about 20 lines of code. Now replace the deleted code with the line:

intDuration = 0

Save the file and you're done. You should now be able to use wmcmd.vbs with any valid .avs file as source. As I said, the only downside is that you won't be able to get the progress report about your encoding pass, including info about the start of Pass2. Oh well. Don't forget that the .vbs version of WME9 is just about as powerful as the full version of the encoder. If you run into a setting that's not supported in the script-based encoder, just go and create a profile in the full encoder and then use the script-based encoder with the "-wme" switch. This is essentially how you get 6-channel mono WAV input and other nifty tricks done.

Feel free to suggest better fixes for the duration bug, if you can think of any. My solution is merely a workaround, I'll admit that, but for right now it gets the job done.
zambelli is offline   Reply With Quote
 


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 22:38.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.