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.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 16th February 2015, 20:13   #1  |  Link
Mawazi
Registered User
 
Join Date: Dec 2007
Posts: 20
Avisynth/ffmpeg cpu usage 30% or lower

I'm trying to figure out why avisynth/ffmpeg are not using more cpu time. According to task manager, I'm barely getting up to 30%. Memory is fine, about 20% in use. I'm using multithreaded avisynth, with what should be a fairly intense avisynth script that uses qtgmc:

LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins\DGDecode.dll")
SetMTMode(1,8)
video=MPEG2Source("C:\Users\Mark\Documents\DVDFab9\Video\BBCDVD3672\arkinspace4.d2v",idct=5,cpu=0,info=3)
audio=WAVsource("C:\Users\Mark\Documents\DVDFab9\Video\BBCDVD3672\arkinspace4.wav")
AudioDub(video, audio)
AssumeTFF()
# SetMTMode(2)
QTGMC(Preset="Placebo", SourceMatch=3, Lossless=2, EdiThreads=8)
Interframe(NewNum=60,NewDen=1,Cores=8)
SincResize(788, 576)
Crop(10,0,768,576)


I've tried a number of SetMTMode parameters without any further cpu usage. I've tried upping the cores/threads to 16, no more cpu usage.

I've used ffmpeg with just copy for vcodec and acodec, but get the same result as far as fps encoded, which makes it seem that ffmpeg is not at fault. Or is ffmpeg possibly not using all of the cores/threads?

Hardware wise I have an Intel Core i7 4790k, 16Gb Ram, and a Samsung 850 Pro SSD. This is a recent hw build.

It seems like there is a bottleneck somewhere that is obviously not cpu limited, but I just don't understand it.

Any ideas?
Mawazi is offline   Reply With Quote
Old 16th February 2015, 20:25   #2  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,666
Well for starters you shouldn't really use MT mode 1 for source filters, QTGMC might perform better with mode 2, for Interframe take a look here for an example.
Reel.Deel is offline   Reply With Quote
Old 16th February 2015, 20:40   #3  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,377
avsmeter is a useful tool to determine where the bottleneck might be (likely it's the script)

if you cannot optmize script, you could run 2 more more parallel encodes
poisondeathray is offline   Reply With Quote
Old 20th February 2015, 10:00   #4  |  Link
kuchikirukia
Registered User
 
Join Date: Oct 2014
Posts: 476
You don't need 64 edithreads.
Have you tried distributor()? I don't know if ffmpeg needs it. (I use megui)

Also, do you need Interframe? QTGMC will usually be putting out 60fps.

Last edited by kuchikirukia; 20th February 2015 at 10:33.
kuchikirukia is offline   Reply With Quote
Old 20th February 2015, 16:13   #5  |  Link
Witzig
Registered User
 
Join Date: Jan 2014
Posts: 13
Some food for thought. Probably not the answer you're looking for but still helpful:

"Important: Always remember to judge the result by looking at the speed improvement not the cpu utilization."
http://avisynth.nl/index.php/MT

Good luck
Witzig is offline   Reply With Quote
Old 25th February 2015, 10:36   #6  |  Link
bxyhxyh
Registered User
 
Join Date: Dec 2011
Posts: 354
This happens to me on this script. When I check a script on AVSMeter CPU usage is 75% and speed is 4.5 fps. But when using ffmpeg it is 25-28% and 1.8 fps.
So I'm dividing my script into 2 parts and encoding same time without using MT.

Code:
#1st pass of the rip
SetMTMode(3,3)
DGDecode_mpeg2source("VTS_01_1.d2v", info=3)
SetMTMode(2)
qt=qtgmc(sourcematch=3,lossless=2).Selecteven()
qt2=qtgmc(preset="very slow",sharpness=0.2).Selecteven()
tf8=TFM(blockx=4,blocky=4,slow=2)
tf256=TFM(blockx=256,blocky=256,clip2=qt)
tf257=TFM(blockx=256,blocky=256,clip2=qt2)
TFM()
mask=FFImageSource("mask1.png").ConvertToYV12().loop(19000)
rf(tf256,1429,1434)
rf(tf8,2678,2775)
rf(qt2,9144,9147),
rf(tf8,9149,9149)
rf(tf257,13003,13084)
rf(qt,13041,13041)
rf(qt,13044,13044)
rf(qt,13046,13046)
rf(tf8,40430,42393)
rf(qt,40652,40652)
rf(qt,41790,41790)
rf(qt,41896,41896)
rf(qt,42030,42031)
rf(qt,42035,42036)
rf(tf256,42394,43069)
TDecimate(mode=1)
crop(4,2,-2,0)
nnedi3_rpow2(2,cshift="spline36resize")
crop(6,0,-6,0)
nonlinusm(z=3,pow=1.2,str=0.85,rad=0.6)
vmtoonmod(thinning=36,strength=16,xstren=128)

Last edited by bxyhxyh; 25th February 2015 at 10:41.
bxyhxyh is offline   Reply With Quote
Old 25th February 2015, 10:54   #7  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
Quote:
Originally Posted by bxyhxyh View Post
This happens to me on this script. When I check a script on AVSMeter CPU usage is 75% and speed is 4.5 fps. But when using ffmpeg it is 25-28% and 1.8 fps.
FFMpeg probably doesn't automatically call "Distributor()" whereas AVSMeter does. Add "Distributor()" as the last statement to your script and the numbers should be similar.

Edit - How are you feeding the script to ffmpeg?

Last edited by Groucho2004; 25th February 2015 at 12:44.
Groucho2004 is offline   Reply With Quote
Old 26th February 2015, 10:18   #8  |  Link
Tarutaru
A deadly Taru!
 
Tarutaru's Avatar
 
Join Date: Jun 2008
Location: San d'Oria, Vana'diel
Posts: 22
Quote:
Originally Posted by bxyhxyh View Post
This happens to me on this script. When I check a script on AVSMeter CPU usage is 75% and speed is 4.5 fps. But when using ffmpeg it is 25-28% and 1.8 fps.
So I'm dividing my script into 2 parts and encoding same time without using MT.

Code:
#1st pass of the rip
SetMTMode(3,3)
DGDecode_mpeg2source("VTS_01_1.d2v", info=3)
SetMTMode(2)
qt=qtgmc(sourcematch=3,lossless=2).Selecteven()
qt2=qtgmc(preset="very slow",sharpness=0.2).Selecteven()
tf8=TFM(blockx=4,blocky=4,slow=2)
tf256=TFM(blockx=256,blocky=256,clip2=qt)
tf257=TFM(blockx=256,blocky=256,clip2=qt2)
TFM()
mask=FFImageSource("mask1.png").ConvertToYV12().loop(19000)
rf(tf256,1429,1434)
rf(tf8,2678,2775)
rf(qt2,9144,9147),
rf(tf8,9149,9149)
rf(tf257,13003,13084)
rf(qt,13041,13041)
rf(qt,13044,13044)
rf(qt,13046,13046)
rf(tf8,40430,42393)
rf(qt,40652,40652)
rf(qt,41790,41790)
rf(qt,41896,41896)
rf(qt,42030,42031)
rf(qt,42035,42036)
rf(tf256,42394,43069)
TDecimate(mode=1)
crop(4,2,-2,0)
nnedi3_rpow2(2,cshift="spline36resize")
crop(6,0,-6,0)
nonlinusm(z=3,pow=1.2,str=0.85,rad=0.6)
vmtoonmod(thinning=36,strength=16,xstren=128)
Try to put distributor() at the end of the script.
I think it's depends on the filter you used,
In my case, it can use 100% of CPU when my script only calls QTGMC(), no distributor() is needed when piping avs to ffmpeg.
But it will only use 25% when i call autoadjust(), i need to add distributor() at the end to make it use 100% CPU and performance gain.

I'm runing avisynth and ffmpeg on Linux so this may not suite you.
__________________
Don'taru push me!!
Tarutaru is offline   Reply With Quote
Old 26th February 2015, 17:15   #9  |  Link
bxyhxyh
Registered User
 
Join Date: Dec 2011
Posts: 354
Yeah, it worked. Thank you guys.
bxyhxyh is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:19.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.