View Full Version : I'm having all sorts of problems with AviSynth and I'd like some help...


jrodefeld
13th June 2015, 01:09
I've been having such a frustrating time getting AviSynth and Virtualdub to work properly and consistently.

I'd really love if someone could recommend which version of AviSynth and Virtualdub I should use for best performance and which settings I need to alter to get the fastest rendering without errors.

In the first place, rendering is REALLY slow for most scripts I run. I'd really like some tips to speed it up. I've tried running multithreaded AviSynth, but it doesn't seem to be working.

I've got a pretty fast system and I'd really expect faster performance. I understand that AviSynth usually only works single threaded, but I'd still expect better performance. If I could get MT to work, that would hopefully speed up things considerably.

My computer specs are as follows:

Intel Core i7 4930k
Asus Rampage IV Extreme motherboard
16gb G Skill Quad Channel 2400mhz Memory
Geforce GTX 980 SC


This is the script I am trying to run:

SetMemoryMax(8000)

MPEG2Source("G:\HB_Extended.d2v")

Crop(6,40,-8,-40)

SetMTMode(2, 12)
LoadPlugin("C:\Program Files (x86)\AviSynth+\plugins+\nnedi3.dll")
loadplugin("C:\Program Files (x86)\AviSynth+\plugins+\RepairSSE2.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth+\plugins+\eedi3.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth+\plugins+\nnedi3.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth+\plugins+\tdeint.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth+\plugins+\tmm.dll")
loadplugin("C:\Program Files (x86)\AviSynth+\plugins+\RepairSSE3.dll")
loadplugin("C:\Program Files (x86)\AviSynth+\plugins+\SSE3Tools.dll")
loadplugin("C:\Program Files (x86)\AviSynth+\plugins+\mvtools2.dll")
loadplugin("C:\Program Files (x86)\AviSynth+\plugins+\FFT3DFilter.dll")

AssumeTFF()

ConvertToYV12(interlaced=true)

QTGMC(Preset="Slow", EdiMode="EEDI3+NNEDI3")
SetMTMode(2)

AddBorders(40, 0, 40, 0)

nnedi3_rpow2(4)
Spline36Resize(1920,1080)

SetMTMode(1)
GetMTMode(false) > 0 ? distributor() : last


I don't know about the MT commands at all. I've tried adding them to different spots on the script but they don't seem to be improving performance. If I add SetMTMode before the MPEG2Source command, I get memory errors and problems in Virtualdub.


I get all sorts of errors in Virtualdub, frequently the process will freeze and I'll have to start over. I'll get all kinds of "out of memory" errors and things like that.

Even when it DOES work, I'm getting no more than 3fps rendering speed, frequently dropping below 2fps.

This seems incredibly slow for the computer specs I have.

I'd really appreciate some tips on how I can improve my script and/or improve speed of rendering and reduce Virtualdub errors.

Thanks.

hello_hello
13th June 2015, 01:51
QTGMC is pretty slow.

Try cropping to mod16 dimensions before QTGMC, then crop again after QTGMC if need be, to see if QTGMC working with mod16 video makes any difference.

I know lots of people use MT Avisynth, but I gave up and stayed with single threaded, and to make up for it's single threadedness I run more than one encode at a time. Or I copy a script and use Trim() at the end of each to encode half the video with each copy simultaneously etc, then I append the encoded video when it's done (it pays to add --stitchable to the x264 command line). You might still only encode at 3fps but at least you'll be doing it twice. :) Maybe three times if your CPU still isn't at 100% running two encodes.

I don't use VirtualDub for encoding much so I can't help there. Someone else may be able to help with multithreading. You seem to be loading two versions of Repair.dll in your script.

jrodefeld
13th June 2015, 03:50
QTGMC is pretty slow.

Try cropping to mod16 dimensions before QTGMC, then crop again after QTGMC if need be, to see if QTGMC working with mod16 video makes any difference.

I know lots of people use MT Avisynth, but I gave up and stayed with single threaded, and to make up for it's single threadedness I run more than one encode at a time. Or I copy a script and use Trim() at the end of each to encode half the video with each copy simultaneously etc, then I append the encoded video when it's done (it pays to add --stitchable to the x264 command line). You might still only encode at 3fps but at least you'll be doing it twice. :) Maybe three times if your CPU still isn't at 100% running two encodes.

I don't use VirtualDub for encoding much so I can't help there. Someone else may be able to help with multithreading. You seem to be loading two versions of Repair.dll in your script.

Thanks for the information. It is really frustrating how slow AviSynth is. I've heard other people say that they can't get multithreaded to work.

This just REALLY slows down my workflow when I'm authoring movies. There really is no substitute either.

I'm thinking that my problem has more to do with VirtualDub now. The slow speed is one thing but what is happening right now is that at some point in the encode, it will just hang and the fps goes from 3fps or so down to 0.0 and it just stays there until I cancel the whole thing.

I don't know what could be causing this either. I've used regular VirtualDub and VirtualDubMod with the same thing happening.

All I need to do is to process the AviSynth script and output a lossless Lagarith AVI file. Then I'll add it to Adobe Premier, do a bit of editing and then frameserve it to MainConcept Reference.

Is there a way to process this script without VirtualDub?

If anyone else would like to recommend AviSynth tips to get MT to work or speed up processing, I'd appreciate it. Or anyone who can recommend VirtualDub settings.

Thanks for the help.

poisondeathray
13th June 2015, 05:10
Have you ruled out the other common issues, like performed system stability tests (e.g. prime 95, occt, linx, etc...) memory integrity tests (memtest86+, ) etc....

Not related to your crashes, but one small thing you do script wise to speed up the script is add the appropriate borders after NNEDI_rpow2() instead of before

Otherwise, yes MT can be unstable and crashes for some people, especially on HD material. The "safest" way is to divide and conquer (what hello_hello suggested above). It can actually end up being faster than a single MT instance, and it works without worrying about incomplete encodes, or mixed up frames , temporal issues, or any other problems.

If you want to rule out vdub as the problem, you can feed the avs script to ffmpeg for a ut video lossless intermediate
eg
ffmpeg -i input.avs -c:v utvideo -an output.avi

StainlessS
13th June 2015, 06:30
As well as loading two copies of RepairXXX.dll, you also load two copies of Nnedi3.dll,
load RepairSSE2.dll or RepairSSE3.dll but not both (I think I read somewhere that SSE3 version was a bit unstable so I only ever use SSE2).

EDIT: And of course you dont need to load plugins that are already in the autoload plugins folder (and should remove one of the SSE duplicates).

colours
13th June 2015, 07:59
QTGMC(Preset="Slow", EdiMode="EEDI3+NNEDI3")

I'm not sure why you were expecting something not slow when that literally says "slow" right there. EEDI3 is pretty darned slow too, so if speed is a concern you could always just not use that.

Oh, and assuming you're running it as 32-bit, SetMemoryMax(8000) is worse than useless because a single 32-bit process cannot access over 4 GiB of memory in the first place.

As a last resort, if you're using a version of AVS+ more recent than r1576, try downgrading to r1576, or if you're on r1576, try switching to AVS 2.6.0.

Groucho2004
13th June 2015, 08:24
I'm just stumped that nobody (except for colours and SetMemoryMax()) pointed out just how insane that script is.

@jrodefeld
It's quite clear that you haven't read or understood any of the Avisynth MT documentation. That's the first thing you should do. Even just reading (and understanding) the first posts of SEt's MT thread and the QTGMC() thread would help a lot.

I'm not spoonfeeding you the solution, just pointing out some problems with your script:

SetMemoryMax(8000)
Already covered by colours

MPEG2Source("G:\HB_Extended.d2v")
...
SetMTMode(2, 12)

Without a SetMTMode() call before the source filter, any subsequent calls are useless. Start/try with "SetMTMode(5, 4)".

LoadPlugin("C:\Program Files (x86)\AviSynth+\plugins+\nnedi3.dll")
loadplugin("C:\Program Files (x86)\AviSynth+\plugins+\RepairSSE2.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth+\plugins+\eedi3.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth+\plugins+\nnedi3.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth+\plugins+\tdeint.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth+\plugins+\tmm.dll")
loadplugin("C:\Program Files (x86)\AviSynth+\plugins+\RepairSSE3.dll")
loadplugin("C:\Program Files (x86)\AviSynth+\plugins+\SSE3Tools.dll")
loadplugin("C:\Program Files (x86)\AviSynth+\plugins+\mvtools2.dll")
loadplugin("C:\Program Files (x86)\AviSynth+\plugins+\FFT3DFilter.dll")

The explicit loading of DLLs which are incompatible was covered by Stainless.

QTGMC(Preset="Slow", EdiMode="EEDI3+NNEDI3")
nnedi3_rpow2(4)

The previous 2 statements are simply very slow, not much to do about that.

GetMTMode(false) > 0 ? distributor() : last
This is unnecessary since VDub adds the Distributor call internally. Your're just doubling the number of threads here, making the script even slower and eat more memory.

creaothceann
13th June 2015, 09:54
All I need to do is to process the AviSynth script and output a lossless Lagarith AVI file.

Look into AVS2AVI (http://forum.doom9.org/showthread.php?p=1554964#post1554964).

Btw. x264 has a lossless mode too; you can even use it from VirtualDub (look into x264vfw).

Groucho2004
13th June 2015, 09:57
OK, did a little test with your script as it should be, tuned with the help of AVSMeter (source clip is 720x576i MPEG-2):

SetMemoryMax(1024)
LoadPlugin("E:\Apps\VideoTools\DGDec\DGDecode.dll")

setmtmode(3)
MPEG2Source("F:\DVD_Interlaced\test.d2v")

setmtmode(2)
AssumeTFF()
QTGMC(Preset="Slow", EdiMode="EEDI3+NNEDI3", EdiThreads = 2)
nnedi3_rpow2(rfactor = 4, cshift = "spline36resize", fwidth = 1920, fheight = 1080, threads = 2)

Result (Sandy Bridge i5 2500K @ 4GHz, probably slower than your i7):
[General info]
Log file created with: AVSMeter 2.0.3 (x86)
Script file: F:\DVD_Interlaced\test.avs
Command line switches: -log
Avisynth version: AviSynth 2.60, build:Feb 20 2015 [03:16:45] (2.6.0.5)
Avisynth DLL location: E:\Apps\Div\avisynth.dll
Plugin directory: E:\Apps\VideoTools\AVSPlugins\autoload
Active MT Mode: 2

[Runtime info]
Frames processed: 3408 (0 - 3407)
FPS (min | max | average): 2.070 | 143182 | 13.43
Memory usage (phys | virt): 1231 | 1347 MB
Thread count: 56
CPU usage (average): 99%
Time (elapsed): 00:04:13.683


As for saving this to a lossless file - I would use VDub + UTVideo (although I'm not sure if Premiere supports UTVideo).

hello_hello
13th June 2015, 17:43
Groucho2004,
why would there be such a large difference between the min and max fps in your test? I'm just wondering if it skewed the average fps result.

I tried your script minus the thread limitations with single threaded Avisynth using on my ancient Q9450. I just let it run through 300 frames.

LoadPlugin("C:\Program Files\MeGUI\tools\dgindex\DGDecode.dll")
DGDecode_mpeg2source("D:\test.d2v")
QTGMC(Preset="Slow", EdiMode="EEDI3+NNEDI3")
nnedi3_rpow2(rfactor = 4, cshift = "spline36resize", fwidth = 1920, fheight = 1080)

[General info]
Log file created with: AVSMeter 2.0.3 (x86)
Script file: D:\1.avs
Avisynth version: AviSynth 2.60, build:Mar 31 2015 [16:38:54] (2.6.0.6)
Avisynth DLL location: C:\WINDOWS\system32\avisynth.dll
Plugin directory: C:\Program Files\AviSynth\plugins

[Runtime info]
Frames processed: 310 (0 - 309)
FPS (min | max | average): 3.301 | 4.441 | 3.613
Memory usage (phys | virt): 475 | 515 MB
Thread count: 31
CPU usage (average): 68%
Time (elapsed): 00:01:25.800

Of course in the real world I'd probably be encoding and not benchmarking, and between the filtering and the encoding I think that'd keep the CPU pretty busy, so I tried it to see how fast I'd encode using the default x264 settings.
Encoding speed eventually settled down to a fairly steady 3.2fps, although CPU usage didn't climb as high as I expected. It only increased by about 10% compared to AVSMeter on it's own. Still, I'm encoding in single threaded mode at about the same speed as jrodefeld but using a much slower CPU.
That'd be an example of when I probably wouldn't try to run two simultaneous encodes because CPU usage was already at about 80% running just one.

hello_hello
13th June 2015, 17:59
All I need to do is to process the AviSynth script and output a lossless Lagarith AVI file. Then I'll add it to Adobe Premier, do a bit of editing and then frameserve it to MainConcept Reference.

Must it be Lagarith?
If you want a GUI you can use MeGUI to output a lossless huffyuv AVI. Bigger file sizes probably, but also faster, I think.

Load the script into video encoding section, check "Add Pre-rendering job" and use the queue button to add the encoding job to the queue. MeGUI's x264 or Xvid encoder configuration won't matter.
Switch to the Queue tab and you'll see three jobs in the queue. Right click on the second and third jobs and delete them. You only need the first one. When MeGUI asks about removing related jobs, select "no" each time. You'll be left with a single job to run that'll give you a lossless huffyuv AVI.

MeGUI uses ffmpeg for that job and I'm pretty sure ffmpeg uses the huffyuv version that supports lossless YV12, so you probably need to install something like ffdshow to decode it rather than the standard huffyuv codec.

Other than that somebody will probably be able to tell you how to encode losslessly from the command line. It's been forever since I've encoded anything that way. Although here's how MeGUI did it :)
"ffmpeg.exe" -y -i "D:\test.avs" -c:v ffvhuff -threads 0 -sn -an -context 1 -vstrict -2 -pred 2 "D:\hfyu_test.avi"

Groucho2004
13th June 2015, 18:58
Groucho2004,
why would there be such a large difference between the min and max fps in your test? I'm just wondering if it skewed the average fps result.
That's normal for Avisynth MT and no, it does not skew the result.

Of course you only notice this with a tool that measures the time/frame within a narrow window, i.e. for each processed frame.

Groucho2004
13th June 2015, 19:03
If you want a GUI you can use MeGUI to output a lossless huffyuv AVI.
Why use a bloated "gui"? What's wrong with VirtualDub?

creaothceann
13th June 2015, 19:23
That'd be an example of when I probably wouldn't try to run two simultaneous encodes because CPU usage was already at about 80% running just one.

Doesn't matter, 100% CPU usage isn't bad so you'd be wasting 20%. You can even select the CPU priority in VirtualDub while it's encoding.

hello_hello
13th June 2015, 21:07
Why use a bloated "gui"? What's wrong with VirtualDub?

Nothing, aside from the fact jrodefeld said he's having lots of problems using it, but that's likely to be a MT Avisynth problem and not a VirtualDub one.

Doesn't matter, 100% CPU usage isn't bad so you'd be wasting 20%. You can even select the CPU priority in VirtualDub while it's encoding.

True, although while I haven't tested it I suspect adding the second encode would slow the first one down a tad and there's a point where you'd gain very little in total fps, but I could be talking bullocks. I haven't tested that properly.

Although sometimes there's other variables and an encode doesn't run as fast as it normally would/should for unknown reasons, or I wonder if it's running as fast as it should be. I bumped into one of those problems recently (http://forum.videohelp.com/threads/369143-ResizersPack-MasksPack-PlaygroundPack-SmoothContrast-Logo-mod-functions?p=2389216&viewfull=1#post2389216) using the Dogway version of QTGMC (in progressive mode for denoising) in combination with LSFMod. I could duplicate the problem quite reliably (http://forum.videohelp.com/threads/369143-ResizersPack-MasksPack-PlaygroundPack-SmoothContrast-Logo-mod-functions?p=2389299&viewfull=1#post2389299). Encoding would start at normal speed and ever so slowly decrease until it was ridiculously slow, unless I didn't encode the video from the beginning. If I put Trim(50,0) at the end of the script, the problem just went away. If I ran QTGMC in de-interlacing mode, it went away. If I removed LSFMod from the script, it went away. Dogway modified his QTGMC script for me (http://forum.videohelp.com/threads/369143-ResizersPack-MasksPack-PlaygroundPack-SmoothContrast-Logo-mod-functions?p=2389468&viewfull=1#post2389468) and that fixed it too but I don't understand why. He talked me into trying MP_Pipeline (http://forum.videohelp.com/threads/369143-ResizersPack-MasksPack-PlaygroundPack-SmoothContrast-Logo-mod-functions?p=2389631&viewfull=1#post2389631) and that also fixed it. I'm sure I'll be using MP_Pipeline more in the future, but the original problem remains an unexplained Avisynth oddness....

hydra3333
14th June 2015, 04:48
my ancient Q9450. It was good in its day :)


Encoding speed eventually settled down to a fairly steady 3.2fps, although CPU usage didn't climb as high as I expected.
I must be doing something very wrong, I only every get about 3fps for a similar script on a i7 i3820 :( Mind you, my x264 settings do say very slow.
Source: PAL 576i which needs a lot of deblocking and stabilising.
Target: PAL 576i (i to maintain "motion fluidity" on a video with lots of fast movement/panning)

Script corrections/suggestions welcomed.
(No filters autoloaded, venerable and stable avisynth 2.57 MT)
SetMTmode(mode=5,threads=8) # start with mode=5 forAVIsource http://forum.doom9.org/showthread.php?p=1067216#post1067216
SetMemoryMax(1024)
#
LoadPlugin("C:\SOFTWARE\DGindex\DGDecodeNV.dll")
LoadPlugin("C:\SOFTWARE\DGindex\DGDecode.dll")
#
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins-qtgmc-smdegrain\AddGrainC.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins-qtgmc-smdegrain\avstp.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins-qtgmc-smdegrain\dfttest.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins-qtgmc-smdegrain\dither.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins-qtgmc-smdegrain\EEDI2.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins-qtgmc-smdegrain\eedi3.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins-qtgmc-smdegrain\FFT3DFilter.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins-qtgmc-smdegrain\mt_masktools-25.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins-qtgmc-smdegrain\mvtools2.dll")
#LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins-qtgmc-smdegrain\nnedi.dll")
#LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins-qtgmc-smdegrain\nnedi2.dll")
#LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins-qtgmc-smdegrain\nnedi3.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins-qtgmc-smdegrain\nnedi-from-tcritical.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins-qtgmc-smdegrain\nnedi2-from-tcritical.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins-qtgmc-smdegrain\nnedi3-from-tcritical.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins-qtgmc-smdegrain\RemoveGrainSSE2.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins-qtgmc-smdegrain\RepairSSE2.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins-qtgmc-smdegrain\SSE2Tools.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins-qtgmc-smdegrain\TDeint.dll")
#LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins-qtgmc-smdegrain\VerticalCleanerSSE2.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins-zzz\VerticalCleanerSSE3.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins-qtgmc-smdegrain\VariableBlur.dll")
#
LoadCPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins-qtgmc-smdegrain\yadif.dll")
#
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins-zzz\AGC.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins-zzz\CNR2.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins-zzz\fft3dfilter.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins-zzz\dctfilter.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins-zzz\degrainmedian.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins-zzz\Convolution3d.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins-zzz\DePan.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins-zzz\despot.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins-zzz\WarpSharp.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins-zzz\FFTQuiver.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins-zzz\aWarpSharp.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins-zzz\Unfilter.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins-zzz\RemoveDirtSSE2.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins-zzz\Yadifmod.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins-zzz\Colormatrix.dll")
#
Import("C:\Program Files (x86)\AviSynth 2.5\plugins-qtgmc-smdegrain\dither.avs")
Import("C:\Program Files (x86)\AviSynth 2.5\plugins-qtgmc-smdegrain\mt_xxpand_multi.avs")
Import("C:\Program Files (x86)\AviSynth 2.5\plugins-qtgmc-smdegrain\QTGMC-3.33.avs")
Import("C:\Program Files (x86)\AviSynth 2.5\plugins-qtgmc-smdegrain\SMDegrain-v.2.2d.avs")
Import("C:\Program Files (x86)\AviSynth 2.5\plugins-qtgmc-smdegrain\LSFmod.v1.9.avs")
#
Import("C:\Program Files (x86)\AviSynth 2.5\Deblock_QED_MT2.avs")
Import("C:\Program Files (x86)\AviSynth 2.5\LimitedSharpenFaster.avs")
# ipp=true interlaced post-processing
# cpu=4 DEBLOCK_Y_H, DEBLOCK_Y_V, DEBLOCK_C_H, DEBLOCK_C_V
# cpu=6 DEBLOCK_Y_H, DEBLOCK_Y_V, DEBLOCK_C_H, DEBLOCK_C_V, DERING_Y, DERING_C
#MPEG2Source("T:\test\test.d2v",info=0,ipp=true,cpu=6) # DEBLOCK and DERING
#MPEG2Source("T:\test\test.d2v",info=0,ipp=true,cpu=4) # DEBLOCK
MPEG2Source("T:\test\test.d2v",info=0,ipp=true,cpu=0)
SetMTmode(mode=2,threads=8) #
AssumeFPS(25)
AssumeTFF()
#
#changefps(last,last,true) # http://forum.doom9.org/showthread.php?p=1473445#post1473445
#SetMTmode(mode=2,threads=8)
#
# see http://doom10.org/index.php?topic=2309.msg12233#msg12233
SeparateFields()
deblock_QED(quant1=36)
Weave()
AssumeTFF()
#
QTGMC(Preset="Very Slow",EdiThreads=2,Sharpness=1.2,SLMode=2,EZKeepGrain=1.2,NoiseProcess=2) # result is double framerate progressive, so re-interlate it later
#
# Re-Interlace and halve framerate
AssumeTFF()
Blur(0,0.25).SeparateFields().SelectEvery(4,0,3).Weave() #reinterlace - ASSUMED TFF HERE # BLUR(0,1) per http://forum.doom9.org/showthread.php?p=1488308#post1488308
#
SetMTmode(mode=5,threads=8)
AssumeTFF()
AssumeFPS(25)
#Converttoyv12()
# Distributor() should only be used when loading the script into applications which talk to avisynth directly
# e.g. HC and MeGUI. If the program opens the .avs file as an avi file (like virtualdub/mod, x264, xvid_encraw etc.)
# then you don't need (and shouldn't have) the distributor call at the end.
# http://forum.doom9.org/showthread.php?p=1136518#post1136518
##### "HC uses custom avisynth routines, you have to add Distributor() to the end of the script."
#Distributor() # use this when using HC and SetMTmode, per http://forum.doom9.org/showthread.php?p=1063622#post1063622
# http://forum.doom9.org/showthread.php?p=1067589#post1067589
# ChangeFPS(Last, Last, True) makes fast scripts faster and slow scripts slower
#ChangeFPS(Last, Last, True) # use this when using HC and SetMTmode, per http://forum.doom9.org/showthread.php?p=1064118#post1064118
#SetPlanarLegacyAlignment(True)
#Distributor()


"C:\software\avs2yuv\avs2yuv.exe" "T:\test\test.avs" -o - | ^
"C:\software\X264\x264-x64.exe" - --stdin y4m --thread-input --frames --profile high --level 4.1 --preset veryslow --interlaced --tff --no-cabac --crf 16 --sar 64:45 --colormatrix bt470bg -o "s:\test\test-temp.MP4"

hydra3333
14th June 2015, 05:20
PS do you have any suggestions for, say, a Win8.1 native lossless format which can be used by the latest ffmpeg to output a lossless file and which x264 r2334 can read, so I that do not need to install any "foreign" codecs ?

poisondeathray
14th June 2015, 06:38
PS do you have any suggestions for, say, a Win8.1 native lossless format which can be used by the latest ffmpeg to output a lossless file and which x264 r2334 can read, so I that do not need to install any "foreign" codecs ?

If you really mean "native", Windows doesn't come with any lossless codecs

But you can use ut video codec without an install of the VFW version, if you use an x264 binary that has lavf compiled with --demuxer lavf

feisty2
14th June 2015, 07:35
PS do you have any suggestions for, say, a Win8.1 native lossless format which can be used by the latest ffmpeg to output a lossless file and which x264 r2334 can read, so I that do not need to install any "foreign" codecs ?

uncompressed raw

hello_hello
14th June 2015, 08:07
I must be doing something very wrong, I only every get about 3fps for a similar script on a i7 i3820 :( Mind you, my x264 settings do say very slow.

I tried the slow x264 preset earlier and it didn't seem to slow encoding speed much compared to the default x64 settings, I assume because the CPU wasn't running flat out.

Script corrections/suggestions welcomed.

Sorry, I have no clever ideas as I've not used MT Avisynth much at all. You might need to start with a single filter in the script then add them one at a time to see if there's a point where things suddenly slow and maybe you could try MP_Pipeline (http://forum.doom9.org/showthread.php?t=163281) to increase the amount of memory used. I mentioned it in my last post and linked to the post where I reported the result after testing. At the time I hadn't expected it to make any difference but using it between QTGMC and LSFMod increased encoding speed a bit even in single threaded mode. The downside though, was if I tried to run more than one encode at a time I actually did run out of memory (I'm still using XP) and it all went to %$@&, but for a single encode being able to use more memory did make a difference.

I'll play around with MP_Pipeline some more when I finally build a new PC. I'd expected to have done so by now but I patiently waited for Broadwell and now I'm waiting a bit more for Skylake. I'm looking forward to playing with a shiny new i7 6700 though. And finally.... a reason to upgrade XP.

hydra3333
14th June 2015, 13:38
I did a few tests and some calculations.
Like this (with parameter substitutions)
"C:\software\avs2yuv\avs2yuv.exe" "%avs1%" -o - | ^
"%X264EXEx64%" - --stdin y4m --thread-input --threads 8 --frames %FRAMES% --profile high --level 4.1 --preset slow --interlaced --tff --no-cabac --crf 18 --sar 64:45 --colormatrix bt470bg -o "%PARtemph264%"
gives about 3.5 fps.
Adding Distributor() to the end of the .avs ups it to about 4.5 fps.

Changing to lossless using x264 and -- qp 0 ups it to about 5.5fps. Then the final x264 on top with slow settings afterward to compress from lossless to --crf 18 goes at about 10fps.
By the time you add up the seconds taken for a 1 hour show, you're slightly better off with the original 1-step than a 2-step-with-lossless.

Now no matter what I do, I can't flatten the CPUs all to 100% which is what I need. (4 physical, 4 hyper, 8 total on an i3820). It hovers at about 30% with one cpu largely used. Source file is on a fast disk, target is an ssd. Can't figure why, plenty of spare resources, it just doesn't want to use them.

creaothceann
14th June 2015, 15:40
Encode several parts at the same time. (You can even select the core utilization with the "affinity" parameter when using the "start" command.)

jrodefeld
3rd July 2015, 22:34
Well I got things to work better than before. Multithreading is still not working great, but that just seems to be the way it is. It is hit or miss. However, by using the UT Codec set to "Optimize for Decoding Speed" I get a nice boost in speed.

I was able to create the AVI file. But I'm having more problems now.

I have to do some basic editing of that file and then encode it to x264 Blu-ray format to author onto a Blu-ray disc. I import it into Adobe Premiere CC 2015 and do my edits. Then I either try to export the file through Premiere to a Blu-ray x264 file or frameserve it using Advanced Frameserver to MainConcept TotalCode Studio where I encode it.

Either way, I ALWAYS get an error message. "Transcoding failed" or variations on that message.

Even if I load the AVI directly in TotalCode Studio without any editing, encoding still fails.

Is this a problem with UTCodec? Maybe I should re-run the script using Lagarith or something like that?

For the video projects I am doing, I routinely will need to run similar deinterlacing scripts and I've got to get this process streamlined and reliable.

Any more suggestions?