PDA

View Full Version : VirtualDub Plugins in AVISynth (for DVD2SVCD)?


isolationism
3rd February 2002, 01:14
Hi folks,

I've been reading through the forums and various users' websites regarding various methods for encoding Anime to SVCD. Unfortunately a lot of users appear to prefer encoding their anime to DivX and not SVCD, so quite a bit (read: most) of their process doesn't apply to me. I'm a great fan of DVD2SVCD and would love to figure out a few advanced tricks to improve the appearance of Anime titles.

Here's the gist of it: I want to use some of the image quality improvement filters for VirtualDub -- like Warp Sharp and Donald Graft's excellent SmartSmoother -- but I don't want to have to stop using DVD2SVCD to do it.

In my research I've learned that AVISynth reportedly supports VirtualDub plugins, either by using the LoadVirtualdubPlugin() command, or by importing the vdfilters.avs file and calling the plugin by its name in the imported file. Okay, I'm excited! I set "Edit when dvd2avi processing is done" on under the Frameserver tab and go for it.

But try as I might, every time I've tried to call a function from the vdfilters.avs file or use the LoadVirtualdubPlugin command, DVD2SVCD hangs after auto-completing the first filename dialog box in CCE. I've tried with and without the "ConvertToRGB()/ConvertToYUV()" commands bracing the filter.

I'm perfectly willing to accept that I'm doing something very stupid or wrong here. Unfortunately after surfing through half a dozen sites and scouring all the documentation I could find, there just wasn't much to be seen in terms of either extensive documentation or examples on how to use the filters correctly.

Has anyone else done this successfully? If so, could you paste me your AVISynth script so I could see what you're doing?

Maybe using the VFAPI mode for CCE is the solution? Or could there be an AVISynth compatible plugin I've missed for doing the same sort of image processing as Warp Sharp and/or SmartSmoother? Any help or suggestions would be greatly appreciated. TIA!

markrb
3rd February 2002, 04:18
One of your questions is being answered in a post currently just 1 away from yours.

http://forum.doom9.org/showthread.php?s=&threadid=14275

Donald Graft's excellent SmartSmoother

Donald Graft has posted in there as well.

Mark

isolationism
3rd February 2002, 04:33
Actually that's about the new Decomb filter for AVISynth, not SmartSmoother for VirtualDub. I was the one who posted the question about it to Mr. Graft. :)

I think I mayhave actually solved my own problem, though, after a few hours of banging my head trying to figure it out. I've been tinkering for so long I'm not actually certain what it was that did it, but I THINK it had to do with my trying to return the stream to YUV format at the end of the chain. I don't know why, but when I took that command out it seemed to work okay. I could be wrong.

Right now I'm fiddling around with different settings and trying to find some parameters that work well for this short clip (which will presumably work well for the rest of the movie, too. Heh.) I have added the WarpSharp plugin to my vdfilters.avs file to make it a little quicker to call, and am hoping that in another day or two I might be able to post the relevant scripts up here for others to try, if they want, to see how it works for them.

Cheers and thanks for the reply!

isolationism
3rd February 2002, 19:41
Well, I have had mixed success. For those who are interested, here are my findings.

First of all -- a brief recap of what I was trying to do.

I have an anime movie, Patlabor 2, which I have been using as a guinea pig to try and encode. It's a tougher one as I believe it was an OVA (Original Video Animation) which means it was created solely for broadcast purposes. The contents of the video are at 30fps, but the animation itself is not -- it is at varying FPS, depending on how many frames the animator needed to convey a certain motion accurately. A very still shot might only be 4fps, whereas a pan across scenery is usually at a full 30fps. Needless to say, like all animation, the content is telecined.

First thing I tried to do was use the new IVTC algorithm, hoping it would work out some problems I had with jerky pans earlier. That was my first mistake. While much of the animation itself may be in 24 (or divisible by 24) FPS, the pans are NOT. The pans are all at 30fps, which meant that using an IVTC frame decimator resulted in jerky movement through these pans, as the picture would ghost and jump back and forth quite a bit. Not desirable.

After some help from Donald Graft, I realised the problem was with the IVTC plugin. In order to activate his new Decomb filter automatically, you have to select IVTC in the DVD2AVI tab -- but this ALSO activates decimator. I wanted one but not the other. So in my next attempt, I opted to edit the Avisynth script and manually remove decimate, which was my next mistake. Doing so screws up the timings on the muxing; your audio will be seconds ahead of the video.

Next, I turned IVTC/Force Film to OFF. This is the correct setting here as I don't want to decimate then pulldown -- I want to keep everything at 30FPS so the pans look right. I made sure I was still able to edit the AVIsynth script when DVD2AVI processing is done.

In this script, I made a couple additions. In the list of Plugins:

LoadPlugin("...\Decomb.dll")
Import("C:\win32app\dvd2svcd\vdfilters\vdfilters.avs")

vdfilters.avs is a script file to allow you to use VirtualDub filters easily inside AVISynth. You should be able to find it easily.

Then after the mpeg2source,

telecide

Note that I had selected telecide from the list on the encoding page, but for some reason it seems to have fallen into the bit bucket. Perhaps telecide requires IVTC or a PAL source to be selected to be enabled.

After telecide, I resized the file:

BicubicResize(480,480,0.00,0.75)

Then convert to RGB so I can use Donald Graft's SmartSmoother plugin for VirtualDub (which won't work with YUV video source -- it will crash CCE). Why did I resize it first? Because that means less pixels need to be processed than if I did the colour conversion and filtering first, which results in a speed increase. Additionally, this filter has settings for diameter of pixels -- the diameter can be set lower and achieve the same result on a smaller file, which also results in a speed increase.

So now I call SmartSmoother:

VD_SmartSmoother(5,50,true)

And then I tried to call WarpSharp, which was my third mistake.

WarpSharp apparently uses some kind of "VBitmap" format called "bitblt" which is not supported by AVISynth. If you try to use WarpSharp you'll find your encode goes really fast -- because the video is completely replaced by an error message at the top of the screen telling you what I just did above.

Determined to use WarpSharp to improve my images, I installed VirtualDub and loaded my AVISynth_Script_file.avs that DVD2SVCD generated, selected the WarpSharp filter in VirtualDub, then turned on VirtualDub's frameserver. Then I loaded CCE manually, and set it to encode the signpost from VirtualDub -- meaning that two frameservers were running concurrently. The flow would look like this:

VOB Files --> AVISynth & filters --> VirtualDub & filters --> CCE

Needless to say, this made encoding SLOW. How slow? On a 1.53GHz AthlonXP 1800+ with 512MB of DDR and an ATA133 drive, it took about one hour of processing & encoding time per minute of video.

Ouch.

When it was all said and done, the lines were pretty sharp, yes -- but the encoding was pretty miserable. Bit for bit, CCE has a harder time encoding all the little fine lines, and as a result there was considerably more visible artifacting than without warpsharp.

My suggestion to anime encoders wanting to use DVD2SVCD -- if your source material is 30fps, I recommend using the method above right up until I started getting wacky with VirtualDub. It just wasn't needed and it killed the whole point of having a nice program do everything for you automatically. If you want to improve your source material's quality a bit (especially if it's a bit of a blocky encode) then I strongly endorse using SmartSmoother -- but be ready to pay for it. Without the filter my 4-pass VBR speed is around the .95x speed mark. With it on, that drops down to a much slower .25x (and don't forget that with a 4pass encode + vaf file creation, you're looking at actually 1/4 to 1/5 that 'speed').

Hope this helps!