PDA

View Full Version : YouTube video (.FLV) convert to DVD PAL 25.0fps


xbox360
2nd November 2007, 00:08
Hello to Everyone, I need a script that enhances the YouTube low-rez video so it is watchable in DVD PAL 25.0fps mode, thank you.

themostestultimategenius
2nd November 2007, 03:14
Posted by foxy before somewhere. Too lazy to search for it.

DirectShowSource("X:\wherever\myvideo.flv",fps=X,convertfps=true,audio=false)
ConvertToYV12()
Deblock_QED()
Crop(whatever,align=true)
GaussResize(cropped_width*sqrt[1,5],cropped height*sqrt[1.5])
dull=last
sharp=dull.LimitedSharpenFaster(SMode=4,Strength=1000,wide=true,soft=75)
Soothe(sharp,dull,25)
EEDI2().TurnRight().EEDI2().TurnLeft()
FFT3DFilter(sigma=1,bw=32,bh=32,bt=3,ow=16,oh=16,sharpen=0.7)
Spline36Resize(final_width,final_heigth)
Tweak(sat=1.2)
gradfun2db()
AddGrain(5,0,0)
Levels(0,1,255,16,235)

foxyshadis
2nd November 2007, 07:29
That's only partially mine, but a couple of things I'd do (but you're welcome to experiment):

Use strong quant values in deblock_qed, much higher than the defaults. Seriously, youtube is the blocky video olympics world champ. Complement it with something like mvdegrain.

Use NNEDI right after that, only sharpen up afterward. NNEDI works better without preprocessing than EEDI2, normally, though with too-soft video a sharpen or warpsharp can help. Sharpen twice if you have time! With subtlety before EDI, strongly after.

The last line is always wrong, though it becomes equivalent to ColorYUV(levels="PC->TV") if you add coring=true. Since Youtube levels are screwed up in myriad strange and interesting ways, you'll need to use histogram to figure out what levels you need to apply.

Try some combination of seesaw, warpsharp, and shock sharpeners, in addition to LSF. Maybe even after some grain is added.

Chainmax
3rd November 2007, 13:21
themostestultimategenius, a new version of that script would have the following changes:

* Instead of EEDI2().TurnRight().EEDI2().TurnLeft()
use nnediresize2x(true,true,true), with nnediresize2x being the following Avisynth function (that uses NNEDI):

function nnediresize2x(clip c, bool pY, bool pU, bool pV)
{
v = c.nnedi(field=0,dh=true,Y=pY,U=pU,V=pV).turnleft()
v = v.nnedi(field=0,dh=true,Y=pY,U=pU,V=pV).turnright()
return v
}

* Replace FFT3DFilter(sigma=1,bw=32,bh=32,bt=3,ow=16,oh=16,sharpen=0.7)
by source=last
denoised=DegrainMedian(mode=3)
backward_vec2 = MVAnalyse(denoised,isb = true, delta = 2, pel = 2, overlap=4, sharp=1, idx = 1)
backward_vec1 = MVAnalyse(denoised,isb = true, delta = 1, pel = 2, overlap=4, sharp=1, idx = 1)
forward_vec1 = MVAnalyse(denoised,isb = false, delta = 1, pel = 2, overlap=4, sharp=1, idx = 1)
forward_vec2 = MVAnalyse(denoised,isb = false, delta = 2, pel = 2, overlap=4, sharp=1, idx = 1)
MVDegrain2(source,backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=400,idx=2)
(you'll need MVTools and DeGrainMedian for this)

* Add a LimitedSharpenFaster(SMode=4,Strength=200) line right after the Spline36Resize one.


* Set gradfun2db's thr value to something higher than defaults, like, say, 2.4.

* Maybe use RemoveGrain(mode=5) right after the deblock_qed line in order to remove stray pixels.

* More importantly, the levels line should be tweaked. Grab an utility like CSamp that lets you see the RGB values of whatever you point with the mouse cursor. Now, move to a frame whgere you can see a scene with a purely white fragment, take the CSamp values and enter those instead of the 255 one. Do the same but with a pure black fragment and put that value instead of the 0 one.


For anime, I'd add use the following between the Spline36Resize and Tweak lines:

aWarpSharp(depth=16,cm=1)
vmToon(thinning=0,strength=X,sharpen=false) with X between 100 and 150
LimitedSharpenFaster(SMode=4,Strength=200)



foxyshadis, are you sure SeeSaw is a good idea for YouTube videos? I never got atisfactory results with it other than on somewhat clean sprces like DVDs.

themostestultimategenius
3rd November 2007, 15:06
Ah thanks. Just saved that script because I thought it might come in handy sometime or another.

Usually I use DirectShowSource with strong SPP deblocking and then adding a little noise so it doesn't look so soft.

Didée
3rd November 2007, 16:06
* Replace FFT3DFilter(sigma=1,bw=32,bh=32,bt=3,ow=16,oh=16,sharpen=0.7)
by source=last
denoised=DegrainMedian(mode=3)
backward_vec2 = MVAnalyse(denoised,isb = true, delta = 2, pel = 2, overlap=4, sharp=1, idx = 1)
backward_vec1 = MVAnalyse(denoised,isb = true, delta = 1, pel = 2, overlap=4, sharp=1, idx = 1)
forward_vec1 = MVAnalyse(denoised,isb = false, delta = 1, pel = 2, overlap=4, sharp=1, idx = 1)
forward_vec2 = MVAnalyse(denoised,isb = false, delta = 2, pel = 2, overlap=4, sharp=1, idx = 1)
MVDegrain2(source,backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=400,idx=2)

Recall ... that's a result of a past suggestion from me, which you didn't get fully correct.
It was about strong-grain sources, and I suggested to use a different pre-denoised clip for ME search before feeding the original into MVDegrain, to get lower SAD values. (It's a bit wacky to want a filter reducing differences, but as soon as there are differences, reduce the filter's strength. )
However, for this procedure one needs a *strong* pre-denoiser. A hot-pixel remover like DegrainMadian(mode=3) is too weak to get much useful out of the method; should give not much difference to the "normal" usage, only slower and more ressource hungry, for not much benefit.

Chainmax
3rd November 2007, 18:30
What would be a suitable strength then, a default call of maybe something like DeGrainMedian(limitY=5,limitUV=7,mode=0)?

Didée
3rd November 2007, 19:11
Archive with 4 differently encoded samples, the script used, and a brief explanation+conclusion:
Rapidshare (http://rapidshare.com/files/67215370/MVDegrain_tricks.rar.html) | or | MediaFire (http://www.mediafire.com/?e3zvjwbl2hx)

There's no plain answer to what would be "suitable". It depends on the source, i.e the amount/strength of noise/grain that should be removed.

The main point is this: there are differences due to noise. Period. MVDegrain should reduce its strength only because of "bad compensation". When big SADs are caused just by the noise, then MVDegrain reduces its strength for no good reason.
That's why I suggested to use some prefiltering that completely removes all noise. When the SADs are computed from a clip that contains no noise anymore, then any differences after motion compensation cannot be caused by noise anymore, only by (any kind of) "bad" compensation.

An upfollowing problem is that, using MVDegrain, you cannot de-couple the motion search from the pre-denoising. (Necessary prefiltering to remove *all* noise & flicker might remove so much that motion search can suffer). That's why MVDegrain hardly ever appears in my toying-with-MC-denoise scripts: Not enough controlling knobs for what should be done, so everything has to be build up manually.

xbox360
4th November 2007, 05:07
Recomended software to use when downloading .flv file's is Ashampoo ClipFinder, it has the latest fix so no bugs at all so far i've tested.

DirectShowSource("X:\wherever\myvideo.flv",fps=X,convertfps=true,audio=false)
ConvertToYV12()
Deblock_QED()
Crop(whatever,align=true)
GaussResize(cropped_width*sqrt[1,5],cropped height*sqrt[1.5])
dull=last
sharp=dull.LimitedSharpenFaster(SMode=4,Strength=1000,wide=true,soft=75)
Soothe(sharp,dull,25)
EEDI2().TurnRight().EEDI2().TurnLeft()
FFT3DFilter(sigma=1,bw=32,bh=32,bt=3,ow=16,oh=16,sharpen=0.7)
Spline36Resize(final_width,final_heigth)
Tweak(sat=1.2)
gradfun2db()
AddGrain(5,0,0)
Levels(0,1,255,16,235)

What plugins & scripts do I need for the above & where can I get them? please help,thank you. A download pack would be awesome !

xbox360
4th November 2007, 09:59
LoadPlugin("D:\Program Files\AviSynth 2.5\plugins\MaskTools.dll")
LoadPlugin("D:\Program Files\AviSynth 2.5\plugins\RemoveGrain.dll")
LoadPlugin("D:\Program Files\AviSynth 2.5\plugins\degrainmedian.dll")
LoadPlugin("D:\Program Files\AviSynth 2.5\plugins\repair.dll")
LoadPlugin("D:\Program Files\AviSynth 2.5\plugins\mvtools.dll")
LoadPlugin("D:\Program Files\AviSynth 2.5\plugins\DctFilter.dll")
LoadPlugin("D:\Program Files\AviSynth 2.5\plugins\mt_masktools.dll")
Import("D:\Program Files\AviSynth 2.5\plugins\SeeSaw.avsi")
Import("D:\Program Files\AviSynth 2.5\plugins\deblock_qed.avsi")

DirectShowSource("C:\Sanjay Downloads\YouTube Videos\Dolby Digital Cinema.flv",fps=25.0, audio=true)
spline36resize(720,576)

backward_vec2 = last.MVAnalyse(isb = true, delta = 2, pel = 2, overlap=4, sharp=1, idx = 1,blksize=16)
backward_vec1 = last.MVAnalyse(isb = true, delta = 1, pel = 2, overlap=4, sharp=1, idx = 1,blksize=16)
forward_vec1 = last.MVAnalyse(isb = false, delta = 1, pel = 2, overlap=4, sharp=1, idx = 1,blksize=16)
forward_vec2 = last.MVAnalyse(isb = false, delta = 2, pel = 2, overlap=4, sharp=1, idx = 1,blksize=16)
a = last.MVDegrain2(backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=400,idx=1)
b = a.degrainmedian(mode=1)
SeeSaw(a,b, NRlimit=5, NRlimit2=6,Sstr=1.5, Slimit=8, Sdamplo=40, Spower=4, Szp=16,soothet=100, sootheS=95)

Deblock_QED(quant1=24, quant2=22, aOff1=2, bOff1=4, aOff2=4, bOff2=8, uv=1)


I am getting this error:

Resize source image too small for this resize method (line 12)

How do I fix this error ? please help ASAP !!:(

Leak
4th November 2007, 10:46
How do I fix this error ? please help ASAP !!:(
That error means your input to Spline36Resize is smaller than 4x4 pixels - I guess something's gone horribly wrong when opening your video with DirectShowSource...

np: Saul Williams - Tr(n)igger (The Inevitable Rise and Liberation of NiggyTardust!)

xbox360
4th November 2007, 10:53
Any fast solution ? please.:(

Leak
4th November 2007, 15:12
Any fast solution ? please.:(
How about not relying on other people's help for once and just, you know, systematically look for the error? That's the fastest solution, and it even works without an internet connection...

Obviously the resizing goes wrong, so what happens if you comment it and all following lines out, leaving only the DirectShowSource line active?

It's not rocket science, you know... :rolleyes:

np: Saul Williams - Break (The Inevitable Rise and Liberation of NiggyTardust!)