AyumiLove Megui x264 Encoding Settings Guide

x264 Configuration Dialog

Main

Encoding Mode : Automated 2 Pass
Bitrate : 500 (Change this based on video resolution!) or use CRF28
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
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 : 3
B-Frame Bias : 0
Adaptive B-Frames : 2-Optimal
B-Pyramid : Normal
Other
Number of Referenced Frames : 3
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)
Strength : 0.6
Quantizers Matrices : Flat (none)
Nb of Frames for Lookahead : 40
Use Mb-Tree : Checked

Analysis

Motion Estimation
Chroma M.E : Checked
M.E Range : 24 (me_range=24)
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

Leave a Reply

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

30 thoughts on “AyumiLove Megui x264 Encoding Settings Guide

  1. Archie

    cheap rugby jersets online wholesale nfl jerseys fгom china

  2. 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?

  3. Ayumilove

    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.

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

  5. Ayumilove

    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.

  6. nikki

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

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

  8. Ayumilove

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

  9. 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”

  10. E-one Rez

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

  11. Ayumilove

    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.

  12. Ayumilove

    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.

  13. E-one Rez

    for audio is there anything need to change?

  14. E-one Rez

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

  15. 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?

  16. Ayumilove

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

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

  20. Ayumilove

    @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

    @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

    @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. Ayumilove

    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.

  26. 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 😀

  27. Ayumilove

    @jinwyi:

    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.

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