Hello guest, if you like this forum, why don't you register? https://fanrestore.com/member.php?action=register (December 14, 2021) x

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Idea] x264 BD compliant "perfect" settings - faster version
I propose here to switch from veryslow preset to medium, retaining 99.7% of its quality and cut in half the encoding time (according to this page); I took previous settings found here, and added only --ref 4 to maintain BD compliance, and --direct auto to improve quality.

Of course, 0.3% of quality loss and encoding time cut in half would apply only to plain presets (i.e. without messing with other settings); if the encoding time will be only slightly reduced, there will be no need to use these settings; so, some tests are needed - volunteers are welcome! Wink


x264.exe --pass 1 --preset medium --tune film --bluray-compat --level 4.1 --ref 4 --direct auto --keyint 24 --slices 4 --b-pyramid none --weightp 0 --sar 1:1 --colorprim bt709 --transfer bt709 --colormatrix bt709  --bitrate 25000 --vbv-bufsize 30000 --vbv-maxrate 40000 --stats ".stats" --output NUL "Input_File.avs"

x264.exe --pass 2 --preset medium --tune film --bluray-compat --level 4.1 --ref 4 --direct auto --keyint 24 --slices 4 --b-pyramid none --weightp 0 --sar 1:1 --colorprim bt709 --transfer bt709 --colormatrix bt709  --bitrate 25000 --vbv-bufsize 30000 --vbv-maxrate 40000 --stats ".stats" --output "Output_File.264" "Input_File.avs"

replace 25000 with the desired average bitrate, 24 in the keyint with the video framerate (24 would do for 23.976 and 30 for 29.97), Input_File.avs with an AviSynth script (or a video file), and Output_File.264 with the final x264 file.

You can use them directly with the x264 command line - just copy and paste pass 1 settings then, when finished, copy and paste pass2 settings - or save as .bat file

  • these settings are good for 1080p video
  • pay attention to the BD size: actual ones are 23.3GB for BD-25 and 46.6GB for BD-50
  • allow about 7% overhead for the .m2ts container - for example, total file size (video+audio+subs) excluding eventual menus would be around 21.75GB for a BD-25, and 43.55 for a BD-50
  • to retain grain, better to not go under 20/22mbps for 2.35:1 and 28/30mbps for 1.78:1/1.85:1
  • max bitrate allowed for BD (video+audio) is 48000mbps, so if audio tracks total bitrate is over 8000mbps, you should lower video bitrate accordingly, in particular pay attention to --vbv-maxrate
  • to improve speed, you can use for pass 1 a "simpler" version of the final file, for example without noise reduction, grain plate, color grading, but it should be otherwise identical - same frame numbers, same resolution etc.
  • do NOT delete any temp files you get after pass 1 (.stats and .stats.mbtree) because they will be used by pass 2!!!
Thanks given by:
It's an interesting suggestion and would make an interesting project for someone over the Christmas holiday. Personally I suspect that at the high bitrates with which we typically work the gains may not be so great, there may even be a penalty in that to retain grain a higher bitrate will be required. Personally I encode overnight so time savings do not necessarily bother me but as always YMMV.
Thanks given by:
^^ The rapidly diminishing returns that occur when you go beyond medium are fairly well known, as is the hike in encoding time.  There's not much that needs testing, in my opinion. For people whose computers struggle with encoding, going much beyond medium is probably not worth it, which is why I didn't do so when I sent you the first lot of x264 settings, which were a compromise made with your old (slower) computer in mind.

For films that I care about enough to work on and release, I prefer to use the veryslow preset to retain as much quality as possible.  For run-of-the-mill encodings, in which I simply want to have a decent version of something to watch, I use medium or occasionally slow.  To my mind, going to slow is usually worth it, because I like to use multi-hexagon for motion estimation, and I think it hangs on to the grain a bit better.

EDIT: Like zoidberg, I encode over night and don't care about time.
Thanks given by:
Well, if I'll lose even 1% quality, but this would take encoding time from 36/48hrs to 18/24hrs... I'm all in! Wink
Thanks given by:
Generally I run --tune grain in the first pass, then tune film in the second. It provides better bit allocation to the grainiest scenes where the additional detail is required. I also tend to prefer b-pyramid and weighted p frames.

I build the Blu-Ray first usually, use multiavchd to slip a CRF=1 encode into it using reauthor mode, then use BD_Rebuilder. I have mine set to the highest possible settings.
Thanks given by:
(2017-12-19, 09:53 PM)nightstalkerpoet Wrote: Generally I run --tune grain in the first pass, then tune film in the second. It provides better bit allocation to the grainiest scenes where the additional detail is required.

That's an interesting hint!

Quote:I also tend to prefer b-pyramid and weighted p frames.

But they are not BD compliant...
Thanks given by:
(2017-12-19, 08:44 PM)Chewtobacca Wrote: EDIT: Like zoidberg, I encode over night and don't came about time.

Same here.

And overnight is short, I've had AVI encodes that took days.
Thanks given by:
b-pyramid 1 or strict is bluray compliant
Thanks given by:
For those who create a lossless intermediate before x264 encoding, it's worth remembering that UT video codec will encode through x264 quicker than an equivalent lagarith file.
Thanks given by:
Are use using dgdecnv at all? If you have a good video card, it offers speed improvements in avisynth to frameserve to x264. It won't read lossless files, which is why I encode my intermediates at CRF=1
Thanks given by:

Possibly Related Threads…
Thread Author Replies Views Last Post
  xvYCC for x264 nightstalkerpoet 10 5,912 2023-03-15, 10:42 PM
Last Post: Falcon
  x265 UHD-BD compliant "perfect" settings spoRv 18 11,556 2021-12-06, 06:12 PM
Last Post: bronan
  I want to change AR, do I have to re-encode? If so, how can I keep original settings? Onti 3 1,226 2021-07-14, 06:28 PM
Last Post: Onti
Thumbs Up x264 BD compliant "perfect" settings spoRv 146 147,919 2021-03-10, 11:52 AM
Last Post: Serums
  x264 - filesize output calculator for 2-pass and CRF ? loa 7 3,079 2020-08-05, 10:30 PM
Last Post: spoRv
  NVenc Test Settings Chewtobacca 2 1,432 2020-08-04, 07:56 PM
Last Post: Chewtobacca
  Handbrake settings - question JackForrester 3 2,073 2020-03-21, 09:25 PM
Last Post: deleted user
  x264 encoding from Adobe Premiere DoomBot 26 14,684 2019-03-25, 08:26 PM
Last Post: jaminmc
  Tools and settings for compressing x264? NeonBible 1 1,820 2019-01-11, 12:01 PM
Last Post: MrBrown
  [Help] DNxHR to x264? Valeyard 2 2,342 2018-12-26, 10:16 AM
Last Post: deleted user

Forum Jump:

Users browsing this thread: 1 Guest(s)