Log in

View Full Version : VDubMod with Avisynth, take II


eswrite
1st April 2005, 21:16
Okay, here's what I have done so far:

1) Captured an MPEG2 file with a PVR-250 capture card.
2) Used DGIndex to load MPEG2 and save project: wg_cc.d2v.
3) Created the following file (wg_cc.avs):
---
loadplugin("C:\Program Files\VDM\AviSynth 2.5\plugins\MPEG2Dec.dll")

mpeg2source("wg_cc.d2v")
---
4) Open wg_cc.avs in VirtualDubMod, and I get the following error:
Avisynth open failure:
MPEG2Source: couldn't open file
(C:\Downloads\Video\wg_cc.avs, line 2)

What am I doing wrong?

Guest
1st April 2005, 21:58
DGIndex works only with its matching DGDecode. It does not work with MPEG2Dec.dll.

eswrite
1st April 2005, 22:17
Thanks for the prompt response. I changed my .avs file to read:
---
loadplugin("C:\Program Files\VDM\DGMPGDEC\DGDecode.dll")
mpeg2source("wg_cc.d2v")
---

Now I get the following warning:

"Couldn't locate decompressor for format 'YV12' (unknown)
VirtualDub requires a Video for Windows VFW compatible codec to decompress video. DirectShow codecs, such as those used by Windows Media Player, are not suitable. Only 'Direct stream copy' is available for this video."

Does this mean I first have to write this out as an AVI (without compression, because the Compression option is disabled), then process that with Avisynth script/filters?

Wilbert
1st April 2005, 22:27
You need a YV12 decompressor. So, install XviD or DivX.

eswrite
1st April 2005, 22:47
You need a YV12 decompressor. So, install XviD or DivX.

The Helix YV12 / I420 VFW Codecs (http://forum.doom9.org/showthread.php?s=&threadid=56972&highlight=VFW+YV12+Helix) are recommended in the Avisynth board. Am I correct in assuming I shouldn't install both YV12 codecs (Helix and Xvid)?

Guest
2nd April 2005, 00:16
It doesn't matter, as long as VirtualDub can find one. If you have a preferred codec, then installing only that one is a reliable way to ensure that it will be used. Otherwise, you'd have to ensure that it had a greater priority.

An alternative is to convert to YUY2 or RGB in the Avisynth script. But whether you want to do that or not depends on what you plan to do with the decoded frames.

eswrite
2nd April 2005, 11:23
I've gotten quite a bit further, applying various filters with Avisynth in VDubMod. However, I am noticing that after starting with a 720x480 MPEG2 file (VCR capture with PVR-250) that fills the entire screen, the output AVI file differs: the video is squeezed just a bit vertically, with a thin black bar at the top, and several (4-8?) out of sync lines at the bottom. This is for a simple non-filtering script (all filtering commented out) such as:
---
#Create project with DGIndex to generate .d2v file. Then load
#DGDecode plugin and use it as MPEG2Source.
#--This requires VFW YV12 Codec: use Helix codecs.
loadplugin("C:\Program Files\VirtualDub\DGMpgDec\DGDecode.dll")

#Load processing/filtering plugins
loadplugin("C:\Program Files\VirtualDub\AviSynth 2.5\plugins\Decomb521.dll")
#loadplugin("C:\Program Files\VirtualDub\AviSynth 2.5\plugins\MSmooth.dll")
loadplugin("C:\Program Files\VirtualDub\AviSynth 2.5\plugins\MSharpen.dll")

#Load video de-muxed by DGIndex
mpeg2source("wed_proc.d2v")

#Process/filter here:

#Telecide(order=1,guide=0,post=2,vthresh=40)
#Decimate()
#MSharpen(threshold=15,strength=50,highq=true)
---

So, when I "Save As..." AVI file in VDubMod, this should be a straight conversion. What is causing the above-described inaccuracy?

I'm running:
VDubMod 1.5.10.1 build 2366
Avisynth 2.55
DGIndex/DGDecode 1.3.0 beta5

Guest
2nd April 2005, 15:58
It's typical for VCR captures to be crappy like that. The out of sync stuff is head-switching noise. You can crop the bad stuff.

eswrite
2nd April 2005, 17:26
It's typical for VCR captures to be crappy like that.
Even if the MPEG2 captured file (pre-VDuMod+Avisynth) doesn't show any out of sync video at the top/bottom boundaries?

The out of sync stuff is head-switching noise. You can crop the bad stuff.
I had thought about giving cropping a try. I'll also have to re-size vertically, so that H=480, right? Otherwise the video won't be DVD compatible.

Guest
2nd April 2005, 18:16
Originally posted by eswrite
Even if the MPEG2 captured file (pre-VDuMod+Avisynth) doesn't show any out of sync video at the top/bottom boundaries? I don't believe you're getting artifacts that aren't in the source. Put a fragment of the unprocessed source M2V on my server and tell me the filename. I'll find out the source of your artifacts.

I had thought about giving cropping a try. I'll also have to re-size vertically, so that H=480, right? Otherwise the video won't be DVD compatible. Correct. But if you plan to do any decombing, do it before resizing.

eswrite
2nd April 2005, 18:35
No need to upload a clip. I used VideoReDo to confirm that indeed there is some out of sync lines at top and bottom.

...if you plan to do any decombing, do it before resizing.

Thanks. That was going to be my next question. :p

Here's my latest script:
---#Create project with DGIndex to generate .d2v file. Then load
#DGDecode plugin and use it as MPEG2Source.
#--This requires VFW YV12 Codec: use Helix codecs.
loadplugin("C:\Program Files\VirtualDub\DGMpgDec\DGDecode.dll")

#Load processing/filtering plugins
loadplugin("C:\Program Files\VirtualDub\AviSynth 2.5\plugins\Decomb521.dll")

mpeg2source("cc_load.d2v")

#Process/filter here
Telecide(order=1,guide=1,post=2,vthresh=39)
Decimate()
BilinearResize(720,516)
Crop(0,8,720,480)
---

This has the effect of cleaning up most of the jaggie-effect along diagonal lines which shows up in some portions of the video but not others. I'm wondering what else I can do to clean up the video, but I'm beginning to think that with VHS, this is really the best I can do.

Guest
3rd April 2005, 06:25
Of course, you'd only want to IVTC if your source is film.

You imply that you want to make a DVD. If so, and you do IVTC, you'll have to use pulldown to get it back to a DVD standard framerate.

Another option is to just leave the video interlaced.

eswrite
3rd April 2005, 12:29
Of course, you'd only want to IVTC if your source is film.

Yeah. The video I've been cleaning up is a clay animation short I want to xfer to DVD before the VHS tape gives up the ghost.

You imply that you want to make a DVD. If so, and you do IVTC, you'll have to use pulldown to get it back to a DVD standard framerate.

My DVD authoring sw (ULead MovieFactory) does that on the fly, but I'll keep it in mind for when I want to keep control of how this is done. Which filter do you recommend to restore pulldown after processing (i.e., after de-interlace, sharpen, etc.)?

Another option is to just leave the video interlaced.
For my wedding video, it looks like this is definitely the best option. I followed your procedure for detecting 3:2 pulldown, and it looks like there is very little of it. I do still want to do some mild, hq sharpening, and I've been trying out your MSharpen filter. In the past, for still images, I have used the technique of increasing image size, sharpening, then going back down to original size, which gives good results. I usually double image dimensions, do an unsharp mask, then back to the original image dimensions. Is this also a good idea with video? In the VDubMod filter collection, I found an unsharp filter. Since I'm using AVIsynth now, I can't use that filter any longer (right?). How does your MSharp filter compare? I haven't been able to find an Avisynth version of the unsharp filter (just downloaded WarpSharp to test).

BTW, thanks for all your help and the filters you have created.

Guest
3rd April 2005, 16:34
Originally posted by eswrite
Which filter do you recommend to restore pulldown after processing (i.e., after de-interlace, sharpen, etc.)? DGPulldown on the MPEG2 elementary stream.

Is this also a good idea with video? In the VDubMod filter collection, I found an unsharp filter. Since I'm using AVIsynth now, I can't use that filter any longer (right?). How does your MSharp filter compare? I haven't been able to find an Avisynth version of the unsharp filter (just downloaded WarpSharp to test). Treatment of interlaced material requires special handling. Usually you split the fields, process them, and then reassemble them. But as scharfis_brain has shown, even that must be done correctly to avoid problems. MSharpen is useful because it acts on edge areas, thereby avoiding amplifying noise in flat areas. You can import VirtualDub filters into Avisynth scripts. But UnsharpMask is just a standard sharpenng kernel and you can get similar results with Avisynth's Sharpen().

WildCelt
4th April 2005, 13:55
Originally posted by neuron2
Treatment of interlaced material requires special handling. Usually you split the fields, process them, and then reassemble them. But as scharfis_brain has shown, even that must be done correctly to avoid problems.

Sorry for the slightly OT question, but can you point me to where this was discussed? I have had problems with interlaced material not looking so hot when weaved back together.

Guest
4th April 2005, 14:24
Originally posted by WildCelt
Sorry for the slightly OT question, but can you point me to where this was discussed? I have had problems with interlaced material not looking so hot when weaved back together. See here:

http://forum.doom9.org/showthread.php?s=&postid=620370

WildCelt
4th April 2005, 15:38
Thank you, sir!

eswrite
4th April 2005, 18:03
@neuron2
DGPulldown on the MPEG2 elementary stream.

Where can I get this plugin? I see DGBob on your site, but can't find DGPulldown there or in the plugin download links for AVISynth.

EDIT: never mind. just saw that DGPullDown is a stand-alone video-only application. This won't work very well for me, since I want to avoid yet another step in my process: I want to feed the muxed audio and video (AVI) file into my DVD authoring sw.

Guest
4th April 2005, 20:50
In that case, your authoring program is doing the MPEG2 encoding and it may have a pulldown capability. You'll have to investigate if it does or not.

If it does not, you can implement "hard telecining", using scripts that Xesdeeni has promulgated.

If you want to avoid all "extra steps" you can buy a DVD recorder and eliminate all the steps. :)