View Full Version : MeGui x264 encode only using 20% of CPU
Cman21
13th December 2010, 00:19
hello, i just got an i7 950 and i am only getting about 17% usage in one instance but i have ran 5 at once to get it up to ~90%. i would like to know what i can do to get my encodes using MeGui and x264 to get my usage at least 50% per instance. i do have CoreAVC installed, with a nvidia 460, but i am pritty sure it is NOT being used for the decoding and since it was mentioned as one of the possible fixes for a bottleneck in decoding i will mention it. below is the media info of the source, then my avs script for MeGui, and then the MeGui x264 profile settings. now i have tried setting threads to 0(auto) 4, 8, and 16 but it doesn't change a thing.
General
Complete name : D:\Encoding Work\test_video.264
Format : AVC
Format/Info : Advanced Video Codec
File size : 3.67 GiB
Video
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4.1
Format settings, CABAC : Yes
Format settings, ReFrames : 4 frames
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate : 23.976 fps
Resolution : 8 bits
Colorimetry : 4:2:0
Scan type : Progressive
Color primaries : BT.709-5, BT.1361, IEC 61966-2-4, SMPTE RP177
Transfer characteristics : BT.709-5, BT.1361
Matrix coefficients : BT.709-5, BT.1361, IEC 61966-2-4 709, SMPTE RP177
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins\MaskTools.dll")
global MeGUI_darx = 16
global MeGUI_dary = 9
LoadPlugin("C:\Program Files (x86)\megui\tools\dgavcindex\DGAVCDecode.dll")
AVCSource("D:\Encoding Work\Test.dga")
super = MSuper(pel=2, sharp=1)
backward_vec2 = MAnalyse(super, isb = true, delta = 2, overlap=4)
backward_vec1 = MAnalyse(super, isb = true, delta = 1, overlap=4)
forward_vec1 = MAnalyse(super, isb = false, delta = 1, overlap=4)
forward_vec2 = MAnalyse(super, isb = false, delta = 2, overlap=4)
MDegrain2(super, backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=400)
crop( 2, 2, -2, -2)
LanczosResize(1920,1080) # Lanczos (Sharp)
program --preset slow --tune animation --crf 19.0 --chroma-qp-offset 2
--level 4.1 --bframes 3 --ref 4 --slices 4 --aud --nal-hrd vbr --b-pyramid strict
--keyint 24 --min-keyint 2 --vbv-bufsize 30000 --vbv-maxrate 40000 --weightp 0
--colorprim "bt709" --transfer "bt709" --colormatrix "bt709" --output "output" "input"
if there is any other info you need just let me know.
also in another thread it was suggested that i use a multithreaded version of AVISynth but i had no idea what he was talking about and how would that help, if at all?
nurbs
13th December 2010, 00:36
How about you don't crosspost and ask your questions in the other thread (http://forum.doom9.org/showthread.php?p=1463589#post1463589)?
Cman21
13th December 2010, 00:42
ya i moved it to the GUI section due to no knowledge of MeGui, and this is a better location anyway as here people would actually know about the Gui im using and could actually offer advice without having to completely relearn all of this stuff another way. though i am still looking into everything he has suggested im just finding it to be more complicated to integrate without completely restarting than i would like it to be.
Groucho2004
13th December 2010, 01:05
How about you don't crosspost and ask your questions in the other thread (http://forum.doom9.org/showthread.php?p=1463589#post1463589)?
I suggested that he'd post here since this is a problem with the gui and not x264.
Sharktooth
13th December 2010, 01:56
the problem is not the gui.
the problem could be the decoder and/or avisynth/avs script (since it's not multithreaded).
Groucho2004
13th December 2010, 02:01
the problem is not the gui.
the problem could be the decoder and/or avisynth/avs script (since it's not multithreaded).
Ah, so megui supplies multithreaded Avisynth and multithreaded filters? In that case I guess the problem would be how he is using the gui?
Cman21
13th December 2010, 02:03
ok... im lost here what is wrong? what info do you need to help me determine what the problem might be?
Sharktooth
13th December 2010, 02:07
megui doesnt supply multithreaded avisynth, coz megui doesnt supply avisynth at all. you can install a multithreaded avisynth version BEFORE installing megui AND use the MT modes (see MT avisynth docs) to increase the multithreaded processing efficiency of the avisynth script.
that has to be done manually by editing the script.
you can get some references for AVS MT here: http://avisynth.org/mediawiki/MT and, obviously, on the avisynth forum.
also have a look here: http://forum.doom9.org/showthread.php?t=153808 (expecially THIS (http://forum.doom9.org/showthread.php?p=1388959#post1388959) post)
Cman21
13th December 2010, 02:15
ok running this .bat with that aviscript which should be using the x64 and multithreaded avisynth filters gives me a CPU usage of , ya..., ~20% but it is running with a higher fps than before. so the x64 is helping in that area but now im starting to think this might not be a issue with either the programs but maybe my OS or something else limiting me.
cls
@echo off
echo.
SET ENCODER=C:\Program Files (x86)\MeGui\tools\x264\x264.exe
SET SOURCE=D:\Encoding Work\test.avs
SET TARGET=D:\Encoding Work\test_1080p.264
SET PASS1="%SOURCE%" --preset slow --tune animation --crf 19.0--level 4.1 --output "%TARGET%"
"%ENCODER%" %PASS1%
with this AVIScript
# Set DAR in encoder to 16 : 9. The following line is for automatic signalling
global MeGUI_darx = 16
global MeGUI_dary = 9
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins64\DirectshowSource.dll")
DirectShowSource("D:\Encoding Work\test.mkv")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins64\mvtools2.dll")
super = MSuper(pel=2, sharp=1)
backward_vec2 = MAnalyse(super, isb = true, delta = 2, overlap=4)
backward_vec1 = MAnalyse(super, isb = true, delta = 1, overlap=4)
forward_vec1 = MAnalyse(super, isb = false, delta = 1, overlap=4)
forward_vec2 = MAnalyse(super, isb = false, delta = 2, overlap=4)
MDegrain2(super, backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=400)
crop( 2, 2, -2, -2)
LanczosResize(1920,1080) # Lanczos (Sharp)
Sharktooth
13th December 2010, 02:17
have you installed the MT-masktools?
also, directshowsource will use the default directshow avc decoder you have installed in your system. could you please tell me what it is?
Cman21
13th December 2010, 02:24
from SEt's Avisynth 2.5.8 MT compiled for *X86_64*, Latest Build 4/16/2010 (http://forum.doom9.org/showthread.php?t=152800) is where i got everything i used on this last run. i do like the ~30% increase in performance, in fps, but it is still only 20% of my CPU and i HATE waiting 18 hours on this encode while it only uses 20% of my cpu. oh COOL it is using CoreAVC 2.0 now with CUDA on my 460.
EDIT: im starting to think that it is not x264 but something in windows maybe? is there any way to see how many threads a process has to see if i am actually getting all 12 threads that i should be getting?
Sharktooth
14th December 2010, 02:28
task manager. click on processes then select view menu -> select columns -> select threads -> OK button.
look at the x264 process.
also it could be CUDA decoding is not fast enough to feed the input frames to avisynth, so the encoder gets bottlenecked. try with a multithreaded decoder like ffms-mt or libavcodec-mt (included in the latest ffdshow-mt builds)
Cman21
16th December 2010, 00:07
ok i looked at that and saw that there where 25 threads involved with x264, which i assume is want i want to see, and i also took a closer look at which cores where being use and i noticed that the first core was around 90% with 3 other cores around 5-10%, with 8 total cores with hyperthreading. could it be that im jut not actually using all my cores for this encode? i do know however when i run a simple encode without the filtering listed above and simply resized the video it ran at full 100%. this is actually starting to annoy me and if i cant figure this out i guess i will just have to deal with it and try to run multiple encodes at the same time to improve cpu utilization.
killerteengohan
15th July 2014, 12:22
I just use multiple MeGui workers to get the rest of the CPU usage since each worker only uses about 30-35% of my cpu, I use 3 of them and do 3 things at the same time.
Asmodian
15th July 2014, 19:43
from SEt's Avisynth 2.5.8 MT compiled for *X86_64*, Latest Build 4/16/2010 (http://forum.doom9.org/showthread.php?t=152800) is where i got everything i used on this last run. i do like the ~30% increase in performance, in fps, but it is still only 20% of my CPU and i HATE waiting 18 hours on this encode while it only uses 20% of my cpu. oh COOL it is using CoreAVC 2.0 now with CUDA on my 460.
EDIT: im starting to think that it is not x264 but something in windows maybe? is there any way to see how many threads a process has to see if i am actually getting all 12 threads that i should be getting?
Did you edit the script to add SetMTMode()'s?
Avisynth is by default single threaded, you need to tell it to use more because x264 is waiting on Avisynth most of the time. One core is busy with Avisynth while the rest are used by x264 and are mostly idle waiting for Avisynth.
I also strongly suggest you use Avisynth 2.6 MT (http://forum.doom9.org/showthread.php?t=148782) instead of 2.5.8.
detmek
15th July 2014, 22:09
Look at post date.
Asmodian
16th July 2014, 00:40
Ack, thanks - no need to answer a four year old thread. :o
I guess killerteengohan was posting for Google's benefit?
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.