Log in

View Full Version : My questions on x264


Bleck
15th December 2012, 19:04
Hello to all, I have some questions :)

1) Why my 10bit x64 x264.exe crash on second pass when using "--output-csp rgb"? To fix it, Im using i444 but since converts to yuv, is not lossless... (need to say, i use the high444 profile with that).
2) Is 5 ref and 5 bframes fine for 25 fps action video? I dont want to use +8, because i get ridiculous speeds.
3) Is there any way to use a preset file with custom commands in x264.exe (not ffmpeg)? That would be useful for the really long command lines.
4) I use x264 most of the times to compress videos about action games recorded with FRAPS. So, Im doing right using Sony Vegas uncompressed > 10 bit 4:4:4 / 10 bit 4:2:2? Or its a waste of time and I should use 8-bit 4:2:2 since youtube ruins all the quality?

Thanks!

LoRd_MuldeR
15th December 2012, 19:19
1) If you can reliably reproduce the crash, provide a sample file (unprocessed input!) and the exact command-line to re-produce the issue. Then the developers might be able to have a look and fix it.
2) It's all a trade-off, so there can be no explicit answer, by definition. All I can recommend is using x264's Preset system and pick the slowest Preset that you can accept.
3) Presets are applied first, then your "custom" settings are applied on top of that. It means you can pick a Preset and then apply your own "tweaks" on top of that. It's usually not needed though.
4) For screen captures it indeed makes sense to avoid chroma sub-sampling (i.e. use YUV 4:4:4 instead of 4:2:2), but it's also true that Youtube is going to re-encode with their own settings - and I don't think they support either 10-Bit H.264 or YUV 4:4:4. This means that even if they might accept your upload with YUV 4:4:4 and 10-Bit (I'm not sure about this), they'll re-encode using YUV 4:2:2 and 8-Bit H.264 anyway...

Bleck
15th December 2012, 19:35
...they'll re-encode using YUV 4:2:2 and 8-Bit H.264 anyway...

4:2:0 is more standard. Are you sure YT convert to 4:2:2?

About the second question... I said because I find veryslow really really slow (and i have a Intel Core i7 3820!!!!), so I was wondering if the "slower" preset or a handmade preset with a balance between slower and veryslow would be better for me... Is a bit difficult and require a lot of time of testing and checking.

The presets are not precise: veryslow uses 8 bframes and 16 refs, and slower uses 3 bframes and 8 refs. A custom configuration could make (per example) 5 bframes and 5 refs. That would be at the middle of both.

LoRd_MuldeR
15th December 2012, 20:20
4:2:0 is more standard. Are you sure YT convert to 4:2:2?

Yes, I meant 4:2:0 ;)

How are the Presets "not precise"? They were created to give good trade-offs between quality and speed. If "veryslow" is too slow for your needs, then try "slower" next. Then "slow". And so on.

If you think you can find combinations, which give better quality at the same encoding speed, compared to the Presets that the x264 developers came up with, feel free to experiment...

Bleck
15th December 2012, 20:27
Yes, I meant 4:2:0 ;)

How are the Presets "not precise"? They were created to give good trade-offs between quality and speed. If "veryslow" is too slow for you, then try "slower" next...

ficticious Example: If veryslow is too slow because of the refs and bframes, the difference between slower and veryslow is too big.

veryslow: +1 hour encoding (cabac=1 / ref=16 / deblock=1:0:0 / analyse=0x3:0x133 / me=umh / subme=10 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=3 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=8 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=crf / mbtree=1 / crf=23.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00 )

my custom settings: 45 minutes ( same as veryslow but: --b-adapt 2 --rc-lookahead 50 --ref 5 --bframes 5 --b-pyramid 1 --me esa --direct auto --subme 10 --analyse all --trellis 2 --partitions "p8x8,b8x8,i8x8,i4x4" --weightb --mixed-refs --8x8dct)

slower: 25 minutes (cabac=1 / ref=8 / deblock=1:0:0 / analyse=0x3:0x133 / me=umh / subme=9 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=3 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=crf / mbtree=1 / crf=23.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00 )

LoRd_MuldeR
15th December 2012, 20:36
Well, the Presets need to cover the complete range from "extremely fast" to "extremely slow" and of course there cannot be 100 different Presets.

In case you really find that "veryslow" is too slow for your needs and, at the same time, "slow" is too fast, you can still take those Presets as a good reference and use some settings in between.

After all you should think about the Presets as "reference points" for reasonable encoder configurations that give good "quality -vs- speed" trade-off's at various different speed levels...

Bleck
15th December 2012, 21:40
Ok following that idea I have spent 1 hour to make this configuration:

--aq-mode 1 --b-adapt 2 --bframes 5 --direct auto --me umh --merange 16 --analyse all --partitions all --rc-lookahead 60 --ref 5 --scenecut 40 --subme 10 --trellis 2 --weightp 2 --b-pyramid 1 --8x8dct

What do you think?

LoRd_MuldeR
15th December 2012, 21:57
I think that you can kick out the options that are equal to the x264 defaults (aka "--preset medium"):
--merange 16 --8x8dct --weightp 2 --aq-mode 1 -scenecut 40

Also "--analyse" is an alias for "--partitions", it makes no sense to have them both ;)

And I think "--b-pyramid 1" (strict) is only required (but not sufficient!) for strict BluRay compatibility.

Bleck
15th December 2012, 22:29
Ok, Thanks you alot for your advice, i will go ahead with this:
--b-adapt 2 --rc-lookahead 50 --ref 5 --bframes 5 --direct auto --me umh --subq 10 --analyse all --trellis 2

MasterNobody
15th December 2012, 23:22
Ok, Thanks you alot for your advice, i will go ahead with this:
--b-adapt 2 --rc-lookahead 50 --ref 5 --bframes 5 --direct auto --me umh --subq 10 --analyse all --trellis 2
I would recommend this instead as alias (mostly same as yours but will limit refs to levels):
--preset slow --bframes 5 --trellis 2 --subme 10 -A all

x265
16th December 2012, 06:03
Lord Mulder >> Which all settings do we have to tweak in x264 and which all options should we leave as it is?

Groucho2004
16th December 2012, 11:15
Which all settings do we have to tweak in x264 and which all options should we leave as it is?
The answer is hidden in your question. The tweaking was already done by people who know what knobs to fiddle with.

x265
16th December 2012, 11:53
Groucho2004 >> Are the presents good enough?, are there any flaws in them that needs fixing?

Groucho2004
16th December 2012, 14:15
Groucho2004 >> Are the presents good enough?, are there any flaws in them that needs fixing?
The presets are recommended and suitable in most scenarios. I am not aware of any "flaws".

Many people like to mess around with the settings even though they don't know what they do. They may have found a web site where some self-proclaimed encoding guru claims to have discovered the perfect or magic combination of settings or they don't trust the developers to come up with a well balanced combination of parameters for each preset.

You either trust that the presets are all you need or you spend a lot of time playing around with the settings.

x265
16th December 2012, 14:48
Many people like to mess around with the settings even though they don't know what they do.

That is soo true.