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 20th June 2022, 11:19   #1  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,241
New challenge: Trigun modern restoration

Perhaps it's time to challenge again the community against one of the most abused DVD in history: Trigun.

It's told nobody could really fix it, since decades.

Is there any brave AVS user able to fix it and properly create a 23.976 good restoration?

Here a clip.
__________________
@turment on Telegram
tormento is offline   Reply With Quote
Old 24th June 2022, 14:29   #2  |  Link
SaurusX
Registered User
 
Join Date: Feb 2017
Posts: 110
I've seen a pretty good AI upscale of Trigun. But what seems to be the general problem with it? You mention 23.976, so is there something off in regards to way pulldown is implemented?
SaurusX is offline   Reply With Quote
Old 24th June 2022, 16:49   #3  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,707
I think the biggest challenge are the halos.
My quick encode https://www.dropbox.com/s/ke7jgc9ent...rigun.mkv?dl=1
Encoded with x264 medium, so don't expect ultra quality.

I think some antialiasing should be applied too.
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database || https://github.com/avisynth-repository
ChaosKing is offline   Reply With Quote
Old 25th June 2022, 07:53   #4  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 6,772
@ChoasKing: Vapoursynth VSGAN(2x_LD-Anime_Skr_v1.0)+DeHalo_Alpha, does a good job with the halos (but is horribly slow on my gpu old, 0.1-0.3fps): https://imgsli.com/MTE0MDU0
__________________
Hybrid here in the forum, homepage
Notice: Since email notifications do not work here any more, it might take me quite some time to notice a reply to a thread,..

Last edited by Selur; 25th June 2022 at 08:22.
Selur is offline   Reply With Quote
Old 25th June 2022, 09:10   #5  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,241
Quote:
Originally Posted by SaurusX View Post
so is there something off in regards to way pulldown is implemented?
Look at the clip.
__________________
@turment on Telegram
tormento is offline   Reply With Quote
Old 25th June 2022, 09:14   #6  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,241
Quote:
Originally Posted by Selur View Post
does a good job with the halos
Nothing available with AVS+?

You did a good job but I see lot of detail loss.

There is the deinterlace/pulldown issue to to be solved properly.
__________________
@turment on Telegram
tormento is offline   Reply With Quote
Old 25th June 2022, 09:15   #7  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,241
Quote:
Originally Posted by ChaosKing View Post
My quick encode
Please post script too.
__________________
@turment on Telegram
tormento is offline   Reply With Quote
Old 25th June 2022, 13:26   #8  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 6,772
Quote:
You did a good job but I see lot of detail loss.
If it's just about cleaning the lines, you could simply mask vsgan with an edgemask. (probably best apply DeHalo_Alpha also masked)


in Avisynth: DeHalo + LUTDeRainbow might be worth a try.
__________________
Hybrid here in the forum, homepage
Notice: Since email notifications do not work here any more, it might take me quite some time to notice a reply to a thread,..

Last edited by Selur; 25th June 2022 at 14:13.
Selur is offline   Reply With Quote
Old 25th June 2022, 15:39   #9  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,707
Quote:
Originally Posted by tormento View Post
Please post script too.
PHP Code:

import vapoursynth 
as vs
import lvsfunc
core 
vs.core

clip 
core.lsmas.LWLibavSource(r'D:\Download\VTS_01_7.VOB')

clip clip.vivtc.VFM(0)
clip clip.vivtc.VDecimate()
o=clip
clip 
core.fmtc.bitdepth(clipbits=16)
haf.SMDegrain(cliptr=3prefilter=2).avs.DGDenoise(strength=0.1blend=0.1)

clip core.fmtc.bitdepth(clipbits=32)
clip clip.bm3dcuda.BM3D(sigma=3radius=4ref=core.fmtc.bitdepth(rbits=32)).bm3d.VAggregate(radius=4)

clip lvsfunc.dehalo.masked_dha(clipref=Nonerx=1.77ry=1.77brightstr=1.0darkstr=0.0lowsens=50highsens=50rfactor=3.0maskpull=48maskpush=192show_mask=False)
clip lvsfunc.dehalo.fine_dehalo(cliprx=2.2ry=2.2
Nothing fine tuned, just quick and dirty test.

w2xncnnvk.Waifu2x() upscale looks also not bad.

@Selur looks good, will try it next. Have you also tried 2x_BIGOLDIES_415000_G.pth ? The sexample looks very good https://imgsli.com/MzI0MDc
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database || https://github.com/avisynth-repository

Last edited by ChaosKing; 25th June 2022 at 15:43.
ChaosKing is offline   Reply With Quote
Old 25th June 2022, 16:32   #10  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 1,267
Sample script 100% vapoursynth. Any relate avs+??
kedautinh12 is offline   Reply With Quote
Old 25th June 2022, 17:25   #11  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,707
Quote:
Originally Posted by kedautinh12 View Post
Sample script 100% vapoursynth. Any relate avs+??
Same scripts exist for avs+ too. Use brain.exe to convert
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database || https://github.com/avisynth-repository
ChaosKing is offline   Reply With Quote
Old 25th June 2022, 18:04   #12  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 1,267
I know but script from Selur need VSGAN(don't support avs+ too)
kedautinh12 is offline   Reply With Quote
Old 25th June 2022, 18:30   #13  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,707
Time to learn something new 😀. Or simply use vapoursource...
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database || https://github.com/avisynth-repository
ChaosKing is offline   Reply With Quote
Old 25th June 2022, 19:03   #14  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,241
As we are talking about... Waifu or GAN?

Any chance to see native portings?
__________________
@turment on Telegram
tormento is offline   Reply With Quote
Old 26th June 2022, 05:10   #15  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 6,772
Waifu2x is available for Avisynth (https://github.com/sunnyone/Waifu2xAvisynth), but probably a lot slower than the Vapoursynth version since from the looks of it it has not gpu support.

Quote:
@Selur looks good, will try it next. Have you also tried 2x_BIGOLDIES_415000_G.pth ?
-> https://imgsli.com/MTE0MTgz has even more detail loss in the background but cleans it up nice
__________________
Hybrid here in the forum, homepage
Notice: Since email notifications do not work here any more, it might take me quite some time to notice a reply to a thread,..
Selur is offline   Reply With Quote
Old 26th June 2022, 09:01   #16  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,241
Quote:
Originally Posted by Selur View Post
Waifu2x is available for Avisynth
Can you post me some example scripts for VS and GAN + WAIFU?

I am totally newbie in that regard.
__________________
@turment on Telegram
tormento is offline   Reply With Quote
Old 26th June 2022, 10:59   #17  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 6,772
Here's an example where I load and apply 2x_AnimeClassics_UltraLite_510K with VSGAN and downscale to the original resolution afterwards:
PHP Code:
# Imports
import vapoursynth as vs
import os
import sys
# getting Vapoursynth core
core vs.core
# Import scripts folder
scriptPath 'i:/Hybrid/64bit/vsscripts'
sys.path.insert(0os.path.abspath(scriptPath))
# Loading Plugins
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/SourceFilter/FFMS2/ffms2.dll")
# Import scripts
import mvsfunc
# source: 'G:\TestClips&Co\files\test.avi'
# current color space: YUV420P8, bit depth: 8, resolution: 640x352, fps: 25, color matrix: 470bg, yuv luminance scale: limited, scanorder: progressive
# Loading source using FFMS2
clip core.ffms2.Source(source="G:/TestClips&Co/files/test.avi",cachefile="E:/Temp/avi_6c441f37d9750b62d59f16ecdbd59393_853323747.ffindex",format=vs.YUV420P8,alpha=False)
# Setting color matrix to 470bg.
clip core.std.SetFrameProps(clip_Matrix=5)
clip clip if not core.text.FrameProps(clip,'_Transfer') else core.std.SetFrameProps(clip_Transfer=5)
clip clip if not core.text.FrameProps(clip,'_Primaries') else core.std.SetFrameProps(clip_Primaries=5)
# Setting color range to TV (limited) range.
clip core.std.SetFrameProp(clip=clipprop="_ColorRange"intval=1)
# making sure frame rate is set to 25
clip core.std.AssumeFPS(clip=clipfpsnum=25fpsden=1)
# changing range from limited to full range
clip core.resize.Bicubic(cliprange_in_s="limited"range_s="full")
# Setting color range to PC (full) range.
clip core.std.SetFrameProp(clip=clipprop="_ColorRange"intval=0)
# adjusting color space from YUV420P8 to RGB24 for vsVSGAN
clip core.resize.Bicubic(clip=clipformat=vs.RGB24matrix_in_s="470bg"range_s="full")
# resizing using VSGAN
from vsgan import ESRGAN
vsgan 
ESRGAN(clip=clip,device="cuda")
model "I:/Hybrid/64bit/vsgan_models/2x_AnimeClassics_UltraLite_510K.pth"
vsgan.load(model)
vsgan.apply() # 1280x704
clip vsgan.clip
# resizing 1280x704 to 640x352
# changing range from full to limited range
clip core.resize.Bicubic(cliprange_in_s="full"range_s="limited")
# Setting color range to TV (limited) range.
clip core.std.SetFrameProp(clip=clipprop="_ColorRange"intval=1)
# adjusting resizing
clip core.fmtc.resample(clip=clipw=640h=352kernel="lanczos"interlaced=Falseinterlacedd=False)
# adjusting output color from: RGB48 to YUV420P10 for x265Model
clip core.resize.Bicubic(clip=clipformat=vs.YUV420P10matrix_s="470bg"range_s="limited"dither_type="error_diffusion")
# set output frame rate to 25.000fps
clip core.std.AssumeFPS(clip=clipfpsnum=25fpsden=1)
# Output
clip.set_output() 
Here I use Waifu through VSGAN:
PHP Code:
# Imports
import vapoursynth as vs
import os
import sys
# getting Vapoursynth core
core vs.core
# Import scripts folder
scriptPath 'i:/Hybrid/64bit/vsscripts'
sys.path.insert(0os.path.abspath(scriptPath))
# Loading Plugins
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/SourceFilter/FFMS2/ffms2.dll")
# Import scripts
import mvsfunc
# source: 'G:\TestClips&Co\files\test.avi'
# current color space: YUV420P8, bit depth: 8, resolution: 640x352, fps: 25, color matrix: 470bg, yuv luminance scale: limited, scanorder: progressive
# Loading source using FFMS2
clip core.ffms2.Source(source="G:/TestClips&Co/files/test.avi",cachefile="E:/Temp/avi_6c441f37d9750b62d59f16ecdbd59393_853323747.ffindex",format=vs.YUV420P8,alpha=False)
# Setting color matrix to 470bg.
clip core.std.SetFrameProps(clip_Matrix=5)
clip clip if not core.text.FrameProps(clip,'_Transfer') else core.std.SetFrameProps(clip_Transfer=5)
clip clip if not core.text.FrameProps(clip,'_Primaries') else core.std.SetFrameProps(clip_Primaries=5)
# Setting color range to TV (limited) range.
clip core.std.SetFrameProp(clip=clipprop="_ColorRange"intval=1)
# making sure frame rate is set to 25
clip core.std.AssumeFPS(clip=clipfpsnum=25fpsden=1)
# changing range from limited to full range
clip core.resize.Bicubic(cliprange_in_s="limited"range_s="full")
# Setting color range to PC (full) range.
clip core.std.SetFrameProp(clip=clipprop="_ColorRange"intval=0)
# adjusting color space from YUV420P8 to RGB24 for vsVSGAN
clip core.resize.Bicubic(clip=clipformat=vs.RGB24matrix_in_s="470bg"range_s="full")
# resizing using VSGAN
from vsgan import ESRGAN
vsgan 
ESRGAN(clip=clip,device="cuda")
model "I:/Hybrid/64bit/vsgan_models/4x_WaifuGAN_v3_30000.pth"
vsgan.load(model)
vsgan.apply() # 2560x1408
clip vsgan.clip
# resizing 2560x1408 to 640x352
# changing range from full to limited range
clip core.resize.Bicubic(cliprange_in_s="full"range_s="limited")
# Setting color range to TV (limited) range.
clip core.std.SetFrameProp(clip=clipprop="_ColorRange"intval=1)
# adjusting resizing
clip core.fmtc.resample(clip=clipw=640h=352kernel="lanczos"interlaced=Falseinterlacedd=False)
# adjusting output color from: RGB48 to YUV420P10 for x265Model
clip core.resize.Bicubic(clip=clipformat=vs.YUV420P10matrix_s="470bg"range_s="limited"dither_type="error_diffusion")
# set output frame rate to 25.000fps
clip core.std.AssumeFPS(clip=clipfpsnum=25fpsden=1)
# Output
clip.set_output() 
Here's an example where I use Waifu2x nvk:
PHP Code:
# Imports
import vapoursynth as vs
# getting Vapoursynth core
core vs.core
# Loading Plugins
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/ResizeFilter/Waifu2x-cnn/waifu2x-ncnn-Vulkan.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/SourceFilter/FFMS2/ffms2.dll")
# source: 'G:\TestClips&Co\files\test.avi'
# current color space: YUV420P8, bit depth: 8, resolution: 640x352, fps: 25, color matrix: 470bg, yuv luminance scale: limited, scanorder: progressive
# Loading source using FFMS2
clip core.ffms2.Source(source="G:/TestClips&Co/files/test.avi",cachefile="E:/Temp/avi_6c441f37d9750b62d59f16ecdbd59393_853323747.ffindex",format=vs.YUV420P8,alpha=False)
# Setting color matrix to 470bg.
clip core.std.SetFrameProps(clip_Matrix=5)
clip clip if not core.text.FrameProps(clip,'_Transfer') else core.std.SetFrameProps(clip_Transfer=5)
clip clip if not core.text.FrameProps(clip,'_Primaries') else core.std.SetFrameProps(clip_Primaries=5)
# Setting color range to TV (limited) range.
clip core.std.SetFrameProp(clip=clipprop="_ColorRange"intval=1)
# making sure frame rate is set to 25
clip core.std.AssumeFPS(clip=clipfpsnum=25fpsden=1)
# adjusting color space from YUV420P8 to RGBS for vsWaifu2xNvk
clip core.resize.Bicubic(clip=clipformat=vs.RGBSmatrix_in_s="470bg"range_s="limited")
# resizing using Waifu2xNvk
# forcing model to 'cunet', upconv can not be used without upscaling
# no resizing only filtering using Waifu2X nvk
clip core.w2xncnnvk.Waifu2x(clip=clipscale=1model=2fp32=False)
# adjusting output color from: RGBS to YUV420P10 for x265Model
clip core.resize.Bicubic(clip=clipformat=vs.YUV420P10matrix_s="470bg"range_s="limited"dither_type="error_diffusion")
# set output frame rate to 25.000fps
clip core.std.AssumeFPS(clip=clipfpsnum=25fpsden=1)
# Output
clip.set_output() 

Cu Selur
__________________
Hybrid here in the forum, homepage
Notice: Since email notifications do not work here any more, it might take me quite some time to notice a reply to a thread,..

Last edited by Selur; 26th June 2022 at 13:08. Reason: code -> php
Selur is offline   Reply With Quote
Old 26th June 2022, 11:33   #18  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,707
You should format your code as php, it's much more readable this way bcs comments are highlighted differently.
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database || https://github.com/avisynth-repository
ChaosKing is offline   Reply With Quote
Old 26th June 2022, 13:08   #19  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 6,772
adjusted post code -> php
__________________
Hybrid here in the forum, homepage
Notice: Since email notifications do not work here any more, it might take me quite some time to notice a reply to a thread,..
Selur is offline   Reply With Quote
Old 26th June 2022, 14:35   #20  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,241
Quote:
Originally Posted by Selur View Post
Cu Selur
Thanks!

Can you please tell me the differences between the upscaling types and what can support CUDA? I have a 1660 SUPER with 6GB of memory. I don't even know if it's enough or I should limit VS threads in some way.

Why don't you apply any IVTC of pulldown or deinterlace of any sort? The DVD source is awful.
__________________
@turment on Telegram
tormento 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:16.


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