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 > Video Encoding > MPEG-4 AVC / H.264

Reply
 
Thread Tools Search this Thread Display Modes
Old 25th October 2012, 17:13   #1  |  Link
timon_lion
Registered User
 
Join Date: Jun 2012
Posts: 10
Slow encoding?

I have built a cheap system for encoding x264 HDTV sources.
AMD X4 PhenomII 955 3.2Ghz
2x SSD Kingston 64GB RAID
2x2GB RAM DDR3 1333Mhz

My source is 1440x1080i anamorphic , 25fps ~18000kbps
My output is 1280x720p, 25fps ~4000kbps (using avisynth script)
and my settings are
Code:
program --level 4.1 --preset veryslow --pass 2 --bitrate 3914 --stats ".stats" --bframes 5 --ref 9 --output "output" "input"
The first pass processed at ~17fps
and the second pass at ~5fps

Isn't that a bit slow or is it normal?
I hoped for 3 or 4 times that..
timon_lion is offline   Reply With Quote
Old 25th October 2012, 17:24   #2  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,565
Is the CPU utilization at 100%? Check task manager.
Is the AviSynth script slow? Post the script.

This question gets asked quite often, so you may find useful advice using the forum search.

But 3 to 4 times faster is out of the question with those settings.

Last edited by sneaker_ger; 25th October 2012 at 17:27.
sneaker_ger is offline   Reply With Quote
Old 25th October 2012, 17:26   #3  |  Link
Atak_Snajpera
RipBot264 author
 
Atak_Snajpera's Avatar
 
Join Date: May 2006
Location: Poland
Posts: 7,812
it is normal. You used --preset veryslow so what did you expect?!
Atak_Snajpera is offline   Reply With Quote
Old 25th October 2012, 17:34   #4  |  Link
nhakobian
Registered User
 
Join Date: Oct 2009
Location: San Francisco, CA
Posts: 99
Can you post your avisynth script? Especially as to which decoder you are using.

At first glance this does not seem unreasonable, however, I have not had experience with your AMD processor so am not sure how it compares.

You may also want to look at your CPU usage during 1st and 2nd passes, as they can give you an idea if you are reaching a decoding bottleneck. Since your 2nd pass encoding speed is significantly less than the first, that may not be an issue. You may also want to see if you are getting close to running out of memory. I know from personal experience that with complex avisynth scripts on top of x264 can use a significant amount of memory; 4GB is somewhat low for modern systems. However, if you were running out of memory and disk swapping, I'd expect your encoding speed to be significantly slower than what you posted, so that may not be an issue.

You may also want to post what x264 version you are using and where you got it from, and if you are calling it directly from a command line or using a GUI.

EDIT: D'oh. Other people are so quick in replying....
nhakobian is offline   Reply With Quote
Old 25th October 2012, 17:37   #5  |  Link
timon_lion
Registered User
 
Join Date: Jun 2012
Posts: 10
Quote:
Originally Posted by sneaker_ger View Post
Is the CPU utilization at 100%? Check task manager.
Is the AviSynth script slow? Post the script.

This question gets asked quite often, so you may find useful advice using the forum search.

But 3 to 4 times faster is out of the question with those settings.
CPU usage was from 75% to 95% so yes almost full usage.
AviSynth script:
Code:
LoadPlugin("C:\MeGUI\tools\dgindex\DGDecode.dll")
DGDecode_mpeg4source("C:\Users\public\Videos\1.d2v", info=3)
LoadPlugin("C:\MeGUI\tools\avisynth_plugin\ColorMatrix.dll")
ColorMatrix(hints=true, interlaced=true, threads=0)
Load_Stdcall_Plugin("C:\MeGUI\tools\yadif\yadif.dll")
Yadif(order=1)
#crop
LanczosResize(1280,720) # Lanczos (Sharp)
#denoise
Thank you for your answers.

Last edited by timon_lion; 25th October 2012 at 17:50. Reason: wrong cpu usage info
timon_lion is offline   Reply With Quote
Old 25th October 2012, 17:42   #6  |  Link
timon_lion
Registered User
 
Join Date: Jun 2012
Posts: 10
Quote:
Originally Posted by nhakobian View Post
You may also want to post what x264 version you are using and where you got it from, and if you are calling it directly from a command line or using a GUI.

EDIT: D'oh. Other people are so quick in replying....
lol yes they do.
Im using x264 v2200 and the last stable version of megui.

Resource monitor:
x264_64.exe - CPU 65% to 85% - Average CPU 73%
avs4x264mod.exe - CPU 8% to 14% - Average CPU 11%

I think you are all right. I expected too much with this settings.

Last edited by timon_lion; 25th October 2012 at 17:58.
timon_lion is offline   Reply With Quote
Old 25th October 2012, 18:10   #7  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,565
Between 75% and 95% is not that bad, but it should be 95%+ most of the time. (You can try AviSynth MT)
If you have an adequate Nvidia card and 15$ to spare you could make DGDecNV do the decoding + deinterlacing + resizing. Also test for yourself if preset veryslow is really worth it, preset slower is also very good.

But yes, there is not that much room for improvement.
sneaker_ger is offline   Reply With Quote
Old 25th October 2012, 20:19   #8  |  Link
timon_lion
Registered User
 
Join Date: Jun 2012
Posts: 10
Quote:
Originally Posted by sneaker_ger View Post
Between 75% and 95% is not that bad, but it should be 95%+ most of the time. (You can try AviSynth MT)
If you have an adequate Nvidia card and 15$ to spare you could make DGDecNV do the decoding + deinterlacing + resizing. Also test for yourself if preset veryslow is really worth it, preset slower is also very good.

But yes, there is not that much room for improvement.
Well thank you for your answer. I'll try preset slower and compare the results. My graphic is an onboard one NVIDIA GeForce 7025, which is not supported by DGDecNV. Their website says:
"That means the card must have a VP2 or greater engine. VP1 is not supported!"
Mine is VP1.
Do you think a pci geforce could make a difference?
timon_lion is offline   Reply With Quote
Old 25th October 2012, 21:25   #9  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,565
Only you can decide, but I think the amount of hassle and money that goes into it might not be worth it.
sneaker_ger is offline   Reply With Quote
Old 25th October 2012, 21:43   #10  |  Link
Asmodian
Registered User
 
Join Date: Feb 2002
Location: San Jose, California
Posts: 4,407
After trying a PCI GeForce about three years ago I can only say, do not get a PCI GeForce. PCI is just too slow.
Asmodian is offline   Reply With Quote
Old 26th October 2012, 18:24   #11  |  Link
timon_lion
Registered User
 
Join Date: Jun 2012
Posts: 10
Well i tried preset slow and i got the same results ~17fps but with 25% CPU usage and 0MB free memory.
Probably i need to upgrade my ram, right?
timon_lion is offline   Reply With Quote
Old 26th October 2012, 18:39   #12  |  Link
Filker
Registered User
 
Join Date: Dec 2008
Posts: 39
Same speed and 25%cpu usage? Try ultrafast to see if it's the same.

Have you tried resizing through the GPU?

http://avisynth.org/oldwiki/index.php?page=GPU_001

It only needs DirectX 9 and pixel shader 2.0. Geforce 7025 specs say Pixel Shader 3.0.
Filker is offline   Reply With Quote
Old 27th October 2012, 02:49   #13  |  Link
timon_lion
Registered User
 
Join Date: Jun 2012
Posts: 10
Quote:
Originally Posted by Filker View Post
Same speed and 25%cpu usage? Try ultrafast to see if it's the same.

Have you tried resizing through the GPU?

http://avisynth.org/oldwiki/index.php?page=GPU_001

It only needs DirectX 9 and pixel shader 2.0. Geforce 7025 specs say Pixel Shader 3.0.
Well i tried the first pass in ultrafast and i got the same results 17fps, ~25% CPU usage, a few mb of ram free and a lot in standby mode.

I checked GPU_001 wiki but the last reference of where to find that plugin was here http://forum.doom9.org/showthread.php?t=84481 and the link provided is dead.
timon_lion is offline   Reply With Quote
Old 27th October 2012, 03:59   #14  |  Link
Filker
Registered User
 
Join Date: Dec 2008
Posts: 39
Quote:
Originally Posted by timon_lion View Post
Well i tried the first pass in ultrafast and i got the same results 17fps, ~25% CPU usage, a few mb of ram free and a lot in standby mode.

I checked GPU_001 wiki but the last reference of where to find that plugin was here http://forum.doom9.org/showthread.php?t=84481 and the link provided is dead.
Some thing's obviously wrong. There's a bottleneck before the encoder.

GPU_001 is available here:
https://skydrive.live.com/?cid=adc0ad43e645aeed&id=ADC0AD43E645AEED!160
moded (latest?) version here:
http://www.avisynth.info/?%A5%A2%A1%BC%A5%AB%A5%A4%A5%D6#x44606bb

Put all the .dll and .hlsl files in the plugin folder or a specific subfolder. On my system it crashes unless I convert to yuy2.

loadplugin("C:\Program Files\AviSynth 2.5\plugins\GPU25.dll")
avisource("xxxx.AVI").converttoyuy2

GPU_Start()
GPU_LanczosResize(1280,720)
GPU_End()

See if that helps.

Last edited by Filker; 27th October 2012 at 04:53.
Filker is offline   Reply With Quote
Old 27th October 2012, 09:52   #15  |  Link
mogobime
Registered User
 
Join Date: Oct 2012
Posts: 44
for automatic benchmarking different x264 settings in speed, quality, bitrate and cpu-load you can try my tool I posted here:
https://forum.doom9.org/showthread.php?t=166295

Last edited by mogobime; 27th October 2012 at 11:37.
mogobime is offline   Reply With Quote
Old 27th October 2012, 21:47   #16  |  Link
timon_lion
Registered User
 
Join Date: Jun 2012
Posts: 10
@Filker
I had a problem using the script you gave me(im not an avs expert, i can only understand it, not create it myself). My source is ts not an avi, so i got an error message. I will do some studying and try again.
Anyway i ordered 2x4gb of ram (i'll have it by monday) because i think one of my rams is failing and check the performance afterwards.

@mogobime
Nice tool i got some nice results of a sample i tested.
1
Quote:
.x264.exe --crf 19 --ref 5 --keyint 500 --min-keyint 0 --scenecut 40 --bframes 3 --b-bias 0 --b-pyramid normal --direct auto --b-adapt 2 --sync-lookahead 25 --partitions all --8x8dct --no-fast-pskip --me umh --merange 24 --mvrange -1 --subme 7 --cabac --trellis 0 --psy-rd 0:0 --weightp 2 --aq-mode 0 --aq-strength 0 --nr 0 --deadzone-inter 21 --deadzone-intra 11 --cqm flat --threads auto --sar 1:1 --deblock -1:-1 --psnr --ssim --colormatrix undef --output "C:\Users\Public\Downloads\tmp\tmpvid.mkv" "C:\Users\Public\Downloads\VIDEOFILES\sample.ts"

[NR]1 [QUANTIZATION]19 [SUBME]7 [REF]5 [BFRAMES]3 [PSY-RD]0:0 [ME]umh [MERANGE]24 [TRELLIS]0 [CPULOAD]95 [AvgPSNR]44.772 [SSIM]17.766db [FPS]3.8 [BR]9682 [BF_USED]10367 [PF_USED]5490 [IF_USED]41 [ENCODINGMODE]crf [AQ-MODE]0 [AQ-STRENGTH]0 [CPUNAME]AMD Phenom(tm) II X4 955 Processor [CPUCLOCK]3200

2.
Quote:
x264.exe --crf 69 --ref 1 --keyint 500 --min-keyint 0 --scenecut 40 --bframes 1 --b-bias 0 --b-pyramid normal --direct auto --b-adapt 2 --sync-lookahead 25 --partitions all --8x8dct --no-fast-pskip --me umh --merange 24 --mvrange -1 --subme 7 --cabac --trellis 0 --psy-rd 0:0 --weightp 2 --aq-mode 0 --aq-strength 0 --nr 0 --deadzone-inter 21 --deadzone-intra 11 --cqm flat --threads auto --sar 1:1 --deblock -1:-1 --psnr --ssim --colormatrix undef --output "C:\Users\Public\Downloads\tmp\tmpvid.mkv" "C:\Users\Public\Downloads\VIDEOFILES\sample.ts"

[NR]1 [QUANTIZATION]69 [SUBME]7 [REF]1 [BFRAMES]1 [PSY-RD]0:0 [ME]umh [MERANGE]24 [TRELLIS]0 [CPULOAD]98 [AvgPSNR]~0,-3SumPSNR:~-3 [SSIM]6.549db [FPS]277.6 [BR]280 [BF_USED]9298 [PF_USED]64 [IF_USED]30 [ENCODINGMODE]crf [AQ-MODE]0 [AQ-STRENGTH]0 [CPUNAME]AMD Phenom(tm) II X4 955 Processor [CPUCLOCK]3200
Lower the settings, i get higher speeds. Why isnt that happening when using megui too?

Last edited by timon_lion; 27th October 2012 at 21:57.
timon_lion is offline   Reply With Quote
Old 27th October 2012, 23:21   #17  |  Link
Filker
Registered User
 
Join Date: Dec 2008
Posts: 39
It's all the other processing going on before the image is fed to the encoder.
Colormatrix, Deinterlacing with yadif and resizing is slowing down the conversion. X264 can't go faster than what it receives.
Have you tried opening the video file in vlc with yadif deinterlacing turned on ? If it stutters it confirms that yadif is too heavy for the cpu to handle in realtime.
I made some experiments with the GPU plugin's resize functions and had some artifacts in the image. Try using a simpler deinterlace:

LoadPlugin("C:\MeGUI\tools\dgindex\DGDecode.dll")
DGDecode_mpeg4source("C:\Users\public\Videos\1.d2v", info=3)
LoadPlugin("C:\MeGUI\tools\avisynth_plugin\ColorMatrix.dll")
ColorMatrix(hints=true, interlaced=true, threads=0)
#if frame order is reversed uncomment next line:
#assumetff()
bob()
#crop
LanczosResize(1280,720) # Lanczos (Sharp)
#denoise

encode it in ultrafast to see how fast it goes.

Another way to acelerate the deinterlacing would be using LAV filter with DXVA2 hardware CUVID deinterlacing, but I think geforce 7025 IGP doesn't have CUDA and I'm not sure this will work in megui.

Anyway this seems to be a deinterlacing/resizing problem so posting in avisynth usage should get you more help.

Last edited by Filker; 28th October 2012 at 13:05.
Filker is offline   Reply With Quote
Old 28th October 2012, 09:50   #18  |  Link
mogobime
Registered User
 
Join Date: Oct 2012
Posts: 44
you should not have those problems with this CPU I think and reasonable settings should always produce a cpu-load around 95%
You will get a lot of speed, if you:
-don't use veryslow preset
-always use mor reference-frames than b-frames
-use subme 9 or 7
-use me umh
-don't go above merange 24
-deactivate trellis, use aq mode 2 instead
-use psy-rd but forget psy-trellis, because trellis slows down extremely

Apropos, X-QuaSaT can raise the key settings like ref/bframes/subme for you automatically, you don't need to configure, run, configure, run...
Just set a setting like ref-frames to "step" and configure the loop settings below it.

you can find some test results in my X-QuaSaT-thread:
http://forum.selur.de/topic193-xquas...-download.html at "DOWNLOAD SOME EXEMPLARIC X-QUASAT GENERATED ANALYSIS FILES"
Read "how_to_open_csv-files_best.txt"

And Maybe you should try Hybrid, for me it's the best encoding tool i know

Last edited by mogobime; 28th October 2012 at 10:33.
mogobime is offline   Reply With Quote
Old 31st October 2012, 21:20   #19  |  Link
timon_lion
Registered User
 
Join Date: Jun 2012
Posts: 10
Quote:
Originally Posted by Filker View Post
It's all the other processing going on before the image is fed to the encoder.
Colormatrix, Deinterlacing with yadif and resizing is slowing down the conversion. X264 can't go faster than what it receives.
Have you tried opening the video file in vlc with yadif deinterlacing turned on ? If it stutters it confirms that yadif is too heavy for the cpu to handle in realtime.
Well, opened in vlc with yadif deinterlacing on and the playback was as smooth as it gets. Although, with yadif(x2) deinterlace on, i had some minor stuttering/juddering.
I also tried an old source of mine that does not need resize/deinterlace and the encoding was way faster (~70fps/~25fps).
The last test i had was with the 1440x1080i source but without deinterlacing/resizing options on. The results was around (~25fps/~10fps) and ~60% CPU usage, so a bit faster but yet not using the full potential of my CPU.
All tests at slow preset.

Now i have 2x4gb ram. Do you think i should change my virtual memory settings?
timon_lion is offline   Reply With Quote
Old 31st October 2012, 22:35   #20  |  Link
nhakobian
Registered User
 
Join Date: Oct 2009
Location: San Francisco, CA
Posts: 99
Quote:
Originally Posted by timon_lion View Post
Now i have 2x4gb ram. Do you think i should change my virtual memory settings?
Unless you have manually fixed the size, Windows will automatically increase your swapfile size when you add more ram.
nhakobian is offline   Reply With Quote
Reply

Tags
encoding time, slow encoding

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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:42.


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