Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 23rd January 2008, 23:53   #1  |  Link
Dark Shikari
x264 developer
 
Dark Shikari's Avatar
 
Join Date: Sep 2005
Posts: 8,666
Restoring low-quality Youtube/similar videos

I was looking at this older thread and decided to try a slight modification of his script on some low quality Youtube and Nicovideo sources that I wanted to restore.

After and Before, respectively:



Script:

Code:
Deblock()
dfttest()
FastLineDarken()
deen("a3d",4,8,9)
Spline36Resize(last.width*2,last.height*2)
AddBorders(4, 0, 4, 0)
aWarpSharp(depth=12,blurlevel=4,thresh=0.2,cm=1)
FastLineDarken()
aWarpSharp(depth=6,blurlevel=4,thresh=0.7,cm=1)
Crop(4,0,-4,0)
FastLineDarken()
DeHalo_Alpha()
fft3dgpu(bt=3,sigma=8,sharpen=1.3)
Spline36Resize(last.width/2,last.height/2)
This script is surprisingly effective It even works on blocky gradients, strangely enough, even though the original author designed it for cartoons.
Dark Shikari is offline   Reply With Quote
Old 24th January 2008, 00:40   #2  |  Link
Ranguvar
Registered User
 
Ranguvar's Avatar
 
Join Date: Feb 2007
Location: ::1
Posts: 1,236
That is DISTURBINGLY good quality.

*runs away to use the script for his own nefarious purposes*

Thanks, O Mighty One!
Ranguvar is offline   Reply With Quote
Old 24th January 2008, 00:50   #3  |  Link
Ranguvar
Registered User
 
Ranguvar's Avatar
 
Join Date: Feb 2007
Location: ::1
Posts: 1,236
Heh? Won't encode.

MeGUI reports that there is an expected comma or end parentheses at the end quotes in "a3d" in the deen() line.
Ranguvar is offline   Reply With Quote
Old 24th January 2008, 00:56   #4  |  Link
Dark Shikari
x264 developer
 
Dark Shikari's Avatar
 
Join Date: Sep 2005
Posts: 8,666
Quote:
Originally Posted by Ranguvar View Post
Heh? Won't encode.

MeGUI reports that there is an expected comma or end parentheses at the end quotes in "a3d" in the deen() line.
Do you have all the necessary plugins and scripts (and latest versions thereof)? See the linked thread for links to all of these.
Dark Shikari is offline   Reply With Quote
Old 24th January 2008, 02:10   #5  |  Link
Ranguvar
Registered User
 
Ranguvar's Avatar
 
Join Date: Feb 2007
Location: ::1
Posts: 1,236
Just ignore this please >.<

Last edited by Ranguvar; 24th January 2008 at 02:22.
Ranguvar is offline   Reply With Quote
Old 24th January 2008, 02:11   #6  |  Link
scharfis_brain
brainless
 
scharfis_brain's Avatar
 
Join Date: Mar 2003
Location: Germany
Posts: 3,653
I restored a lot of youtube clips as well for a students video project.
I needed to upsample them to PAL 50i.

Source: http://www.youtube.com/watch?v=eN85MDSYiv4
Filtered: http://rapidshare.com/files/86115836..._kaza.mpg.html


But the script is REALLY bruteforce:
Code:
loadplugin("c:\x\dgdecode.dll")
loadplugin("c:\x\mvtools.dll")
loadplugin("c:\x\ttempsmooth.dll")
loadplugin("c:\x\nnedi.dll")

#load A&V
v=avisource("get_video.avi")
a=wavsource("get video.wav")
audiodub(v,a)

#correct video to true fps
assumefps(30,true)
resampleaudio(48000).getchannel(1,1)

#deblock/dering
s=DeBlock(quant=35).Blindpp(cpu2="ooooxx")

# very strong temporal denoising (stabilisation)
bv2 = s.MVAnalyse(isb = true, truemotion=true, delta = 2, idx = 10, blksize=16)
bv1 = s.MVAnalyse(isb = true, truemotion=true, delta = 1, idx = 10, blksize=16)
fv1 = s.MVAnalyse(isb = false, truemotion=true, delta = 1, idx = 10, blksize=16)
fv2 = s.MVAnalyse(isb = false, truemotion=true, delta = 2, idx = 10, blksize=16)
fc2 = s.MVFlow(fv2, idx=10, thSCD1=500)
fc1 = s.MVFlow(fv1, idx=10, thSCD1=500)
bc1 = s.MVFlow(bv1, idx=10, thSCD1=500)
bc2 = s.MVFlow(bv2, idx=10, thSCD1=500)
interleave(fc2, fc1, s, bc1, bc2) 
ttempsmooth(maxr=2, lthresh=40, cthresh=50)
selectevery(5,2)

#decimate out duped frames
selectevery(6,1,2,3,4,5)

#upscale to double size 
source=nnedi(dh=true,field=0).turnleft().nnedi(dh=true,field=0).turnright().sharpen(0.5)

#interpolate to 50fps for fluent motion
backward_vec = source.MVAnalyse(isb = true, truemotion=true, pel=2, idx=1,blksize=8)
forward_vec = source.MVAnalyse(isb = false, truemotion=true, pel=2, idx=1,blksize=8)
cropped = source.crop(4,4,-4,-4) # by half of block size 8
backward_vec2 = cropped.MVAnalyse(isb = true, truemotion=true, pel=2, idx=2,blksize=8)
forward_vec2 = cropped.MVAnalyse(isb = false, truemotion=true, pel=2, idx=2,blksize=8)
source.MVFlowFps2(backward_vec,forward_vec,backward_vec2,forward_vec2,num=50,idx=1,idx2=2) 
bicubicresize(720,576) #resize to PAL
converttoyuy2()
assumebff() #for PAL-DV
separatefields().selectevery(4,0,3).weave() #reinterlace
EDIT: I played a bit around with MvTools and made this nice 5x slowmotion of it:
http://www.youtube.com/watch?v=2Dag6BTFB2s
__________________
Don't forget the 'c'!

Don't PM me for technical support, please.

Last edited by scharfis_brain; 24th January 2008 at 02:21.
scharfis_brain is offline   Reply With Quote
Old 24th January 2008, 02:20   #7  |  Link
Sagekilla
x264aholic
 
Join Date: Jul 2007
Location: New York
Posts: 1,752
I use a similar script whenever I'm working with animated video. As you can see, it's not perfect but it does remarkably well.

Input


Output
Sagekilla is offline   Reply With Quote
Old 24th January 2008, 02:23   #8  |  Link
Ranguvar
Registered User
 
Ranguvar's Avatar
 
Join Date: Feb 2007
Location: ::1
Posts: 1,236
Pretty cool stuff, Sagekilla. You hvae that script hiding anywhere? Still learning ways to spruce up anime
Ranguvar is offline   Reply With Quote
Old 24th January 2008, 02:27   #9  |  Link
Sagekilla
x264aholic
 
Join Date: Jul 2007
Location: New York
Posts: 1,752
Come to think of it, that sounds EXACTLY like what my filter is doing. Was my filter chain the one you based yours off of?

Code:
toon(0.15)
Deblock(quant=33, bOffset=14)
dfttest()



AAA(Chroma=true)
Spline36Resize(1536,864)

aWarpSharp(depth=12,blurlevel=4,thresh=0.3,cm=1)
LimitedSharpenFaster(edgemode=1,strength=200)
deen("a2d",3,6,6)
Dehalo_alpha()

Spline36Resize(1024,576)

Last edited by Sagekilla; 24th January 2008 at 03:15.
Sagekilla is offline   Reply With Quote
Old 24th January 2008, 02:36   #10  |  Link
Ranguvar
Registered User
 
Ranguvar's Avatar
 
Join Date: Feb 2007
Location: ::1
Posts: 1,236
Green screen problem... got the script working, but VirtualDubMod and MPC play it all greenish.
Attached Images
 
Ranguvar is offline   Reply With Quote
Old 24th January 2008, 02:37   #11  |  Link
Sagekilla
x264aholic
 
Join Date: Jul 2007
Location: New York
Posts: 1,752
Whose script is that bugging out on?
Sagekilla is offline   Reply With Quote
Old 24th January 2008, 02:38   #12  |  Link
Ranguvar
Registered User
 
Ranguvar's Avatar
 
Join Date: Feb 2007
Location: ::1
Posts: 1,236
*points at DS*
Slightly modified for my purposes.

Code:
LoadPlugin("C:\Anime\WarpSharp\warpsharp.dll")
AviSource("MD_01.avi", audio=false)
Deblock()
dfttest()
FastLineDarken()
deen("a3d",4,8,9)
Spline36Resize(last.width*2,last.height*2)
AddBorders(4, 0, 4, 0)
aWarpSharp(depth=12,blurlevel=4,thresh=0.2,cm=1)
FastLineDarken()
aWarpSharp(depth=6,blurlevel=4,thresh=0.7,cm=1)
Crop(14,10,-14,-10)
FastLineDarken()
DeHalo_Alpha()
fft3dgpu(bt=3,sigma=8,sharpen=1.3)
Spline36Resize(640,480)
Tweak(sat=1.1, bright=0.0, cont=1.1)
TextSub("MD_01.ass")
Dup(threshold=4)
Ranguvar is offline   Reply With Quote
Old 24th January 2008, 02:40   #13  |  Link
Sagekilla
x264aholic
 
Join Date: Jul 2007
Location: New York
Posts: 1,752
It seems like the problem is related to dfttest(). By sheer random luck, I was testing dfttest() as a replacement for one of the denoisers in my script and found it to produce odd output. It output an overtly green image, as you said.

Don't know why, but it did.
Sagekilla is offline   Reply With Quote
Old 24th January 2008, 02:47   #14  |  Link
Dark Shikari
x264 developer
 
Dark Shikari's Avatar
 
Join Date: Sep 2005
Posts: 8,666
Quote:
Originally Posted by Sagekilla View Post
It seems like the problem is related to dfttest(). By sheer random luck, I was testing dfttest() as a replacement for one of the denoisers in my script and found it to produce odd output. It output an overtly green image, as you said.

Don't know why, but it did.
Well I've found dfttest to be an important part of that script--its effect is astounding.

Check that you have the latest fft3w library?
Dark Shikari is offline   Reply With Quote
Old 24th January 2008, 02:51   #15  |  Link
Sagekilla
x264aholic
 
Join Date: Jul 2007
Location: New York
Posts: 1,752
Quote:
Originally Posted by Dark Shikari View Post
Well I've found dfttest to be an important part of that script--its effect is astounding.

Check that you have the latest fft3w library?
Indeed, I tried dfttest alone on that clip and it's effects were amazing. But when I used either your filter chain or mine with dfttest instead of the first deen call, I got green screens. Annoyingly enough, I have the fft3w library from FFT3Dfilter and I get this effect with our filter chains.

Last edited by Sagekilla; 24th January 2008 at 02:54.
Sagekilla is offline   Reply With Quote
Old 24th January 2008, 02:53   #16  |  Link
Dark Shikari
x264 developer
 
Dark Shikari's Avatar
 
Join Date: Sep 2005
Posts: 8,666
Quote:
Originally Posted by Sagekilla View Post
Indeed, I tried dfttest alone on that clip and it's effects were amazing. But when I used either your filter chain or mine with dfttest instead of the first deen call, I got green screens.
Video dimensions?
Dark Shikari is offline   Reply With Quote
Old 24th January 2008, 02:55   #17  |  Link
Sagekilla
x264aholic
 
Join Date: Jul 2007
Location: New York
Posts: 1,752
Quote:
Originally Posted by Dark Shikari View Post
Video dimensions?
That could probably be it. My source input is 720x416 though, mod 16. Unless it requires mod 32?

Edit: That makes no sense, I called this before I did any changes to the dimensions and it gave me a green tinted screen. When I used it standalone, I got the normal (and amazing at that) effects.
Sagekilla is offline   Reply With Quote
Old 24th January 2008, 02:57   #18  |  Link
Ranguvar
Registered User
 
Ranguvar's Avatar
 
Join Date: Feb 2007
Location: ::1
Posts: 1,236
I have a 640x480 video, and am using 3.1.2 of fftw.

Swapped out fft3dgpu for fft3dfilter, because it sped things up a good deal. Still green screens. And other color weirdness.
Ranguvar is offline   Reply With Quote
Old 24th January 2008, 03:09   #19  |  Link
Ranguvar
Registered User
 
Ranguvar's Avatar
 
Join Date: Feb 2007
Location: ::1
Posts: 1,236
Update. At least on my end, FastLineDarken() is causing the green-screens. I can comment out only the FLDs and it will work. Even one FLD seems to bork it.

The interesting thing is, depending on which FLD I don't comment out, different things happen. Leaving in the last FLD only will cause green screens everywhere. Leaving in the second only causes weird bubbles of color in the first few frames after you seek somewhere new in MPC. Leaving in the first one only causes the color bubbling for a frame or two, then permanent green screens.

Last edited by Ranguvar; 24th January 2008 at 03:14.
Ranguvar is offline   Reply With Quote
Old 24th January 2008, 03:15   #20  |  Link
Sagekilla
x264aholic
 
Join Date: Jul 2007
Location: New York
Posts: 1,752
Oops, yeah it's FastLineDarken that causes the problem.. Not dfttest. I got the names mixed up when I posted, sorry! Swapped out deen and removegrain for dfttest on my first filter call. Much better results and I think it's slightly faster.
Sagekilla is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:41.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.