Log in

View Full Version : Fastest way to encode in Win7 x64 with i7


Tuik
21st September 2010, 12:54
The pc is a notebook with a i7 Q720 (8 threads) and 6GB RAM.

I'm using avisynth 2.5.8 x64 (from here http://forum.doom9.org/showthread.php?t=152800) to encode HD to SD and the script is:

SetMTMode(2,1)
DirectShowSource("video.mkv")
Spline16Resize(720,last.height)
Spline16Resize(last.width, 304)
Sharpen(0.4)

And i'm encoding in xvid_encraw x64 by squid_80 with this bat:

"C:\Program Files\xvid_encraw\xvid_encraw.exe" -i "script.avs" -pass1 "stats" -bitrate 1900 -framerate 23.976 -kboost 100 -ostrength 10 -oimprove 10 -odegrade 10 -chigh 30 -clow 15 -overhead 0 -max_key_interval 250 -vhqmode 4 -qmatrix "C:\Program Files (x86)\MeGUI\extra\SixOfNineHVS.xcm" -max_bframes 3 -bvhq -bquant_ratio 162 -bquant_offset 0 -par 1:1 -threads 4 -progress 100

"C:\Program Files\xvid_encraw\xvid_encraw.exe" -i "script.avs" -pass2 "stats" -bitrate 1900 -framerate 23.976 -kboost 100 -ostrength 10 -oimprove 10 -odegrade 10 -chigh 30 -clow 15 -overhead 0 -max_key_interval 250 -vhqmode 4 -qmatrix "C:\Program Files (x86)\MeGUI\extra\SixOfNineHVS.xcm" -max_bframes 3 -bvhq -bquant_ratio 162 -bquant_offset 0 -par 1:1 -threads 4 -avi "video.avi" -progress 25

The decoder used is CoreAVC PRO with CUDA acceleration from GT330M.

I'm getting average 170fps@1pass and 41fps@2pass. What should i do to make it faster?

Also, previously, when encoding in avisynth i was using DirectShowSource2 which is way faster than DirectShowSource. Is there anyway to use DSS2 in avisynth 64?

Thanks to all of you!

TheProfileth
22nd September 2010, 02:39
Why do you need it to go faster?
I mean you are encoding faster than the video displays normally at 40FPS and at 170 that is just insane
(Wanders off mumbling about he he thinks that 1FPS is a good speed for one of his encodes*

aegisofrime
22nd September 2010, 04:09
Why do you need it to go faster?
I mean you are encoding faster than the video displays normally at 40FPS and at 170 that is just insane
(Wanders off mumbling about he he thinks that 1FPS is a good speed for one of his encodes*

...

There's a difference between encoding FPS and playback FPS.

Anyway to the topic starter, try using SetMTMode(2,8) since you are on a i7 with HT, instead of (2,1).

By using (2,1), you are specifiying the usage of only one thread.

That said, that script doesn't look very processor intensive... Still, can't hurt to try.

Tuik
22nd September 2010, 12:28
...

There's a difference between encoding FPS and playback FPS.

Anyway to the topic starter, try using SetMTMode(2,8) since you are on a i7 with HT, instead of (2,1).

By using (2,1), you are specifiying the usage of only one thread.

That said, that script doesn't look very processor intensive... Still, can't hurt to try.

I've tried that but the speed got slower...even with (2,2) is slower than (2,1)..any hint?alternative?

Hagbard23
22nd September 2010, 12:40
Try using the MT.DLL ... you can multi-Thread in the temporal dimension (with SetMTMode) BUT you can also multithread in the spatial dimension.

Technical info

MT is a filter that splits a frame up into smaller fragments that are processed in individual threads, allowing full utilization of multiprocessor or hyperthread enabled computers. I tested it on my old abit bp6 with 2x celeron 400 MHz and it increased the speed by 40%. Note that if you are already getting 100% cpu utilization when processing avs scripts (eg if you're encoding to DivX/XviD) you don't need to use this filter.

http://avisynth.org/mediawiki/MT

I think MTSource is worth a try. You have to put "MT.DLL" (x64 Build) in the Plugin Directory

BTW: I have a i7 too (its the 860) and i confirm the encoding speed. I do not think you can crank it further up, but try it..maybe i am wrong.

BTW2: I do not really understand, why you resize twice (one for horiz. one for vertical)....can you explain it to me? And: I would never use Spline16 resize. Even Spline64Resize is worse than lanczos. And if it goes to compressibility i think a normal BiCubic Resize would do the trick either...sorry - just my opinion...nevermind...

http://hermidownloads.craqstar.de/videoresizefiltercomparasion/

Didée
22nd September 2010, 12:49
You should *not* do

SetMTmode(2,8)
DSS(source)
Resize()

but rather

SetMTmode(5,8) # suggestion: use (5,4) - 4 threads should be plenty enough
DSS(source)
SetMTmode(2)
Resize()

because Source filters (usually) don't like to be multi-threaded. In particular when your actual DS source filter is using CUDA, which won't really work multithreaded.

However, I suppose the bottleneck is not Avisynth, but rather Xvid. Its multithreading is nowhere near effective as that of x264. I reckon the most reasonable way to get higher FPS is to reduce Xvids encoding settings to something faster - drop VHQ to 2 or 1, don't use qpel, etc.

Motenai Yoda
22nd September 2010, 13:52
With the new megui's xvid build I go to 360fps first and 220fps second with normal settings, on an i7 920 stock. (with 4 thread work better)

Tuik
22nd September 2010, 14:09
With the new megui's xvid build I go to 360fps first and 220fps second with normal settings, on an i7 920 stock. (with 4 thread work better)

Megui x64? Could you tell me how?

Btw, I've tried this:

DirectShowSource("video.mkv")
MT("Spline16Resize(720, height())")
MT("Spline16Resize(width(), 400)", splitvertical=true)
Sharpen(0.4)

It speed up a little bit, but it's only 2-3 fps...

What are the right MT.dll files to put on x64 avisynth? And also, the best xvid_encraw x64 for this?

Hagbard23
22nd September 2010, 14:14
Well i use XviD x64 Builds from XviDVideo.ru:
http://www.xvidvideo.ru/xvid-video-codec/
and i do not use the commandline version (xvidencraw) because it seems to be buggy...

Please try MTSource - if you have MT.DLL correctly installed (it is supplied with the AviSynthx64 Build) you can call MTSource in the Script, just as you (rightly) have called the resizers.

MTSource(""" Directshowsource(C:\blah\blah\blah.mkv),opt1,opt2..)

Please tell us, how the story goes on.

BTW: Motenai Yoda - i don't believe you...please tell us more about your whole set-up...

Tuik
22nd September 2010, 14:43
Well i use XviD x64 Builds from XviDVideo.ru:
http://www.xvidvideo.ru/xvid-video-codec/
and i do not use the commandline version (xvidencraw) because it seems to be buggy...

Please try MTSource - if you have MT.DLL correctly installed (it is supplied with the AviSynthx64 Build) you can call MTSource in the Script, just as you (rightly) have called the resizers.


Please tell us, how the story goes on.

BTW: Motenai Yoda - i don't believe you...please tell us more about your whole set-up...


Ok, thanks a lot!

So you advise me to use xvid in the megui version? or VirtualDubx64 one?

Also, Is there a way to use DSS2 in x64?

Hagbard23
22nd September 2010, 16:14
I use Virtual Dub x64 & XviD 1.3 (latest) via VfW indeed...and it works quite fine

i do not know if there is a DSS2 x64 outthere, but i can only recommend to post a request in the AviSynthx64 Developement forum - maybe someone can help you out...

http://forum.doom9.org/showthread.php?t=152800

if that fails, try to contact the developer of DSS2 - since i never used Dss2 i can give you no exact advice, sorry...

€dit: I researched a bit and found out, that DSS2 is developed by the Haali-Team and it is ClosedSource. Therefor you have to contact the authors of this program to get a chance of a x64 Version.

Other people wrote, that DSS2 (Avss.dll) is dead already ... hmm ... if you contact the authors and get feedback, please post it here in the forum...thanks

Motenai Yoda
22nd September 2010, 16:54
BTW: Motenai Yoda - i don't believe you...please tell us more about your whole set-up...
http://yfrog.com/mimeguip preprocess, first pass, second pass...
"C:\megui\tools\xvid_encraw\xvid_encraw.exe" -i "C:\RH.avs" -pass2 "C:\RH.stats" -bitrate 1140
-kboost 100 -chigh 10 -clow 5 -overhead 0 -turbo -nopacked -vhqmode 4 -qtype 1 -lumimasking -imax 15
-pmax 15 -bvhq -bquant_ratio 100 -bmax 15 -par 1:1 -threads 4 -zq 0 10 -zw 2141 1 -zq 216053 10
-avi "C:\RH.avi" -vbvmax 4700000 -vbvsize 1700000 -vbvpeak 1500000 -drop -1
res 704x288.
my spec i7 920 D0, ex58-ud3r v1.6, 3*2GB corsair ddr3 1333 cl9, wd1000eads, hd4650 1gb, w7 64bit, megui 32bit, avisynth 2.58 mt set's build x86-32bit & x86-64bit. All at stock frequency

ps. with setmtmode(x,4) now the preprocess to lossless work @ 214fps XD

Tuik
22nd September 2010, 17:10
http://yfrog.com/mimeguip preprocess, first pass, second pass...
"C:\megui\tools\xvid_encraw\xvid_encraw.exe" -i "C:\RH.avs" -pass2 "C:\RH.stats" -bitrate 1140
-kboost 100 -chigh 10 -clow 5 -overhead 0 -turbo -nopacked -vhqmode 4 -qtype 1 -lumimasking -imax 15
-pmax 15 -bvhq -bquant_ratio 100 -bmax 15 -par 1:1 -threads 4 -zq 0 10 -zw 2141 1 -zq 216053 10
-avi "C:\RH.avi" -vbvmax 4700000 -vbvsize 1700000 -vbvpeak 1500000 -drop -1
res 704x288.
my spec i7 920 D0, ex58-ud3r v1.6, 3*2GB corsair ddr3 1333 cl9, wd1000eads, hd4650 1gb, w7 64bit, megui 32bit, avisynth 2.58 mt set's build x86-32bit & x86-64bit. All at stock frequency

ps. with setmtmode(x,4) now the preprocess to lossless work @ 214fps XD

what is your avs script?

Tuik
22nd September 2010, 17:11
I use Virtual Dub x64 & XviD 1.3 (latest) via VfW indeed...and it works quite fine

i do not know if there is a DSS2 x64 outthere, but i can only recommend to post a request in the AviSynthx64 Developement forum - maybe someone can help you out...

http://forum.doom9.org/showthread.php?t=152800

if that fails, try to contact the developer of DSS2 - since i never used Dss2 i can give you no exact advice, sorry...

€dit: I researched a bit and found out, that DSS2 is developed by the Haali-Team and it is ClosedSource. Therefor you have to contact the authors of this program to get a chance of a x64 Version.

Other people wrote, that DSS2 (Avss.dll) is dead already ... hmm ... if you contact the authors and get feedback, please post it here in the forum...thanks


Ok, thanks anyway..for me DSS2 is the fastest one :)

Hagbard23
22nd September 2010, 17:12
@M.Yoda

yeah - you're working with constant bitrate, with no extra options and turbo quantization

Okay - i believe, after a bit tweaking i get the same results...but the result would look (sorry) ugly for me..

Motenai Yoda
22nd September 2010, 17:30
yeah - you're working with constant bitrate, with no extra options and turbo quantization
the only extra option for xvid that i know is the custom matrix and hvs, that don't decrease performance...
and gmc an qpel that reduce compatibility with stand alone players...
turbo also is only for the first pass perhaps you mean trellis?

edit: oh shit! I neglected the cqm...

what is your avs script?
import("C:\Program Files (x86)\AviSynth 2.5\plugins\QMLF\QMLF8(10_motions).avsi")

global resx=704
global resy=288
global luma_min=0.35
global luma_max=0.8
global debug_l=false

function Motion_t_0_dark(clip a)
{return a.BicubicResize(resx,resy,0,0.60).removegrain(1)}
function Motion_t_0_normal(clip a)
{return a.LanczosResize(resx,resy)}
function Motion_t_0_light(clip a)
{return a.BicubicResize(resx,resy,0,0.60).removegrain(1)}

function Motion_t_1_dark(clip b)
{return b.BicubicResize(resx,resy,0,0.50).removegrain(1)}
function Motion_t_1_normal(clip b)
{return b.BicubicResize(resx,resy,0,0.65)}
function Motion_t_1_light(clip b)
{return b.BicubicResize(resx,resy,0,0.50).removegrain(1)}

function Motion_t_2_dark(clip d)
{return d.BicubicResize(resx,resy,0.1,0.45).removegrain(1)}
function Motion_t_2_normal(clip d)
{return d.BicubicResize(resx,resy,0,0.60)}
function Motion_t_2_light(clip d)
{return d.BicubicResize(resx,resy,0.1,0.45).removegrain(1)}

function Motion_t_3_dark(clip e)
{return e.BicubicResize(resx,resy,0.3,0.35).removegrain(2)}
function Motion_t_3_normal(clip e)
{return e.BicubicResize(resx,resy,0,0.50).removegrain(1)}
function Motion_t_3_light(clip e)
{return e.BicubicResize(resx,resy,0.3,0.35).removegrain(2)}

function Motion_t_4_dark(clip f)
{return f.BicubicResize(resx,resy,0.5,0.25).removegrain(2)}
function Motion_t_4_normal(clip f)
{return f.BicubicResize(resx,resy,0.2,0.4).removegrain(1)}
function Motion_t_4_light(clip f)
{return f.BicubicResize(resx,resy,0.5,0.25).removegrain(2)}

function Motion_t_5_dark(clip g)
{return g.BicubicResize(resx,resy,0.6,0.2).hqdn3d(2.0,1.5,3.0,4.5)}
function Motion_t_5_normal(clip g)
{return g.BicubicResize(resx,resy,0.4,0.3).removegrain(2)}
function Motion_t_5_light(clip g)
{return g.BicubicResize(resx,resy,0.6,0.2).hqdn3d(2.0,1.5,3.0,4.5)}

function Motion_t_6_dark(clip h)
{return h.BicubicResize(resx,resy,0.7,0.15).hqdn3d(2.0,1.5,3.0,4.5)}
function Motion_t_6_normal(clip h)
{return h.BicubicResize(resx,resy,0.5,0.25).removegrain(2)}
function Motion_t_6_light(clip h)
{return h.BicubicResize(resx,resy,0.7,0.15).hqdn3d(2.0,1.5,3.0,4.5)}

function Motion_t_7_dark(clip i)
{return i.BicubicResize(resx,resy,0.8,0.1).hqdn3d}
function Motion_t_7_normal(clip i)
{return i.BicubicResize(resx,resy,0.6,0.2).hqdn3d(2.0,1.5,3.0,4.5)}
function Motion_t_7_light(clip i)
{return i.BicubicResize(resx,resy,0.8,0.1).hqdn3d}

function Motion_t_8_dark(clip j)
{return j.BicubicResize(resx,resy,0.9,0.05).hqdn3d}
function Motion_t_8_normal(clip j)
{return j.BicubicResize(resx,resy,0.7,0.15).hqdn3d(2.0,1.5,3.0,4.5)}
function Motion_t_8_light(clip j)
{return j.BicubicResize(resx,resy,0.9,0.05).hqdn3d}

function Motion_t_9_dark(clip k)
{return k.BicubicResize(resx,resy,1,0).hqdn3d}
function Motion_t_9_normal(clip k)
{return k.BicubicResize(resx,resy,0.8,0.1).hqdn3d(2.0,1.5,3.0,4.5)}
function Motion_t_9_light(clip k)
{return k.BicubicResize(resx,resy,1,0).hqdn3d}

setmtmode(5,4)
MPEG2Source("C:\Users\Casa\Desktop\VTS_07_1.d2v", cpu=0)
setmtmode(2)
Crop(2, 74, -2, -74)
intro=trim(0,2126).BicubicResize(resx,resy,1,0).removegrain(2)
main=trim(2127,211590).QMLF(t_0=1, t_1=2, t_2=3, t_3=3.5,
t_4=4, t_5=4.8, t_6=5.4, t_7=6, t_8=7, t_sc=6, debug=false)
ending=trim(211591,216052).BicubicResize(resx,resy,1,0).removegrain(2)
credits=trim(216053,0).grayscale.BicubicResize(resx,resy,1,0).removegrain(2,0)
intro+main+ending+credits
Distributor()

Tuik
22nd September 2010, 17:59
When using SetMTMode is always necessary to use also Distributor()?

Motenai Yoda
22nd September 2010, 20:38
mencoder, virtualdub, and maybe enc_raw need it too.

Tuik
23rd September 2010, 10:16
Hey, i don't know what happen but now i'm getting this error when opening the avs script on megui 64:

---------------------------
AviSynth error
---------------------------
AviSynth script error:

DirectShowSource: RenderFile, the filter graph manager won't talk to me
(C:\Users\Admin\Documents\Encodes\script.avs, line 8)
---------------------------
OK
---------------------------


What it can be? Just to note that before this everything was running alright and i've already installed everything again and again and continue giving the same error.

Hagbard23
23rd September 2010, 11:14
Which Script exactly? The one M.Yoda suggests? Please post it...

BTW:
I experimented a bit, and after all i got a nice Performance Boost of about 40% in the second run. I used a script like that:
(just a quick shot)
Setmemorymax(2048)
LoadPlugin(blahblah)
...
SetMtMode(2,1)
DGSource(blah..)
SetMtMode(2,8)
AssumeFPS(25)
Removegrain(mode=2)
Resize(blah)
Limiter(blah)

Xvid-Options:
I have NOT used QPel, GMC
I have used VAQ and h.263
I have used VHQ (Mode Decision)
I have NOT used VHQ for B-Frames.
I have used 4 Threads
I have used all SSE's (incl SSE4) and left out 3dnow!.
I have used variable quantizer/variable Bitrate Mode of XviD in reference to a constant file size.

My System:
i7 860 w/ 4GB RAM @1333Mhz
Customer HDD @ 1TB (normal i think)
x64 OS / x64 Avs(Joshy/SeT) / x64 Plugins / x64 Virtual Dub / x64 DGNVTools

I use DGNVTools in D3D-Mode(unfortunately) due to my Graphic Card (GS9500 which doesn't support CUDA correctly)
The D3D-Mode of DGNVTools doesn't support Multithreading - that's why i used SetMtMode(2,1) for the DGSource-Call

FPS for second run wo/ optimization was: ~45 FPS
FPS for second run w/ optimization (see above) was: ~80 FPS

First Run was in both experiments: ~220 FPS

Didée
23rd September 2010, 11:42
If you start out with SetMTmode(2,1), then the later (2,8) does exactly nothing. All of that script is running single-threaded.

Hagbard23
23rd September 2010, 12:01
*grin*
yes - you're right...i will test again...i think the boost came from lowered XviD settings...it is well known, that qPel & GMC are using more resources and VHQ (depends on setting) too...

Tuik
6th November 2010, 13:10
Hey, i don't know what happen but now i'm getting this error when opening the avs script on megui 64:

---------------------------
AviSynth error
---------------------------
AviSynth script error:

DirectShowSource: RenderFile, the filter graph manager won't talk to me
(C:\Users\Admin\Documents\Encodes\script.avs, line 8)
---------------------------
OK
---------------------------


What it can be? Just to note that before this everything was running alright and i've already installed everything again and again and continue giving the same error.

Some help please? I'd appreciate a lot. I'm using DirectShowSource with Haali Media Splitter and CoreAVC Pro installed.

Also i'm using avisynth64_4-16-10 version and in MPC x64 the movie opens well (not the .avs but the HD source). Maybe it's something wrong with avisynth no?

Undead Sega
7th November 2010, 05:06
The pc is a notebook with a i7 Q720 (8 threads) and 6GB RAM.

I'm using avisynth 2.5.8 x64 (from here http://forum.doom9.org/showthread.php?t=152800) to encode HD to SD and the script is:



And i'm encoding in xvid_encraw x64 by squid_80 with this bat:



The decoder used is CoreAVC PRO with CUDA acceleration from GT330M.

I'm getting average 170fps@1pass and 41fps@2pass. What should i do to make it faster?

Also, previously, when encoding in avisynth i was using DirectShowSource2 which is way faster than DirectShowSource. Is there anyway to use DSS2 in avisynth 64?

Thanks to all of you!

You are just showing off right? :D

Tuik
7th November 2010, 14:17
Nop, i really need help :)