AyumiLove Megui x264 Encoding Settings Guide

[NEW] Check my new Megui X264 Encoding Settings for HD here

Here is my guide on encoding anime videos such as Bleach into MiniMKV (100mb or less) either 8bit or 10bit Hi10P. Encoding using Megui consumes more time compared to Sony Vegas and Windows Movie Maker but outputs superior video quality at a very small size!

The settings below allows you to encode high quality anime video (24 minutes Episode @ 23.97 FPS with 1280×720 resolution) within 2 hours on Core 2 Duo PC without GPU. Having an Intel I5/I7 PC encodes anime video requiring lesser or same watching time length.

For Hi10P (10bit encoders) If you want low video quality with small size, choose CRF28, otherwise choose CRF23 to have near perfection of BD RIP aka Blu-Ray RIP. To have a balance of both worlds, use CRF25 instead since it has less blockiness on fast motion scenes compared to CRF28. Using CRF retains vibrant color depending on the video motion and resolution but size is unknown until its fully encoded. For 8bit encoders -2 CRF for each of them.

10 Bit to 8 Bit
CRF23 -> CRF21 (Near perfect original quality but Double Size of 10Bit-CRF28)
CRF25 -> CRF23 *Recommended with Ordered Chapter for MiniMKV*
CRF28 -> CRF26 (MiniMKV)

CRF Space Increment

Below is my experiment results between CRF25, CRF26, CRF27 and CRF28.
The lower the CRF, more space it will cost your hard disk for better video quality.
CRF25 is 110.8% of CRF26 OR 135% of CRF28. (100% less blockiness of CRF28)
CRF26 is 110.4% of CRF27 OR 121% of CRF28 (80% less blockiness of CRF28)
CRF27 is 110.2% of CRF28 OR 110% of CRF28 (40% less blockiness of CRF28)

[NOTE] CRF25 vs CRF28 – If you want to create mini-mkv with CRF25, you will need to use Chapter Ordering to reduce each video size to fit under 100MB. Chapter Ordering is to remove OPENING and ENDING video clips into a separate file. This separate file will be linked to all of the rest of episodes via Chapter.xml containing the SUID (Segment Unique ID) of OPENING/ENDING video files. Otherwise, the most straight forward method will be CRF28 which includes both OPENING/ENDING into video itself, but quality isn’t good for action scenes (fast motion scenes).

To learn Order Chaptering: AyumiLove Ordered Chapter Guide.

x264 Configuration Dialog

Below are my new current settings updated on 4-August-2012

Main

Encoding Mode : Constant Quality (CRF)
Bitrate : CRF25 (Big) or CRF28 (Small)
Preset : Medium
Tuning : Animation
AVC Profile : High Profile
AVC Level : 5.1
Target Playback Device : Default
Show Advanced Settings : Checked

Frame-Type

H.264 Features
Deblocking : Checked
Deblocking Strength : 1
Deblocking Threshold : 1
CABAC : Checked
GOP Size
GOP Calculation : FPS
Maximum GOP Size : 250
Minimum GOP Size : 25
Open GOP : Uncheck
Slicing
Nb of Slices by Frame : 0
Max size (in bytes) : 0
Max size (in mbs) : 0
B Frames
Weighted Predition for B Frame : Checked
Number of B-Frames : 5
B-Frame Bias : 0
Adaptive B-Frames : 2-Optimal
B-Pyramid : Normal
Other
Number of Referenced Frames : 5
Number of Extra I-Frames : 40
P-frame Weighted Prediction : Smart
Interlaced Mode : none
Pulldown : none
Adaptive I-Frame Decision : Checked

Rate-Control

Quantizers
Min/Max/Delta : 10/69/4
Quantizers Ratio(I:P/P:B) : 1.4 / 1.3
Chroma QP Offset : 0
Credits Quantizer : 40
Rate Control
VBV Buffer Size : 0
VBV Maximum Bitrate : 0
VBV Initial Size : 0.9
Bitrate Variance : 1.0
Quantizers Compression : 0.6
Temp. Blur of est. Frame Complexity : 20
Temp. Blur of Quant after CC : 0.5
Adaptive Quantizers
Mode : Auto-Variance AQ (Experimental) 2
Strength : 0.60
Quantizers Matrices : Flat (none)
Nb of Frames for Lookahead : 40
Use Mb-Tree : Checked

Analysis

Motion Estimation
Chroma M.E : Checked
M.E Range : 32 (me_range=32)
M.E Algorithm : Multi Hex (me=umh)
Subpixel Refinement : 10 – QP-RD (subme=10)
Extra
MV Prediction Mod : Auto
Trellis : 2 – Always
Psy-RD Strength : 0.00
Psy-Trellis Strength : 0.00
No Mixed Referenced Frames : Checked
No Dct Decimation : Unchecked
No Fast P-Skip : Checked
No Psychovisual Enhancements : Unchecked
Noise Reduction : 0
Macroblocks
Partitions : AdaptiveDCT + I4x4 + I8x8 + P8x8 + B8x8 (Unchecked P4x4)
Blu-Ray
Blu-Ray : None
Use Access Unit Delimiters : Unchecked
Fake Interlaced : Unchecked
Enable Blu-Ray Compatibility : Unchecked

Misc

Other
Threads (0=Auto) : 0
Thread-Input : Checked
Non Deterministic : Unchecked
Slow First Pass : Unchecked

Nero AAC Configuration Dialog

Audio Options

Preferred Decoder : NicAudio
Output Channels : Keep Original Channels
Sample Rate : Keep Original
Apply Dynamic Range Compression : Unchecked
Normalize Peaks to 100% : Unchecked
Nero Digital Options : ABR or VBR (VBR Recommended)
AAC Profile : Automatic (HE-AAC for 128 kbits and below or AAC-LC for 128 kbits and above)

NeroDigital AAC Options

If you apply Normalize Peaks and Dynamic Range Compression, its best to set Audio Adaptive Bitrate at least 96kbps otherwise you will hear very low quality audio when you listen to scenery sounds (birds chirping or water streaming in river) or with violin instruments (especially high pitch sounds). [NOTE] If you intend to play the video on more compatible video players (that does not support HE-AAC Audio, its best to go for 128 kbits to gain the LC-AAC audio encoding) but this eats up a little more hard disk space.

Adaptive Bitrate (ABR) : 96 kbps *Recommended*
1) 48 kbit/s (Mono 2 Channels – Only for dialogues/speeches)
2) 96 kbit/s (Stereo 2 Channels – Dialogue + Instrument + Scenery) in HE-AAC
3) 128 kbit/s (Stereo 2 Channels – Same as 96 kbits but in 44khz LC-AAC.
4) 192 kbit/s (6 Channels Surround Sound – Double bitrate of 2 Channels)

Variable Bitrate (VBR): Q=0.35 *Recommended*
Q=0.35 is recommended because its small and works like video CRF encoding where it does not waste bitrate when playing sound lacking contents whereas it allocates more bitrate when the sound is brimming with instruments, scenery sound, etc. Using Q=0.3 gives a size smaller or close to 96 kbps ABR file size. You might have issues if you try to re-encode videos containing VBR audio with Megui unless its not separated (all in 1 MKV).
VBR Quality 0.3 and below automatically sets to Mono 22 khz AAC-HE audio.
VBR Quality 0.35 and above automatically sets to Stereo 44khz AAC-LC audio.

The good thing about VBR Quality is that you do not need to change the bitrate when you are switching between stereo (2 channels) to surround sound (5.1 channels). Q=0.35 will give sufficient bitrate to play 5.1 channels audio. AAC-HE file size is 85% of AAC-LC file size but in mono audio. Take note that QuickTime players does not support SBR (spectral band replication to enhance the compression efficiency) in AAC-HE, therefore its best to add +0.05 quality to make it Q=0.35 for better compatibility with other audio players.

Anime x264 Encoding Results @ 24 minutes 23.976 FPS 1280×720
Video encoded at 500kbits (video total size approximately 83MB).
Audio encoded at 48kbits (audio total size approximately 8.5MB, 17MB for dual audio).
Subtitles (.ass or .srt) with Custom TrueType Font Styles .TTF (1 MB)
Total anime minimkv file size is 101MB.

Most anime encoders encode it at 32kbits HE-AAC+PS (mono) but the quality isn’t good especially when it plays OST (Official Soundtracks) or background music. I prefer 96kbits AAC-LC (stereo). Netizens mentioned that HE-AAC+PS good range is 24-48kbits whereas AAC-PS good range is 40-64kbits.

MEGUI Settings for High-End PC

Tweak settings above with the ones specified below to achieve better video quality but stresses more on the CPU. Therefore, if you have a PC with more than 4 threads (i7 Quad/Hexa Core with Hyper-threading) with 4-8GB RAM, I recommend you use this instead. Otherwise, video encoding lasts approximately 4-6 hours for 24 min 1280×720 video.

Encoding Mode : Const. Quality (rc=crf)
M.E Range : 32 (me_range=32)
M.E Algorithm : Multi Hex (me=umh)
Subpixel Refinement : 10 – QP-RD (subme=10)
Number of Referenced Frames : 16 (ref=16)
Number of B-Frames : 8 (bframes=8)
Nb of Frames for Lookahead : 60 (rc_lookahead=60)

MEGUI Other Notes

Change video bitrate according to the video resolution if using 2pass settings.
Or use CRF 18 (High Definition) / CRF23 (Normal) / CRF 28 (Low Quality).
Using CRF automatically adjust your bitrate according to the quality level.

1080p: 1920×1080 (HD : 4Mbits / LQ : 1Mbits / 2073600 bits average)
720p: 1280×720 (HD : 2Mbits / LQ : 500Kbits / 921600 bits average)
480p: 854×480 (409920 bits average)
360p: 640×360 (230400 bits average)
240p: 426×240 (102240 bits average)

M.E. Range Value : Remarks

16 : Slice of Life. Videos that does not have much action scenes.
24 : Balance of both worlds 16 and 32.
32 : Lots of vivid/movement scenes, dominating half or 2/3 of video.

AAC Profile : Automatic (Megui choose either AAC-LC / HE-AAC+PS based on kbit)
[NOTE] Auto-Bitrate Settings (40-64 for AAC-LC / 24-48 for HE-AAC+PS)

Approx. average bitrate = VBR Quality table

Bitrate = Quality
16 = 0.05
33 = 0.15
66 = 0.25
96 = 0.30
112 = 0.35 (Balance of 96 kbits and 128 kbits Audio Quality)
128 = 0.40
146 = 0.45
192 = 0.55
224 = 0.60
238 = 0.65
285 = 0.75
332 = 0.85
382 = 0.95

Quick Search:

Leave a Reply

Your email address will not be published. Required fields are marked *