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 12th March 2023, 18:48   #1  |  Link
shadowlink
Registered User
 
Join Date: Feb 2017
Posts: 4
fixe line in anime

Hello everyone, I hope someone can help me. On some anime bonuses, I have contour lines that are not clear.
I tried with an antialiasing but it doesn't work. I don't know the name of this defect or what filters to use.
I have a mkv raws from the same source that doesn't have this problem but it is badly encoded with a bad framerate

when I endode it is like this:
https://zupimages.net/viewer.php?id=23/10/5z71.bmp

raw in mkv :
https://zupimages.net/viewer.php?id=23/10/srfn.bmp

video:
https://mega.nz/file/UOx0lRxL#5RnbSK...1oIc0tiaGIJu5k

thank !!
shadowlink is offline   Reply With Quote
Old 12th March 2023, 22:57   #2  |  Link
Tempter57
Registered User
 
Join Date: Jan 2011
Location: Donetsk
Posts: 58
Quote:
Originally Posted by shadowlink View Post
Hello everyone, I hope someone can help me. On some anime bonuses, I have contour lines that are not clear.
I tried with an antialiasing but it doesn't work. I don't know the name of this defect or what filters to use.
I have a mkv raws from the same source that doesn't have this problem but it is badly encoded with a bad framerate

when I endode it is like this:
https://zupimages.net/viewer.php?id=23/10/5z71.bmp

raw in mkv :
https://zupimages.net/viewer.php?id=23/10/srfn.bmp

video:
https://mega.nz/file/UOx0lRxL#5RnbSK...1oIc0tiaGIJu5k

thank !!
My script
Code:
prefix="C:\Program Files (x86)\AviSynth+\"
AddAutoloadDir(prefix+"plugins64")

setmemorymax(8000)

video = LWLibavVideoSource("C:\Users\Alex\Downloads\00000.m2ts", stream_index=-1, cache=true, dr=false).AssumeFPS(29.970)
audio = LWLibavAudioSource("C:\Users\Alex\Downloads\00000.m2ts", stream_index=1, cache=true, av_sync=false)
AudioDub(video, audio)

ConvertToYV12(interlaced = true)

#pre = last.nnedi3(field=-2).DestripeH().DestripeV().NonlinUSM(pow=1.0, rad=2, str=0.5)
#QTGMC(Preset="Placebo", NoiseProcess=0, edithreads=0)
QTGMC(Preset="fast", sharpness=0.3, edithreads=0)

Crop(244, 134, -244, -134)

ContinuityFixer(left=2, top=2, right=2, bottom=4, radius=2)
spline64resize(428, 240)

srestore(frate=23.976)
maa2()

nnedi3_rpow2(2,cshift="spline64resize",fwidth=852,fheight=480)
awarpsharp(depth=12)
sharpen(0.3)

nnedi3_rpow2(2,cshift="spline64resize",fwidth=1280,fheight=720)
awarpsharp(depth=10)
sharpen(0.3)

maa2()

FastLineDarkenMod4(strength=28,threshold=1, thinning=9,luma_cap=200).awarpsharp(depth=8)
LSFplus(preset="fast", strength=40, preblur="ON")

f3kdb(16,64,64,64,32,16, sample_mode=2,dynamic_grain=false,keep_tv_range=false,dither_algo=3,mt=false)

Last edited by Tempter57; 12th March 2023 at 23:09.
Tempter57 is offline   Reply With Quote
Old 13th March 2023, 00:40   #3  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,259
I would try to separate into fields and apply the anti-aliasing before the deinterlacing.
Since I was playing around with Vapoursynth (script: https://pastebin.com/epkpxVMr)
here a few Images how aa before deinterlacing could end up:
https://imgsli.com/MTYxNzky, https://imgsli.com/MTYxNzk1, https://imgsli.com/MTYxNzk2, https://imgsli.com/MTYxNzk3

Cu Selur
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 13th March 2023, 01:37   #4  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,664
The main problem with this source is cross conversion. But is also has other problems with a few blended scenes and orphaned fields every now and then.

Code:
DGSource("00000.dgi")
Crop(242,132,-242,-132)
TFM(pp=0)
TDecimate()
o = last
Debilinear(width/2, height/2)
NNEDI3CL(1, dh=true, dw=true)
Spline36Resize(Width(), Height(), src_left=-0.5, src_top=-0.5)
#Interleave(o,last)
Result: https://imgsli.com/MTYxODEx

I don't have much experience with anime so I just guessed on the desample resolution.
Reel.Deel is offline   Reply With Quote
Old 13th March 2023, 03:53   #5  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,352
Based on Reel.Deel's:
Code:
DGSource("00000.dgi",cl=242,ct=132,cr=242,cb=132)

DGTelecide()
TDecimate(mode=1) # anime


DebilinearResizeMT(width/2, height/2)

ConvertBits(32)
ConvertToPlanarRGB(matrix="709:l")
mlrt_ncnn(network_path="2X_DigitalFilmV5_Lite.onnx", builtin=false)
ConvertToYUV420(matrix="709:l")
ConvertBits(8,dither=1)

RatioResize(1280, "adjust2w", kernel="RobiSharp")
ex_smooth(1,0,sharp=true)
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 13th March 2023, 04:57   #6  |  Link
flossy_cake
Registered User
 
Join Date: Aug 2016
Posts: 605
This will do 60fps on an i5-4570 (4c/4t @ 3.4ghz)

Code:
# inverse telecine to 24p with frame blending of 30fps sections (eg the pans @ 1:04)
TFM(slow=2, PP=0).TDecimate(hybrid=1, viddetect=2, vidthresh=4.4)

# smooth the field misalignment issue 
vinverse(sstr=0.25, amnt=255, scl=1.00)
https://imgsli.com/MTYxODM0

edit: also I died of cringe watching this clip

Last edited by flossy_cake; 13th March 2023 at 05:00.
flossy_cake is offline   Reply With Quote
Old 13th March 2023, 08:25   #7  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,259
@flossy_cake: nice solution.
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 13th March 2023, 12:11   #8  |  Link
flossy_cake
Registered User
 
Join Date: Aug 2016
Posts: 605
Quote:
Originally Posted by Selur View Post
@flossy_cake: nice solution.
Thanks!

But, it chokes slightly at the 0:13 segment which contains blended frames in the source. Can fix that by setting hybrid=0 but then those 30fps pans @ 1:04 will be more juddery.

I think hybrid=1 also handles orphan fields on scene changes in a better way, but it seems to need scthresh=100 in TFM as well... haven't fully figured that one out.

Originally I tried QTGMC to 60p thinking it would smooth out all the anime lines while preserving the frame pacing, but in practice it doesn't - I guess there is just too much field shit going on for QTGMC to deal with. Maybe some magic QTGMC setting could do a better job. But QTGMC @ 1080i is a slow affair.
flossy_cake is offline   Reply With Quote
Old 14th March 2023, 02:56   #9  |  Link
shadowlink
Registered User
 
Join Date: Feb 2017
Posts: 4
Thank you for your answer
Yes, there is also a blending problem but it's only on a few frames if you encode in vfr. I encoded a first pass with handbrake to have a video in vfr then a second pass with megui :
Quote:
LoadPlugin("W:\d copie\Logiciels (2)\Encodage edition audio video\MeGUI-2808-32\tools\ffms\ffms2.dll")
FFVideoSource("D:\00001-001 (1)-1-1.mkv")

Crop(246, 0, -246, -0)
LanczosResize(960,720)
SangNom2()


maa()
maa()
maa()
GradFun3 (thr=0.5, elast=2, thr_det=3, smode=2)
LSFmod(defaults="slow", strength=200)
The result is not too bad, the lines are much better but not as much as the raw

to compare, this is the encoding of a chinese team on nyaa, I would like to get closer to that for the outlines
https://mega.nz/file/pOhCFBwZ#S5Bq8b...LkaiiN_9iT5asU

Last edited by shadowlink; 14th March 2023 at 03:06.
shadowlink is offline   Reply With Quote
Old 14th March 2023, 09:18   #10  |  Link
flossy_cake
Registered User
 
Join Date: Aug 2016
Posts: 605
Quote:
Originally Posted by shadowlink View Post
to compare, this is the encoding of a chinese team on nyaa, I would like to get closer to that for the outlines
https://mega.nz/file/pOhCFBwZ#S5Bq8b...LkaiiN_9iT5asU
That looks quite good. They seem to have used "thin edges" sharpener as well. Can anyone advise which avisynth sharpening plugin has a "thin edges" filter? I have it in MadVR only right now, would be nice to have in Avisynth as well.
flossy_cake is offline   Reply With Quote
Old 14th March 2023, 09:24   #11  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,259
aWarpSharp(2) sharpens the image while thinning the edges
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 15th March 2023, 02:54   #12  |  Link
flossy_cake
Registered User
 
Join Date: Aug 2016
Posts: 605
Quote:
Originally Posted by Selur View Post
aWarpSharp(2) sharpens the image while thinning the edges
flossy_cake 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 17:39.


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