Log in

View Full Version : VS multithread question


MonoS
11th December 2014, 13:26
Hi, i have this heavily vs bounded script

import vapoursynth as vs
core = vs.get_core()
ret = core.ffms2.Source(source='source.m2ts')
core.avs.LoadPlugin(path="C:/Program Files (x86)/AviSynth 2.5/plugins/EdgeFixerReferenceContinuity.dll")
ret = core.avs.ContinuityFixer(ret,2,1,2,1,720)
ret = core.fmtc.bitdepth (clip=ret, bits=16)
UV = core.nnedi3.nnedi3_rpow2(clip=ret, rfactor=2, correct_shift=1, nsize=1)
UV = core.fmtc.resample(UV,w=1280, h=720, kernel="spline64", taps=5, css="444", planes=[1,3,3])
Y = core.fmtc.resample(ret, 1280,720, kernel="bilinear", invks=True, taps = 5, invkstaps=3, planes=[3,1,1],)
fin = core.std.ShufflePlanes([Y, UV],[0,1,2], colorfamily=vs.YUV)
fin.set_output()

I expected, being VS multithreaded, a very high CPU utilization but instead only got ~25% of cpu utilization.
I have an dual core with HT, so 25% of utilization mean that is using only one core.

I pipe the VS output to x264kMod@10bit using avs4x26x [with VapourSource].

Another odd thing is that the avs4x26x process have [until now] 454.000.000 page errors counted in task manager [still counting at 15k-40k a seconds] but on the performance monitor it doesn't have any hardware error.

Thanks for the attention

Mystery Keeper
11th December 2014, 14:16
Try "core = vs.get_core(threads=8)".

MonoS
11th December 2014, 16:15
Tried and nothing, still 25%

Mystery Keeper
11th December 2014, 16:46
That's strange, because for me it gets my CPU completely loaded.

jackoneill
11th December 2014, 16:51
Really, why would you add Avisynth to the mix? Use vspipe to pipe the script's output to x264.

vspipe.exe script.vpy - --y4m | x264.exe <arguments> -o video.mkv -

MonoS
11th December 2014, 17:06
Really, why would you add Avisynth to the mix? Use vspipe to pipe the script's output to x264.

vspipe.exe script.vpy - --y4m | x264.exe <arguments> -o video.mkv -


AFAIK with avs4x26x i can pipe directly into x264 the 16bit clip and have the encoder do the dithering.

Can i do the same with vspipe??

jackoneill
11th December 2014, 17:16
AFAIK with avs4x26x i can pipe directly into x264 the 16bit clip and have the encoder do the dithering.

Can i do the same with vspipe??

I think that's a yes.

MonoS
11th December 2014, 18:07
Ok, using vspipe i can cap my cpu, but now i can't pipe the 16bit video.
This i my command line
"C:\Program Files (x86)\VapourSynth\core32\vspipe.exe" "script.vpy" - --y4m | x264.2491kMod.10bit.x86_64.exe --input-res 1280x720 --fps 24000/1001 --input-depth 16 --preset veryslow --ref 9 --bframes 9 --tune animation --crf 17 --keyint infinite --deblock -1:-2 --psy-rd 0.68:0.17 --aq-strength 0.70 --aq-mode 3 --fade-compensate 0.65 --input-range tv --range tv --colormatrix bt709 --input-csp yuv444p16le --output-csp i444 --demuxer lavf -o "video.mkv" -
I get "lavf [error]: could not open input file"

Did i write something wrong??

EDIT: if i use the raw demuxer the encode start, but i can't use --input-csp yuv444p16le

splinter98
11th December 2014, 19:15
try:
vspipe "script.vpy" - --y4m | x264 --preset veryslow --ref 9 --bframes 9 --tune animation --crf 17 --keyint infinite --deblock -1:-2 --psy-rd 0.68:0.17 --aq-strength 0.70 --aq-mode 3 --fade-compensate 0.65 --input-range tv --range tv --colormatrix bt709 --output-csp i444 --demuxer y4m -o "video.mkv" -

the --y4m argument turns the output of vspipe to y4m packaging. Therefore you do not need all the --input-csp, --input-res etc (as it's contained in the output from vspipe).

x264 when reading from stdin it expects raw yuv, so adding --demuxer y4m tells x264 to expect y4m input

MonoS
11th December 2014, 21:42
Yes, thanks splinter98 and jackoneill, now it works :D