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.

Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se

 

Go Back   Doom9's Forum > General > Newbies

Reply
 
Thread Tools Search this Thread Display Modes
Old 5th August 2012, 21:35   #1  |  Link
wcwman18
Registered User
 
Join Date: Jul 2002
Posts: 107
Good x264 encode command line for AMD Phenom II X6 1045T 2.70 GHZ

I am trying to encode x264 and I have very minimal speeds. Below I will include my batch file and my avs code and I hope someone can help me tweak things for better encoding speed.

Batch file

Code:
basic x264 : x264.exe --threads 12 --crf 19 --vbv-bufsize 1450 --vbv-maxrate 1500 --direct auto --level 3.1 --ref 5 --subme 9 --weightp 2 \
 --b-adapt 2 --b-pyramid strict --me umh --keyint 300 --min-keyint 30 --aud --output %1.video.mkv %1
Code:
720p x264 : x264.exe --threads 12 --crf 14 --vbv-bufsize 4650 --vbv-maxrate 4700 --direct auto --level 3.1 --ref 5 --subme 9 --weightp 2 \
--b-adapt 2 --b-pyramid strict --me umh --keyint 300 --min-keyint 30 --aud --output %1.video.mkv %1
Here are my AVS Scripts

Basic x264

Code:
LoadPlugin("C:\Users\Owner\Desktop\pack\DG\DGAVCDecode.dll")
Load_STDCall_Plugin("C:\Program Files (x86)\AviSynth 2.5\plugins\yadif.dll")
DirectShowSource("prelims.ts")
ConvertToYV12()
Yadif(0,1)
Lanczos4Resize(704,400,6,6,-6,-6)
720p

Code:
LoadPlugin("C:\Users\Owner\Desktop\pack\DG\DGAVCDecode.dll")
Load_STDCall_Plugin("C:\Program Files (x86)\AviSynth 2.5\plugins\yadif.dll")
DirectShowSource("prelims.ts")
ConvertToYV12()
Yadif(0,1)
Lanczos4Resize(1280,720,6,6,-6,-6)

Last edited by Guest; 5th August 2012 at 22:15. Reason: formatting for readability
wcwman18 is offline   Reply With Quote
Old 5th August 2012, 21:55   #2  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,275
wcwman18, please fix the title of your thread according to rule #12:
http://forum.doom9.org/forum-rules.htm
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊
LoRd_MuldeR is offline   Reply With Quote
Old 5th August 2012, 21:57   #3  |  Link
vivan
/人 ◕ ‿‿ ◕ 人\
 
Join Date: May 2011
Location: Russia
Posts: 643
Just use presets.
vivan is offline   Reply With Quote
Old 5th August 2012, 22:12   #4  |  Link
wcwman18
Registered User
 
Join Date: Jul 2002
Posts: 107
Quote:
Originally Posted by LoRd_MuldeR View Post
wcwman18, please fix the title of your thread according to rule #12:
http://forum.doom9.org/forum-rules.htm
Sorry about that. How would I change it?
wcwman18 is offline   Reply With Quote
Old 5th August 2012, 22:14   #5  |  Link
wcwman18
Registered User
 
Join Date: Jul 2002
Posts: 107
Quote:
Originally Posted by vivan View Post
Just use presets.
What preset would you recommend for what I have written?
wcwman18 is offline   Reply With Quote
Old 5th August 2012, 22:18   #6  |  Link
detmek
Registered User
 
Join Date: Aug 2009
Posts: 463
Why do you use --vbv-maxrate and --vbv-bufsize? Are you streaming video over internet?
detmek is offline   Reply With Quote
Old 5th August 2012, 22:27   #7  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,275
Quote:
Originally Posted by wcwman18 View Post
What preset would you recommend for what I have written?
Use the "--tune" option that matches the kind of footage you are encoding, pick the slowest "--preset" that you can accept speed-wise and kick out all the other options. It's as easy as that

(In case you are going to author a BluRay disc, you of course have to keep those extra options required for BluRay compatibility)
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊
LoRd_MuldeR is offline   Reply With Quote
Old 5th August 2012, 22:30   #8  |  Link
wcwman18
Registered User
 
Join Date: Jul 2002
Posts: 107
Quote:
Originally Posted by LoRd_MuldeR View Post
Use the "--tune" option that matches the kind of footage you are encoding, pick the slowest "--preset" that you can accept speed-wise and kick out all the other options.
Is it really the fact that I don't use a preset that gives me about 18fps while encoding or is it within my batch file or avs?
wcwman18 is offline   Reply With Quote
Old 5th August 2012, 22:35   #9  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,275
Quote:
Originally Posted by wcwman18 View Post
Is it really the fact that I don't use a preset that gives me about 18fps while encoding or is it within my batch file or avs?
The preset system makes it easy to control the "speed -vs- quality" trade-off with x264.

In almost any case you will be better off by using the suitable "--preset" instead of trying to mess with the individual options manually.

If the encoding speed is too low for your purpose, then use a faster preset. If you want to squish out more quality (at the same bit-rate), then use a slower preset.

That's it! There are no "secret" options that will magically make x264 faster without sacrificing quality. It's all a trade-off...

(Nonetheless it should be clear that the presets only control the encoding-speed of x264 itself. It will not help if you are bottlenecked by your AVS script!)
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊

Last edited by LoRd_MuldeR; 5th August 2012 at 22:39.
LoRd_MuldeR is offline   Reply With Quote
Old 5th August 2012, 22:44   #10  |  Link
wcwman18
Registered User
 
Join Date: Jul 2002
Posts: 107
Quote:
Originally Posted by LoRd_MuldeR View Post
The preset system makes it easy to control the "speed -vs- quality" trade-off with x264.

In almost any case you will be better off by using the suitable "--preset" instead of trying to mess with the individual options manually.

If the encoding speed is too low for your purpose, then use a faster preset. If you want to squish out more quality (at the same bit-rate), then use a slower preset.

That's it! There are no "secret" options that will magically make x264 faster without sacrificing quality. It's all a trade-off...

(Nonetheless it should be clear that the presets only control the encoding-speed of x264 itself. It will not help if you are bottlenecked by your AVS script!)
I get about 94-96% cpu usage during my 720p encodes. Does that seem to you like a bottleneck issue to you?
wcwman18 is offline   Reply With Quote
Old 5th August 2012, 22:46   #11  |  Link
wcwman18
Registered User
 
Join Date: Jul 2002
Posts: 107
Based on the command line posted what would be a good preset example?
wcwman18 is offline   Reply With Quote
Old 5th August 2012, 22:49   #12  |  Link
wcwman18
Registered User
 
Join Date: Jul 2002
Posts: 107
The reason I even questioned in the first place is because I have a friend on a intel i7 that gets about 50-60fps using the same command line with thread-input and I am surprised I only get 18fps
wcwman18 is offline   Reply With Quote
Old 5th August 2012, 22:50   #13  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,275
Quote:
Originally Posted by wcwman18 View Post
I get about 94-96% cpu usage during my 720p encodes. Does that seem to you like a bottleneck issue to you?
CPU load doesn't say anything here

If you are using heavy filtering in your AVS script and these filters are multi-threaded, it can easily happen that the total CPU usage reaches 100% while ~90% of the CPU time is spent in Avisynth

What matters is throughput and throughput is measured as FPS.

If switching to a faster x264 preset doesn't increase the throughput, you probably are bottlenecked by Avisynth. Otherwise you probably aren't.

Quote:
Originally Posted by wcwman18 View Post
Based on the command line posted what would be a good preset example?
I would suggest to start with something like "x264.exe --tune film --preset slower -o <output> <input>" and check the throughput.

If that is too slow for your requirements, switch to the next faster preset. If that's still too slow, switch to the next faster preset again. And so on...

Quote:
Originally Posted by wcwman18 View Post
The reason I even questioned in the first place is because I have a friend on a intel i7 that gets about 50-60fps using the same command line with thread-input and I am surprised I only get 18fps
At this moment the Intel Core i7 is the fastest (consumer) CPU available while AMD is far behind, so not much of a surprise - even though you don't mention what model he has exactly

Anyway, as long as your friend doesn't encode with the identical Avisynth script and from the identical source file, the numbers aren't really comparable - even if the command-line is identical.

See also:
http://www.techarp.com/showarticle.a...tno=669&pgno=6
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊

Last edited by LoRd_MuldeR; 5th August 2012 at 23:31.
LoRd_MuldeR is offline   Reply With Quote
Old 6th August 2012, 13:36   #14  |  Link
wcwman18
Registered User
 
Join Date: Jul 2002
Posts: 107
Quote:
Originally Posted by LoRd_MuldeR View Post
CPU load doesn't say anything here

If you are using heavy filtering in your AVS script and these filters are multi-threaded, it can easily happen that the total CPU usage reaches 100% while ~90% of the CPU time is spent in Avisynth

What matters is throughput and throughput is measured as FPS.

If switching to a faster x264 preset doesn't increase the throughput, you probably are bottlenecked by Avisynth. Otherwise you probably aren't.



I would suggest to start with something like "x264.exe --tune film --preset slower -o <output> <input>" and check the throughput.

If that is too slow for your requirements, switch to the next faster preset. If that's still too slow, switch to the next faster preset again. And so on...



At this moment the Intel Core i7 is the fastest (consumer) CPU available while AMD is far behind, so not much of a surprise - even though you don't mention what model he has exactly

Anyway, as long as your friend doesn't encode with the identical Avisynth script and from the identical source file, the numbers aren't really comparable - even if the command-line is identical.

See also:
http://www.techarp.com/showarticle.a...tno=669&pgno=6
I did what you suggested and got about the same speed. Anything that could be causing this?

A little detail on my setup. I use a HD PVR to capture my video which records to a .TS file. Then I edit that file in Videoredo and then start my encode with the scripts and command line above.
wcwman18 is offline   Reply With Quote
Old 6th August 2012, 14:22   #15  |  Link
kypec
User of free A/V tools
 
kypec's Avatar
 
Join Date: Jul 2006
Location: SK
Posts: 826
Quote:
Originally Posted by wcwman18 View Post
I did what you suggested and got about the same speed. Anything that could be causing this?

A little detail on my setup. I use a HD PVR to capture my video which records to a .TS file. Then I edit that file in Videoredo and then start my encode with the scripts and command line above.
Few ideas:
  1. test how demanding your AVS script really is - use AVSMeter to get an idea how fast the script can actually run on your system
  2. replace your source filters - DirectShowSource is the least recommended one, use FFMS2 or if you have NVIDIA compatible card try DGDecNV which offloads video decoding burden from CPU -> GPU (or better said, dedicated VP engine that's built into a graphics card)
Once you know how fast your Avisynth script is you can tell if x264 encoding can get any faster or not
kypec is offline   Reply With Quote
Old 6th August 2012, 15:08   #16  |  Link
wcwman18
Registered User
 
Join Date: Jul 2002
Posts: 107
Quote:
Originally Posted by kypec View Post
Few ideas:
  1. test how demanding your AVS script really is - use AVSMeter to get an idea how fast the script can actually run on your system
  2. replace your source filters - DirectShowSource is the least recommended one, use FFMS2 or if you have NVIDIA compatible card try DGDecNV which offloads video decoding burden from CPU -> GPU (or better said, dedicated VP engine that's built into a graphics card)
Once you know how fast your Avisynth script is you can tell if x264 encoding can get any faster or not
I get this error
AVSMeter v1.21 by Groucho2004
AviSynth 2.58, buildec 22 2008 [08:46:51]
Script error: there is no function named "FFMS2Source
(fox_x264.avs, line 3)
wcwman18 is offline   Reply With Quote
Old 6th August 2012, 15:15   #17  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,275
Quote:
Originally Posted by wcwman18 View Post
I get this error
AVSMeter v1.21 by Groucho2004
AviSynth 2.58, buildec 22 2008 [08:46:51]
Script error: there is no function named "FFMS2Source
(fox_x264.avs, line 3)
Well, do you have the FFMS2 (FFmpegSource2) DLL in your Avisynth Plug-in's folder ???

Also, the functions exposed by up-to-date FFMS2 are FFVideoSource() and FFAudioSource(). The FFmpegSource2() function is only a wrapper function defined in some .avsi file...
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊

Last edited by LoRd_MuldeR; 6th August 2012 at 15:18.
LoRd_MuldeR is offline   Reply With Quote
Old 6th August 2012, 15:19   #18  |  Link
wcwman18
Registered User
 
Join Date: Jul 2002
Posts: 107
LoadPlugin("C:\Users\Owner\Desktop\pack\DG\DGAVCDecode.dll")
Load_STDCall_Plugin("C:\Program Files (x86)\AviSynth 2.5\plugins\yadif.dll")
AVCSource("ufcpost.dga")
ConvertToYV12()
Yadif(0,1)
Lanczos4Resize(704,400,6,6,-6,-6)

AVSMeter v1.21 by Groucho2004
AviSynth 2.58, buildec 22 2008 [08:46:51]

Number of frames: 94856
Length (h:m:s.ms): 00:52:45.029
Frame width: 704
Frame height: 400
Framerate: 29.970 (60000/2002)
Progressive: Yes
Colorspace: YV12

Hit ESC to exit...
Frame 875/94856, fps (min/max/avg): 12.54 | 15.68 | 13.59
wcwman18 is offline   Reply With Quote
Old 6th August 2012, 15:20   #19  |  Link
wcwman18
Registered User
 
Join Date: Jul 2002
Posts: 107
Quote:
Originally Posted by LoRd_MuldeR View Post
Well, do you have the FFMS2 (FFmpegSource2) DLL in your Avisynth Plug-in's folder ???

Also, the functions exposed by up-to-date FFMS2 are FFVideoSource() and FFAudioSource(). The FFmpegSource2() function is only a wrapper function defined in some .avsi file...
So, how should I update my AVS then?
wcwman18 is offline   Reply With Quote
Old 6th August 2012, 15:26   #20  |  Link
wcwman18
Registered User
 
Join Date: Jul 2002
Posts: 107
Quote:
Originally Posted by LoRd_MuldeR View Post
Well, do you have the FFMS2 (FFmpegSource2) DLL in your Avisynth Plug-in's folder ???
Yes I do have the DLL
wcwman18 is offline   Reply With Quote
Reply

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 17:35.


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