制作所需软件:
DVD2AVIdg/MPEG2DEC3dg Version 1.0.0AviSynth 2.5.2XviD MPEG4 codecVirtualDubMod 1.5.4.1AviSynth_250 plugins: Decomb5.0.0Gordian Knot 0.281.用DVD2AVI分离mpeg2文件的音频流,确定视频流的规格信息.
首先选择Video - Field Operation,设置为None。按F5开始预览。让它运行一会儿,观察status窗口。这里有两个你需要记住的东西:第一个是Aspect Ratio,要么是16:9要么是4:3,另一个是frame type。
[*]Frame Rate = 25.000 fps: 视频源是PAL制式的。如果frame type是隔行扫描(Interlaced)的,再次开始预览,仔细观察。如果你没有看到水平黑线那么实际上图像是逐行扫描(progressive)的,这里的工作就已经完成了。如果出现黑线,那么尝试着改变场序:选择Video - Field Operation - Swap Field Order,然后重新预览。如果依然看到黑线就把Field peration重设为None并进行Deinterlace(过程在后面详述);否则就算是完成了。
[*]Frame Rate = 20.000 fps: 视频源是PAL制式的,你打开了Forced Film。把Field Operation设为None就可以得到正确的帧率。
[*]Frame Rate = 29.970 fps: 预览几分钟,看Video Type:如果是FILM,百分比高于或等于95%或者只显示FILM那么你就打开Forced FILM,否则就要进行IVTC(过程在后面详述),例如只显示NTSC就只能做IVTC。
[*]Frame Rate = 23.976 fps: 这是在NTSC电影中打开Forced FILM的后果。如果Video Type是FILM,或者是百分比高于或等于95%的FILM,那么这就完全正确,否则你需要把Field Operation设为None并进行IVTC(过程在后面详述)。
最后根据情况保存DVD2AVI工程文件
①视源全部为Progressive的或者Video Type是FILM并打开了Forced Film
File->Save Project [F4]
②视源是Interlaced的或者部分Interlaced部分Progressive
File->Save Project (1.76)
2.编写Avisynth script生成avs档
下是一个Avisynth script模板,带"#"内容以不起作用,根据使用情况去掉或者加上
根据上述①②分两种情况:
①的情况(YV12制程)
mpeg2_P.avs:- LoadPlugin("MPEG2Dec3dg.dll")
- mpeg2source("xxx.d2v")
- crop(6,4,-6,-4)
- LanczosResize(640,480)
- # DENOISING: choose one combination (or none)
- #LoadPlugin("UnDot.dll")
- #UnDot()
- #UnDot is a simple median filter for removing dots, that is stray orphan pixels and
- #mosquito noise. It basicly just clips each pixel value to stay within min and max
- #of its eight surrounding neigbors.
- #LoadPlugin("Convolution3d.dll")
- #Convolution3d("movielq")
- #Convolution3d (preset="movieHQ") // Movie Hi Quality (good DVD source)
- #Convolution3d (preset="movieLQ") // Movie Low Quality (noisy DVD source)
- #Convolution3d (preset="animeHQ") // Anime Hi Quality (good DVD source)
- #Convolution3d (preset="animeLQ") // Anime Low Quality (noisy DVD source)
- #Convolution3d (preset="animeBQ") // Anime Bad Quality (???)
- #Convolution3d (preset="vhsBQ") // VHS capture Bad Quality (???)
②的情况(YUY2制程)
mpeg2_I.avs:- LoadPlugin("LoadPluginEx.dll")
- LoadPlugin("MPEG2DEC2.dll")
- mpeg2source("xxx.d2v")
- #首先确定你DVD2AVI时是把Field Operation设为None,否则不要使用以下内容
- LoadPlugin("Decomb500.dll")
- #FieldDeinterlace()
- #影片做Deinterlace (Frame Rate:25.000 fps, Video Type:PAL,Frame Type:Interlaced)
- #预览画面,仔细观察。如果你没有看到水平黑线那么实际上图像是progressive的,则影片不用做Deinterlace
- #Telecide(order=1,guide=1)
- #Decimate(cycle=5)
- #影片做IVTC (Frame Rate:29.970 fps, Frame Type:Interlace, Field Order:Top Field First, NTSC 3:2 pulldown)
- #若影片的Field Order是Bottom Field First,则设置order=0;不是3:2 pulldown的去掉",guide=1"
- #判断Field Order和3:2 pulldown的方法请看order_guide.avs
- crop(8,66,-6,-60)
- #切边:最后兩个数字一定要为负数,所以請手動加上"-"
- #按照GK的Resolution里面的数值填上Crop(left,top,-width,-height)
- LanczosResize(640,352)
- #放大縮小,按照GK的Resolution里面的Width x Height数值填上LanczosResize(width,height)
- #LumaFilter(+10,1.1)
- #亮度滤镜
- #变暗:LumaFilter(-10,0.9)
- #变亮:LumaFilter(+10,1.1)
- #LumaFilter(clip, integer "lumoff", float "lumgain")
- #the transfomation is : yy = (y*lumgain)+lumoff
- #lumoff : Luminosity offset. default = -2 (for iago ^^)
- #lumgain : Luminosity gain. default = 1
- # DENOISING: choose one combination (or none)
- #LoadPlugin("UnDot.dll")
- #UnDot()
- #LoadPlugin("FluxSmooth-2.5.dll")
- # little noise
- #FluxSmooth(5,7)
- # medium noise
- #FluxSmooth(7,7)
- # heavy noise
- #FluxSmooth(10,15)
- #调用字幕
- #LoadPlugin("VSFilter.dll")
- #TextSub("xxx.ssa")
order_guide.avs:- LoadPlugin("LoadPluginEx.dll")
- LoadPlugin("MPEG2DEC2.dll")
- LoadPlugin("Decomb500.dll")
- mpeg2source("xxx.d2v")
- AssumeTFF().SeparateFields()
- #Telecide(order=1,guide=1,post=0,show=true)
- # 1.Set the Field Order:
- #Add a script line to separate the fields using top field first, as follows:
- #AssumeTFF().SeparateFields()
- #Now serve the script into VirtualDub and find an area with motion. Single step forward
- #through the motion. Note whether the motion progresses always forward as it should, or
- #whether it jumps back and forth as it proceeds. For example, if the field order is wrong,
- #an object moving steadily from left to right would move right, then jump back left a
- #little, then move right again, etc. If the field order is correct, it moves steadily to
- #the right.
- #If the motion is correct with AssumeTFF().SeparateFields(), then your field order is top
- #field first and you must set order=1. If the motion is incorrect, then your field order
- #is bottom field first and you must set order=0
- # 2.Set up Pattern Guidance:
- #Second, you can serve the following script into VirtualDub and see what Telecide() reports
- #about it (remember to use the correct field order as you determined it above).
- #AviSource("your_clip.avi")
- #Telecide(order=1,guide=1,post=0,show=true)
- #Serve this into VirtualDub and step through several typical sections of your clip. If
- #Telecide() reports "in-pattern", or "in-pattern*", then it is locking onto 3:2 pulldown.
- #If it reports "out-of-pattern" or continuously jumps in and out of pattern lock, then it
- #is not locking onto a consistent 3:2 pattern.
- #If you determine that your clip has a lot of 3:2 content, then you should go ahead and set
- #guide=1. If there is not a lot of 3:2 content, or you have any doubts about the nature of
- #the clip, then you should set guide=0.
以上avs需要用VirtualDubMoD打开预览并根据情况修改相关内容,直到预览的画面没有问题再进行下一步的真正编码.
3.用VirtualDubMoD打开最终的avs档,进行MPEG-4编码,生成Avi档
Video-->Fast recompress
xvid 1psss setting:
Global选项里
Quantization type-->H.263
VHQ mode--> 0-Off
Maximum / Minimum I-frame interval-->240 / 1
将最大关键帧设为每秒帧数的10倍(例如:240、250、300)
Use Chroma motion
Maximum B-frames-->2
B-frames quantizer ratio(%)-->100
B-frames quantizer offset-->1
B-frames threshold-->0
DX50 B-VOP compatibility
Two Pass里:
在1st pass stats指定一个目录来保存video.stats
File->save as...(F7)开始做1pass
完成后在Gordian Knot中的NanDUB Files中,OPEN打开XVID 1st pass建立的video.stats文件。
回到GK的Bitrate界面上,进行码流计算和決定要做成多少CD版本.通过调整Total File Size使Video Size/1st Pass Size的比值在30%-40%左右就可以达到质量和大小之间的平衡了.
拷贝在Video Size 這一栏里的那个xxxxxx KB的值,这个在VirtualDubMoD做2pass-int时会用到
2 Pass - 2nd pass int setting:
在Desired size(Kbtyes)填入之前在GK拷贝的那个值,即刚才在GK计算记下Video Size的大小(KB那个数值)
Advanced option...
B-frames quantizer offset-->200
Two Pass:
确定1st pass stats为之前做1pass时生成的video.stats文件
Bitrate payback delay (frames)->240
应设为每秒帧数的10倍(例如:240、250、300)
在Debug里:
把Chroma Optimizer和Use trellis R-D quantisation(该选择只对H.263有效)都选上
File->save as...(F7)开始做2pass
4.最后用VDM或NanDub合成音频流.
附上xvid-dev-api-4-2003-10-05的推荐设置
2-pass,chroma motion,h263,vhq4,BVOPs=2,ratio=1,offset=2,Trellis quantisation