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


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


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
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
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


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


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)
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
Partitions : AdaptiveDCT + I4x4 + I8x8 + P8x8 + B8x8 (Unchecked P4x4)
Blu-Ray : None
Use Access Unit Delimiters : Unchecked
Fake Interlaced : Unchecked
Enable Blu-Ray Compatibility : Unchecked


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 *

29 thoughts on “AyumiLove Megui x264 Encoding Settings Guide

  1. fumozhe

    Hi, I just stumbled upon this tutorial. I tried encoding my anime, and it worked! …. except for the subtitle. Somehow the subtitle is lost. Could u guide me how to keep the subtitle from video source?

  2. Ayumilove Post author

    Thanks Fred for sharing Megui settings and feedback! I have tested with 20+ videos on ME RANGE that it only slows down the encoding by a little but helps out in removing jagged lines. I think different shows would use different amount of b-frames. Most videos would use only 5 b-frames. Anime would be slightly more since its static picture in some scenes where the mouth only moves.

  3. Fred

    From my experience, I say the sweet spot for b-frames is 11 b-frames for anime.

    [libx264 @ 0x1f945e0] consecutive B-frames: 3.9% 5.2% 7.2% 21.5% 10.1% 17.6% 4.8% 16.3% 3.0% 3.4% 1.1% 5.8%
    So 3.9% used 0 b-frames, 5.2% used 1 b-frames, etc.

    As for the merange, I feel 32 is probably a bit too high unless you have complex, fast, sudden motion.

    I really think having psy-rd at around 0.8:0.1 is really important for anime.
    “It values complexity values as close to that of the original frame as possible. Thus, it strongly biases against blurring, and for that matter, any significant loss of detail.”
    It’s been shown that people prefer a image with the same detail of complexity rather than a blurred image. So having low psy-rd values is a no-no for high quality anime encoding.

    I use the slower preset mainly just because of trellis to improve quality-per-bitrate. Also, slow is only about ~5-10% better than medium (default). Slower is only about 5% better than slow. So from medium->slower, you get less improvement vs time.

    So this is my command to encode:
    x264 –preset slower –crf 16 –tune animation –deblock -1:0 –psy-rd 0.77:0.08 –colorprim “bt709” –transfer “bt709” –colormatrix “bt709” –ref 9 –bframes 11 –opencl –partitions 8×8,b8x8,i8x8,i4x4

  4. Ayumilove Post author

    Hi Nikki, you would need to see the video source FPS with the rendered FPS. For example, if the video source plays at 25 fps but your rendered video play at 23.97 FPS, you will notice that the video moves much faster than the audio, causing it to desync (video not syncing with audio). Check the video duration if its the same as the original video. If its the opposite where the video duration is ok but the audio seems to start out 3 second faster or 3 second slower, you can adjust it within Media Player Classic to add the delay.

  5. nikki

    hello, i have done the above steps but the output audio of the movie is 3 sec delay. why is it?

  6. E-one Rez

    hye,oh! ok! thank you for the info
    i’ve tried encode but it seems from 500mb+(.vob)>.mkv it become 41mb+
    and it seems like i didn’t encode it correctly,
    you have tutorial how to encode it?

  7. Ayumilove Post author

    Hi E-one Rez, I recommend that you use VBR 0.5 max. If higher than that, might as well not encode the audio at all (use direct rip) because it will certainly bloat up the filesize while reducing the audio quality. Example: If the video file size is 100 MB, and if you only extract the audio out, it is 30 MB. After encoding, the video size is 80 MB, but when you extract the audio out, its 35 MB (+5 MB more). This is known as audio file size bloating. No matter how you encode the audio, the original audio is always far better than the encoded one. If original audio filesize is 30 MB where as the encoded audio filesize is 35MB, then do a direct rip (don’t encode audio).

  8. E-one Rez

    it will be like this right?
    program –level 5.1 –tune film –deblock 1:1 –b-adapt 2 –qpmin 10 –qcomp 1.0 –aq-mode 2 –merange 24 –me umh –direct auto –subme 10 –trellis 2 –psy-rd 0.00:0.00 –no-mixed-refs –no-fast-pskip –output “output” “input”

  9. E-one Rez

    ok! on the link i post,he use vbr 0.79 is that 320kbps? what is the pros and cons?

  10. Ayumilove Post author

    Hi E-one Rez, CRF23-25 will be good. Personally I use CRF25 to save hard disk space, and if the show is really good (like the ones you will rewatch it often) I’ll set it to CRF23.

  11. Ayumilove Post author

    For audio, use VBR 0.4 (equivalent to 128 kbps) which is medium quality. Going below it and you will notice weird sounds (dull sound) or the instruments not playing well. If the video is mostly dialogue (like anime) than 48 kbps (VBR 0.3) will be suitable for it but when it plays Anime OST (Official Soundtrack) it will sound terrible. If you are feeling generous with the file size, change the audio settings to (VBR 0.5, equivalent to 192kbps). Take note that you will need good headphones or speakers to hear those quality.

  12. E-one Rez

    for audio is there anything need to change?

  13. E-one Rez

    i follow your setting for HD +the one in the comment
    i will post the result here if i can (^-^)/

  14. E-one Rez

    thank you so much!!+quick reply!, i learn something new today too.
    I see,but for PV that is like a sad song/slow song+PV using CRF 23-25 is good enough right?

  15. Ayumilove Post author

    Hi E-one Rez, The tutorial link provided is not about encoding, its more on the side dish. It just teaches you on how to clean up the video such as cropping out the black bar and applying filter, removing noise, etc. Refer to the guide above on the real video encoding. The things to change is (Tuning: Film) + (Number of BFrames: 3) + (Number of Referenced Frames: 3) + (M.E. Range: 24) + (Deblocking Strength and Threshold: 1). The reason why the number of frames is reduced is because most of the live action or PV (Promotional Video) have lots of fast action scenes. Fast action scenes means a lot of movement, screen changing constantly. Therefore, they do not benefit much from more frames. Anime on the other hand mostly have static picture where the background does not change but their mouth shape/moves changes. As a result, having more frames will reduce the size even further. CRF25 would be the one in between medium quality + medium size. CRF28 for Film just looks awful. I have encoded some Japanese live promo videos 1080p with CRF28 and it doesn’t suit my quality preferences :D In short, film videos (CRF Range: 23-25), Anime Videos (CRF Range (23-28) depending on the file size budget. Take note that the lower the CRF, the quality improves at the cost of increasing file size.

  16. E-one Rez

    currently i’m using this tutorial to encode my PV(japanese Music Video)
    i don’t know if it is a good setting or not,but if you can help improving the quality+not too big size,it would be great

  17. E-one Rez

    Hye,i’m a newbie on this encoding,can you give me setting/guide for encoding PV(not Anime)? i really need to encode some PV right now,it would be great if you can help.Also the source for the pv is from DVD and .vob

  18. ronald valvalin

    i already fix my problem thanks for the guide its an encode error i hit a bug in my profile settings .. last quick question which is better the 1 pass encode or the 2 pass encode?

  19. ronald valvalin

    oh i see thanks for the tip… :D

  20. Ayumilove Post author

    @Ronald Valvalin: If you set to No Target Size, it will base on the CRF or the CBR rate you have set. Example: you set it to be 400 KBPS, it will encode those videos at that rate, regardless fast or slow motion scene. By setting a Target File Size, MEGUI will auto recalculate total bitrate required for all scenes to fit in that specified file size.

  21. ronald valvalin

    the original source have no black wavy lines and its in good quality yup that is how i encode my videos the “auto encode” but i didnt yet try to set my encode in No Target Size what is the difference between them? coz im encoding my anime in mini size

  22. Ayumilove Post author

    @Ronald Valvalin: Does the original source file has the strange black wavy lines? If yes, then you might want to re-download the video from another source. Could you try on a different encoding mode? There are 2 ways : one is Megui One-Click and the other is Auto-Encode. Sometimes when I’m re-encoding 10bit videos with One-Click, strange video side-effects appears, so I use Auto-Encode Mode that uses .avs file.

    If you have not used AutoEncode before, create a text file and place it at the video file location that you want to render. Type this DirectShowSource(“VideoFileName.mkv”). Save it and change the file extension to .avs Then use Megui to open this file. It will pop up a video screen that plays video without audio. Close that window and hit AutoEncode. Select container MKV or MP4 (your preference) and set No Target Size. Click Queue to proceed with the encoding. After encoding, check the results (video output) to see if this issue still persists.

  23. ronald valvalin

    i downloaded the sourcefile on subgroup so it suppose to be good am i right its on 1280×720 the issue is not appearing on every scene it some kind of like fluctuating on some scene and its kind of annoying.. yup my settings is your Megui setting

  24. Ayumilove Post author

    @Ronald valvalin: I have not experience that issue before. Are you using my Megui Video encoding settings? I’ve been using the same settings as above, so it wouldn’t cause an issue. It might be your source file? Try encoding again on a different anime video to see. If it does not happen, its definitely something wrong with the video file.

  25. ronald valvalin

    hey can i ask you something have you ever experience this while encoding in MEgui? http://i1086.photobucket.com/albums/j447/arn2devilz/vlcsnap-2012-10-16-19h07m38s3.png

  26. Ayumilove Post author

    Hi Thompson14, I’ll need to check out their video settings first and see what they did.

    BlackandWhite no Fansub uses these settings:
    cabac=1 / ref=5 / deblock=1:1:1 / analyse=0x3:0x133 / me=umh / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=32 / chroma_me=0 / 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=23 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=2pass / mbtree=1 / bitrate=467 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / ip_ratio=1.40 / aq=1:0.60

    It is quite similar to my CRF28 SD (Standard Definition) or LQ (Low Quality) video but this one uses 2 pass 460kbps. Using my settings will pull in better quality for fast motion but don’t expect too much from it unless you are using CRF25 or my HD settings.

  27. thompson14

    i have seen in for example black&white no fansub (spanish fansub) they used 10bits for their videos, and they got a really good video quality in a 90mb file, i tried to do the same video with 10bits, and i didnt get the same quality, well, it was nice, but, their video quality was superior, any idea?

    PD: sorry form my english, i tried my best :D

  28. Ayumilove Post author


    Your PC has good specifications. With SSD and at least 8 GB ram and 8 threads, it should not take long. For me, I’m using a low-end PC, takes me 2 hours+ though.

  29. jinwyi

    I’ve encoded a video with your settings in 15 minutes… I’m wondering if I did something wrong… cause you said it should take about an hour.

    PC Specs:
    i7 930 @ 4.0ghz (HT)
    2x ATI 6870 OC @ 1100mhz (2200mhz)
    1x SSD OCZ Vertex 4
    3x 1TB Cavier Black
    6x4gb RAM 1333mhz