Don't use virtualdubmod, use plain virtualdub. Latest stable version is 1.9.9 atm and can be found
here.
As for exporting, you should definitely export as lossless avi: uncompressed for video, wav for audio (16 bit, remember). I know you say it's out of sync, but it's just a playback issue (playing back lossless in real time is hard, especially uncompressed or lagarith).
Now assuming, you want to make xvid+mp3, then load your newly exported avi in virtualdub and go to audio and select full processing. Go to audio again and select compression. Pick lame from the list on the left and chose a kbps of your liking.
For the video, pick fast recompress, then go in the video menu again and select compression this time. Select xvid from the list and click configure. Refer to
this for xvid settings.
Then just go to file > save as avi and select where to save it and let it run.
If you instead wish to make an mp4, then just load the exported avi into zarxgui.
Now to comment your script because I just can't leave it at that: cpu=6 is an excessive parameter, especially considering that this is supposed to be a quasi-lossless export from your NLE. But even if it was a DVD or a raw, you should use cpu=0 and just deblock with something else if there's the need to deblock to begin with.
Fielddeinterlace is far from the best deinterlacer available, so if you need to deinterlace you should use tdeint instead. However, in this case, you should remember to always export as progressive. You shouldn't be needing to deinterlace at this point
Deen is a terrible filter because it blurs WAY too much even at the lightest settings. Really, it's a nuker, kills detail like it was nothing. If you have to denoise a source try ttempsmooth or fft3dfilter instead (depending if it's just a grain excess or there's some nasty heavy noise). However, again, you are compressing your final video. You aren't supposed to need any postprocessing at this point (I personally believe in a proper preprocess of the sources and just that).
Line thinning with awarpsharp is a bad idea, because it distorts the shapes of everything, and that does not look good, trust me. Sometimes, you might need some thinning, sure, and awarpshap can actually be useful to get rid of haloing and ringing too, when used with proper settings, however the default depth of 16 is way too high. Depth 8 is probably as high as you should ever use it
if needed (and trust me, with 98% of source you don't really need it). There also happens to be an awarpsharp2 by now, so you might want to upgrade for the improvements.
As for the last converttorgb32, you're best off without. If you're going to compress with zarxgui, you'd need a converttoyv12 in there, instead. If you were to compress to xvid, then you would be importing the avi itself. Also, the interlaced parameter should be set at fauls at that point, because you had deinterlaced earlier on anyway and at that point your source was progressive for sure.
As an addendum, loading and working with audio within avisynth should be avoided whenever possible. Only do it when there's an absolute need.
That should cover about everything.
