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. |
|
11th November 2022, 16:25 | #1 | Link |
Registered User
Join Date: Dec 2019
Posts: 68
|
Avisynth woes - ffmpeg hanging, denoising
I'm having issues getting my script encoded. When I start encoding with ffmpeg, I get around 6fps. Could be better but, eh. I left it on overnight, the speed has now dropped to 0.8fps and has hanged. No CPU or GPU is being used. I've been plagued by this issue for months.
I thought the initial fix was to add setmemorymax(63448) to the top of my script but now it's not helping. I don't know what's causing it. I know my script is a bit heavy, but I can wait it out at 6fps, not when it's frozen. Does anyone know how to fix the issue? Script (Source file is FFV1): Code:
setmemorymax(63448) v = lwlibavvideosource("i:\virtualdub\tape transfers\angelcam g4 lot\tape 37.mkv", fpsnum=30000, fpsden=1001) #atrack=0, a = lwlibavaudioSource("g:\recordings\angelcam tape 37.w64") AudioDub(v,a) delayaudio(-0.150) getleftchannel() assumetff().converttoyuv422(matrix="rec601", interlaced=true).convertbits(10) Levels(20, 1, 1045, 0, 1023, coring=false,dither=true).tweak(hue=-3, coring=false, dither=true).convertbits(8) #turnRight().Histogram().TurnLeft() Trim(68, 615963) Trim(54, 81752) normalize(0.8912) CCD(interlaced=true, u=10, v=1) qtgmcp(Preset="slow", Tuning="DV-SD", EZKeepGrain=1.0, sourcematch=3, tr0=2, tr1=2, tr2=3, lossless=2, MatchEnhance=1, NoiseProcess=1, NoiseRestore=1.0, Sigma=2.0, SLMode=4, subpel=4) MergeChroma(aWarpSharp2(depth=20,threads=4))MergeChroma(aWarpSharp2(depth=10,threads=4)) santiag(strv=0, nns=4, nsize=5, threads=4) SMDegrain(str=0.8, refinemotion=true) cropresize(indar=4.0/3.0, resizewo=true) ConvertToYv24(matrix="rec601",interlaced=false) Crop(8, 0, -5, -15) SuperRes(matrixin="rec601", 2, .43, 0, """edi_rpow2(2, nns=4, cshift="Spline16Resize")""", matrixout="rec709") x = float(width) / float(height) spline36resize(round(x * 2164),2164) converttoyv12(matrix="rec709", interlaced=false) prefetch(6) Code:
-c:v hevc_nvenc -gpu any -profile:v rext -tier high -g 30 -rc vbr -cq 12 -qmin 12 -qmax 12 -b:v 0K -preset p7 -c:a copy ASUS Prime Z390-A Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz Zotac NVIDIA GeForce RTX 2060 6 GB G.SKILL TridentZ RGB Series 64GB DDR4 3600MHz Samsung 960 EVO 500GB M.2 2x WD Black 4TB I have also tired to use h264_nvenc to no avail. CPU encoding gives me with ~3fps x264 slow and ~0.9fps with x265 slow. Expected, but I want to take advantage of the full speed of the script, which is why I've been using NVENC. Final output looks fine to me. Last edited by ENunn; 14th November 2022 at 02:32. |
11th November 2022, 17:18 | #3 | Link | |
Broadcast Encoder
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,904
|
Quote:
|
|
11th November 2022, 17:08 | #4 | Link |
Registered User
Join Date: Mar 2012
Location: Texas
Posts: 1,666
|
@ENunn
No offense here but your script is doing some questionable things. Try to streamline the script a bit. For example:
Do you have a short sample you can share? Last edited by Reel.Deel; 11th November 2022 at 17:13. Reason: add one more |
11th November 2022, 18:26 | #5 | Link | |||||||||
Registered User
Join Date: Dec 2019
Posts: 68
|
Quote:
Quote:
Quote:
Quote:
Code:
MergeChroma(aWarpSharp2(depth=20,threads=4))MergeChroma(aWarpSharp2(depth=10,threads=4)) Code:
aWarpSharp2(depth=20,threads=4,chroma=2).aWarpSharp2(depth=10,threads=4,chroma=2) Quote:
Quote:
Without MergeChroma(aWarpSharp2): With MergeChroma(aWarpSharp2): I use Santiag for AA. Looks so much better than without it. Without Santiag: With Santiag: Quote:
Quote:
My source? I'll send as soon as I can (got work), you probably won't have any issue with a small clip of a 40 minute source. Quote:
Thanks for the optimizations everyone! Will speed also decrease if my source is using FFV1? I know it's pretty slow to decode (wish there was a GPU accelerated version out there :P) Unfortunately these usually take about 7hrs a piece, so I won't know if it's properly encoded until then. I'll post back once this is all done. Last edited by ENunn; 11th November 2022 at 18:28. |
|||||||||
11th November 2022, 17:42 | #6 | Link |
Registered User
Join Date: Jan 2018
Posts: 2,156
|
QTGMC() will be faster than qtgmcp() in 8 bit
https://github.com/realfinder/AVS-St...0up/QTGMC.avsi |
11th November 2022, 18:44 | #7 | Link | |
Registered User
Join Date: Jan 2018
Posts: 2,156
|
About Santiag for AA. I think your sample same blocking not AA. Try Deblock scrips like Deblock_QED combine with SM_Degrain
https://github.com/Dogway/Avisynth-S...ckPack.avsi#L9 Example: Quote:
Last edited by kedautinh12; 11th November 2022 at 18:57. |
|
11th November 2022, 19:02 | #8 | Link | |
Registered User
Join Date: Mar 2012
Location: Texas
Posts: 1,666
|
Quote:
And maybe try running the script in AVSMeter with SetLogParams("stdout", 4) at the very beginning of your script. The logging facility in AVS+ will automatically log errors, and will issue warnings and notes about potential problems, buggy plugins, suboptimal settings, etc. |
|
11th November 2022, 19:19 | #9 | Link | |||
Registered User
Join Date: Dec 2019
Posts: 68
|
Quote:
Code:
mb=Deblock_QED(quant1=30, quant2=40,UV=1) mb=mb.ex_smooth(1, mode="SG", limit=true, sharp=true) SMDegrain(6, 400, prefilter=6, mfilter=mb, ContraSharp=true, RefineMotion=true, plane=4, LFR=300, limits=false, DCTFlicker=false) Code:
santiag(strv=0, nns=4, nsize=5).SMDegrain(str=0.8, refinemotion=true) Quote:
Quote:
I did a test encode after removing threads/avstp and changing QTGMCp to QTGMC, I'm now encoding at 9fps. Definitely better than 6. Last edited by ENunn; 11th November 2022 at 19:28. |
|||
11th November 2022, 19:33 | #10 | Link | |
Registered User
Join Date: Mar 2012
Location: Texas
Posts: 1,666
|
Quote:
Paste your log on pastebin.com or something similar. Attachments here take forever and a day to get approved. |
|
11th November 2022, 19:54 | #11 | Link | |
Registered User
Join Date: Dec 2019
Posts: 68
|
Quote:
Here you go. |
|
12th November 2022, 02:07 | #12 | Link |
Registered User
Join Date: Jan 2018
Posts: 2,156
|
copy this scripts to file mtmodes.avsi and place this file in your plugins folders
https://publishwith.me/ep/pad/view/r...cdWn4k9/latest |
12th November 2022, 02:24 | #13 | Link |
Registered User
Join Date: Mar 2012
Location: Texas
Posts: 1,666
|
@ENunn
I took a look at the sample, along with the script and to be honest I think some of your settings for QTGMC are way overkill for the quality of the source. The chroma with some bands and the luma has some type of pattern on it. I think with the settings you use for QTGMC accentuates those artifacts and thus needing to use santiag afterwards to mitigate them. Is your intent to keep the video noisy? Does something like this seem acceptable to you? https://imgsli.com/MTM0MDkw Last edited by Reel.Deel; 12th November 2022 at 02:37. Reason: add images |
12th November 2022, 03:25 | #14 | Link | |||
Registered User
Join Date: Dec 2019
Posts: 68
|
Quote:
Quote:
I have to change my VCR to edit mode because with the TBC off, there's visual errors with it set to norm. Sadly this introduces a lot of noise. Doesn't help that the source is a 2nd gen tape (1st gen is probably lost and taped over by now). Quote:
An update for encoding: it took five hours but it eventually completely rendered! Thanks for the help in getting my encodes to stop hanging! Last edited by ENunn; 12th November 2022 at 03:32. |
|||
12th November 2022, 03:52 | #16 | Link | |
Registered User
Join Date: Mar 2012
Location: Texas
Posts: 1,666
|
Adding SelectEven() does not make QTGMC faster, the processing speed still remains the same for any processes after/before SelectEven(). It's only 'faster' because there is half the frames to process, not sure if that is what he wants.
Quote:
Here's the script that I used in case you're interested. No cropping or upscaling there. The script is a modification of a script Didée wrote a long time ago: https://forum.doom9.org/showthread.p...22#post1107122 Code:
FFVideoSource("tape 37-trim.mkv") src = last BWDIF(field=-2)#QTGMC(preset="fast") o = last mds() spline36resize(o.width(),o.height()/2/4*4) mds() spline36resize(o.width(),o.height()/6/4*4) mds() spline36resize(o.width(),o.height()) o.mergechroma(last) nostripes2 = last.minblur(1)#LSFplus(ss_x=1.0,ss_y=1.0,strength=200,soft=100,overshoot=5) srchbase = nostripes2.fft3dfilter(sigma=6,sigma2=4,sigma3=3,sigma4=2,bt=5,bw=16,bh=16,ow=8,oh=8,plane=4).fluxsmootht() pre = Merge(srchbase, o, weight=.45) BLK = 16 # 8 ME1 = 5 ME2 = 2 # 8 _DCT = 5 sup1 = srchbase.MSuper(hpad=16, vpad=16, pel=2, levels=0,sharp=1) sup2 = pre.MSuper(hpad=16, vpad=16, pel=2, sharp=0) bv2 = MAnalyse(sup2,delta=2,truemotion=false,global=true,blksize=BLK,overlap=BLK/2,search=ME1,searchparam=ME2,isb=true, dct=_DCT) bv1 = MAnalyse(sup2,delta=1,truemotion=false,global=true,blksize=BLK,overlap=BLK/2,search=ME1,searchparam=ME2,isb=true, dct=_DCT) fv1 = MAnalyse(sup2,delta=1,truemotion=false,global=true,blksize=BLK,overlap=BLK/2,search=ME1,searchparam=ME2,isb=false,dct=_DCT) fv2 = MAnalyse(sup2,delta=2,truemotion=false,global=true,blksize=BLK,overlap=BLK/2,search=ME1,searchparam=ME2,isb=false,dct=_DCT) mdegrain2(sup1,bv1,fv1,bv2,fv2,thsad=200,thSCD1=256,thSCD2=96) QTGMCp(src, EdiExt=last) Interleave(o,last) PointResize(width*2, height*2) # helper function: vertical-only MinBlur with vertical radius 2 function mds(clip clp) { a = clp.mt_luts(clp,mode="median",pixels="0 -2 0 -1 0 0 0 1 0 2",Y=2,U=3,V=3) b = clp.mt_convolution("0 1 0","1 2 1",y=2,U=3,V=3).mt_convolution("0 1 0","1 2 1",Y=2,U=3,V=3) aD = mt_makediff(clp,a,Y=2,U=3,V=3) bD = mt_makediff(clp,b,Y=2,U=3,V=3) DD = mt_lutxy(aD,bD,"x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?",Y=2,U=3,V=3) clp.mt_makediff(DD,Y=2,U=3,V=3) return(last) } Last edited by Reel.Deel; 12th November 2022 at 04:20. |
|
12th November 2022, 07:22 | #17 | Link | |
Registered User
Join Date: Dec 2019
Posts: 68
|
Quote:
Old script: New script: Easily compare: https://imgsli.com/MTM0MDk4 Thanks so much Real! Now to see what looks good for non ES15 tapes. Last edited by ENunn; 12th November 2022 at 07:26. |
|
|
|