Log in

View Full Version : Could you check TOP most important parms for x264 ?


MarcioAB
30th July 2007, 01:27
Based on your experience could you please check if the proposed order is appropriated ? (more clean list). Thank you

Context: Importance in Image Quality for the same bitrate/filesize but no care about encode time.


01. entropy encoding (cabac).[ (default) ]
02. subme (7) + B-rdo ...... [ --subme 7 --b-rdo ]
03. in-loop deblocking -3,-3 [ --filter -3,-3 ]
04. in-loop deblocking -2,-2 [ --filter -2,-2 ]
05. deadzone options (?) ... [ ? ]
06. subme (6) + B-rdo ...... [ --subme 6 --b-rdo ]
07. reference frames (16) .. [ -- ref 16 ]
08. reference frames (5) ... [ --ref 5 ]
09. reference frames (3) ... [ --ref 3 ]
10. trellis (2) ............ [ --trellis 2 ] to final pass only
11. mixed-refs ............. [ --mixed-refs ]
12. bframes (16) ........... [ --bframes 16 ]
13. bframes (3) ............ [ --bframes 3 ]
14. bframes (2) ............ [ --bframes 2 ]
15. weighted b prediction .. [ --weightb ]
16. b-pyramid .............. [ --b-pyramid ]
17. trellis (1) ............ [ --trellis 1 ]
18. B-frame mode (auto) .... [ --direct auto ]
19. 8x8dct ................. [ --8x8dct ]
20. Macroblock (all) ....... [ --analyse all // --partitions all ]
21. Macroblock (Custom) .... [ --analyse p8x8,b8x8,i4x4,i8x8 ]
22. M.E. algorithm (umh) ... [ --me umh ]
23. M.E. range (64) ........ [ --merange 64 ] best
24. M.E. range (16) ........ [ --merange 16 ] fine
25. A.Q. (0.9) ............. [ --aq-strength 0.9 ] patch only
26. A.Q. (0.3) ............. [ --aq-strength 0.3 ] patch only
27. Cust Matrice Prestige .. [ --cqm "Prestige CQM" ]
28. Cust Matrice JVT ....... [ --cqm "jvt" ]
29. No Fast P-Skip ......... [ --no-fast-pskip ]
30. No Dct Decimation ...... [ --no-dct-decimate ]
31. Biderectional ME ....... [ -- bime ]

Terranigma
30th July 2007, 02:26
Based on your experience could you please check if the proposed order is appropriated ? (more clean list). Thank you

Importance in Quality (no care about time or size)

no. 28 is usually worse than the default setting.
no. 25 is a bit strong imo. 0.3 is just fine, as long as you use a custom quantization matrix that isn't prone to blocking "Prestige CQM/M4G-V3".
no. 07 is insane. The quality difference between no.8 is very minimal, but the cpu usage and speed between the 2 is quite large. Stick with no.8 and use no.12 to compensate for the minimal quality loss between 5 ref (which'd be 8 reference frames in the end) and 16 ref frames. Everything else seems fine to me, but how is it that there's quite the difference between no. 10 and no. 17? :confused:

MarcioAB
30th July 2007, 03:32
01. entropy encoding (cabac) [ (default) ]
02. subme (7) + B-rdo ...... [ --subme 7 --b-rdo ]
03. in-loop deblocking -3,-3 [ --filter -3,-3 ]
04. in-loop deblocking -2,-2 [ --filter -2,-2 ]
05. deadzone options (?) ... [ ? ]
06. subme (6) + B-rdo ...... [ --subme 6 --b-rdo ]
07. reference frames I ..... [ --ref 5 --bframes 16]
08. reference frames II .... [ --ref 3 --bframes ??]
09. trellis (2) ............ [ --trellis 2 ] to final pass only
10. mixed-refs ............. [ --mixed-refs ]
11. weighted b prediction .. [ --weightb ]
12. b-pyramid .............. [ --b-pyramid ]
13. trellis (1) ............ [ --trellis 1 ]
14. B-frame mode (auto) .... [ --direct auto ]
15. 8x8dct ................. [ --8x8dct ]
16. Macroblock (all) ....... [ --analyse all // --partitions all ]
17. Macroblock (Custom) .... [ --analyse p8x8,b8x8,i4x4,i8x8 ]
18. M.E. algorithm (umh) ... [ --me umh ]
19. M.E. range (64) ........ [ --merange 64 ] best
20. M.E. range (16) ........ [ --merange 16 ] fine
21. A.Q. (0.9) ............. [ --aq-strength 0.9 ] patch only
22. A.Q. (0.3) ............. [ --aq-strength 0.3 ] patch only
23. Cust Matrice Prestige .. [ --cqm "Prestige CQM" ]
24. Cust Matrice NONE ...... [ (default) ]
25. Cust Matrice JVT ....... [ --cqm "jvt" ]
26. No Fast P-Skip ......... [ --no-fast-pskip ]
27. No Dct Decimation ...... [ --no-dct-decimate ]
28. Biderectional ME ....... [ --bime ]


0.3 is just fine, as long as you use a custom quantization matrix that isn't prone to blocking "Prestige CQM/M4G-V3".Not follow this: Are --cqm and --aq-strength somehow correlated ?
how is it that there's quite the difference between no. 10 and no. 17?Please, help me to position Trellis 1 and 2 accordingly regard his relative importance to the other parms.
no. 25 is a bit strong imo. 0.3 is just fine
Someone suggested it. I understood --aq-strength 0.9 will generate a better image quality compared to --aq-strength 0.3. Because increasing from 0.3 to 0.9 will not move this item significantly toward the top and because those 2 items are too low in importance regard image quality, decision on utilization will be based on encode time ... that I will left to the 2nd part of this table, to not complicate it too much now.

Terranigma
30th July 2007, 14:59
I understood --aq-strength 0.9 will generate a better image quality compared to --aq-strength 0.3. Because increasing from 0.3 to 0.9 will not move this item significantly toward the top and because those 2 items are too low in importance regard image quality, decision on utilization will be based on encode time ... Adaptive Quantization was designed to help prevent blocking,
And who's this person that told you this? Do a test with aq strength of 0.9 and 0.3 and compare. The reason why some folks tends to use such a high value of 0.9 or higher, is because they also use trellis-2. Trellis-2 is one of those break it or make it options, similar to xvid's qpel option. With Xvid + Qpel, sometimes in can increase the quality, by making the image more detailed (because of the grainy picture), but most of the times it ends up backfiring and making the output smudgy. With Trellis-2, the way it backfires is by blocking up the picture, so to compensate for the blockiness, you'd need to increase the aq-strength to a less than sane level (1.2/0.9) and lower the aq-sensitivity. I'd never use trellis-2 because of this issue. Unless there's some workaround that i'm not aware of.

Not follow this: Are --cqm and --aq-strength somehow correlated ?
No. --cqm = custom quantisation matrix
CQM is the abbreviation for Custom Quantisation Matrix (or Matrices). A quantisation matrix is made up from a grid of numbers and each one is referred to as a quantum. It is these numbers that define how image data is discarded. A grid with large quantums will produce a softer image, and a grid with lower quantums will retain more detail. x264 by default uses a "flat 16" matrix, which is simply a matrix with all quantums set at 16 and does not require any special decoding. In contrast to this, custom quantisation matrices are a high profile feature and require special decoding support, though the actual decoding of them should require no more or no less resources. You might remember custom matrices from XviD, for most cases the default H.263 quantisation type worked fine, and in the case of x264, flat 16 is probably fine most of the time. In some cases you might want to use a matrix with a lot of high quantums in the high frequency co-efficient areas so that fine details become smoothed slightly and easier to compress.

One part of the settings for Adaptive Quantisation. Adaptive Quantisation allows different parts of a frame to use different quantisers, as opposed to the whole frame using the same quantizer. The common use for this in XviD was that it would compress light and dark areas more, thus freeing bits for parts that were more noticable. Adaptive Quantisation works differently in x264 because it was added by Haali to address a problem that large blue areas could sometimes look blocky. Adaptive Quantisation in x264 assigns more bits to dark and blue areas to help stop them blocking up. This particular setting instructs the amount to adjust QP per Macroblock. Setting 0.0 is no Adaptive Quantisation, and 1.1 is considered strong. It is recommended that you only use this setting if your source is particularly blocky in blue areas only wheras the rest of the image looks fine.

Please, help me to position Trellis 1 and 2 accordingly regard his relative importance to the other parms.
Check my first response.

Is your ultimate goal is to come up with a profile for the highest quality picture possible? If so, in Megui, there's a preset called HQ-Insane which is almost close to what you're trying to achieve, but it uses trellis-2 :p

MarcioAB
2nd August 2007, 01:31
Is your ultimate goal is to come up with a profile for the highest quality picture possible? If so, in Megui, there's a preset called HQ-Insane which is almost close to what you're trying to achieve, but it uses trellis-2 :p
My ultimate goal is to have a very simple table (that is the point: must be simple) to help me handle x264 parms to find and push the "edges" of an encode.

Profiles (including the HQ-Insane, that I tried now) are nice, but they are more like a "black-box" to me. I want to be in a predictable and controllable environment.

And I want to thank you to so much information provided.

My head is just spinning now with all that information and specially because I started comparing --2pass with --cfr (using PSNR and SSIM ... long story) and found --cfr "better than" --2pass in all cases tested so far. I wonder why ? (need to understand more what is behind the Rate Control (that I was calling "intelligence" of the encode) of --2pass and --cfr.

Thank you.

Terranigma
2nd August 2007, 02:02
I started comparing --2pass with --cfr (using PSNR and SSIM ... long story) and found --cfr "better than" --2pass in all cases tested so far. I wonder why ? (need to understand more what is behind the Rate Control (that I was calling "intelligence" of the encode) of --2pass and --cfr.

Thank you.

Have you tested the 2 pass using the same bitrate obtained from --crf? add this to your first pass
--ratetol 1.5
To give the 2 pass method a leg up, add this also on the commandline (for both passes)
--deadzone-intra 4 --deadzone-inter 4

You'd need to ask akupenguin(pengvado) about crf's Rate Control, because the only thing I know about crf is that it's based on a nominal QP.

MarcioAB
2nd August 2007, 02:39
Have you tested the 2 pass using the same bitrate obtained from --crf?Yes, please check results (started from "default" profile):--crf 26 --analyse p8x8,b8x8,i4x4 --vbv-maxrate 25000 --threads auto --thread-input --progress --output "D:\SIGNS\VIDEO_TS\input3000.mp4" "D:\SIGNS\VIDEO_TS\input3000.avs"
avis [info]: 720x480 @ 23.98 fps (3000 frames)
x264 [info]: using cpu capabilities: MMX MMXEXT SSE SSE2 SSSE3
x264 [warning]: VBV maxrate specified, but no bufsize.
mp4 [info]: initial delay 0 (scale 24000)
x264 [info]: slice I:25 Avg QP:25.08 size: 14473 PSNR Mean Y:43.19 U:47.70 V:49.38 Avg:44.33 Global:42.78
x264 [info]: slice P:2975 Avg QP:27.84 size: 3600 PSNR Mean Y:40.74 U:46.37 V:48.01 Avg:42.00 Global:40.09
x264 [info]: mb I I16..4: 54.3% 0.0% 45.7%
x264 [info]: mb P I16..4: 8.9% 0.0% 5.2% P16..4: 18.7% 9.3% 2.1% 0.0% 0.0% skip:55.8%
x264 [info]: SSIM Mean Y:0.9580370
x264 [info]: PSNR Mean Y:40.757 U:46.380 V:48.018 Avg:42.019 Global:40.104 kb/s:707.89
encoded 3000 frames, 47.08 fps, 707.97 kb/s

--pass 2 --bitrate 708 --stats "D:\SIGNS\VIDEO_TS\input3000.stats" --analyse p8x8,b8x8,i4x4 --vbv-maxrate 25000 --threads auto --thread-input --progress --output "D:\SIGNS\VIDEO_TS\input3000.mp4" "D:\SIGNS\VIDEO_TS\input3000.avs"
avis [info]: 720x480 @ 23.98 fps (3000 frames)
x264 [info]: using cpu capabilities: MMX MMXEXT SSE SSE2 SSSE3
x264 [warning]: VBV maxrate specified, but no bufsize.
mp4 [info]: initial delay 0 (scale 24000)
x264 [info]: slice I:25 Avg QP:24.36 size: 15363 PSNR Mean Y:43.31 U:47.70 V:49.45 Avg:44.43 Global:41.68
x264 [info]: slice P:2975 Avg QP:26.18 size: 3616 PSNR Mean Y:41.15 U:46.63 V:48.39 Avg:42.39 Global:39.24
x264 [info]: mb I I16..4: 52.9% 0.0% 47.1%
x264 [info]: mb P I16..4: 11.6% 0.0% 4.3% P16..4: 25.3% 10.6% 1.7% 0.0% 0.0% skip:46.5%
x264 [info]: SSIM Mean Y:0.9550991
x264 [info]: PSNR Mean Y:41.166 U:46.644 V:48.395 Avg:42.407 Global:39.258 kb/s:712.43
encoded 3000 frames, 36.54 fps, 712.52 kb/s

add this to your first pass
--ratetol 1.5
To give the 2 pass method a leg up, add this also on the commandline (for both passes)
--deadzone-intra 4 --deadzone-inter 4I will. (no idea what deadzone is)

You'd need to ask akupenguin(pengvado) about crf's Rate Control, because the only thing I know about crf is that it's based on a nominal QP.
Just kidding: Akupenguin like --crf. I guess he improved a lot -crf Rate Control and put some "sabotage" into --2pass Rate Control.
Now more serious: I barely understand what he explain (I really wish I could).

Thank you

Terranigma
2nd August 2007, 02:50
Yes, please check results (started from "default" profile):

I will. (no idea what deadzone is)

Inter / Intra luma quantization deadzone: Also known as inter/intra deadzone. Specifies the level of detail to be discarded and not taken into account by the encoder. Lower values discard less information, and therefore hand the encoder a more complex stream. The main use of these settings is to set a detail threshold. Lower settings can help grain retention, while higher settings may reduce noise. Use of deadzone settings requires trellis to be turned off.

Check out his wiki to gather more knowledge about x264 here (http://mewiki.project357.com/wiki/Video_configuration_dialog/X264_Configuration)

Edit:
If you want a more detailed explaination about x264, check out neuron2's .pdf docu here (http://www.neuron2.net/library/avc/overview_x264_v8_5.pdf).
Hope you find these useful. :)