Penjelasan MeGUI Encoding Settings

Software MeGUI mempunyai pelbagai setting yang sangat kompleks. Jadi di sini XLAWS nak beri penjelasan untuk setiap settings tersebut. Memang banyak!, pahamkan lah 1 per 1, jangan korang tertidur pulak. hahaha

Beginner encoder memang kena banyak membaca tentang settings ni, banyakkan encode supaya nanti korang paham dan boleh buat experiment dan resipi encode sendiri tanpa meniru atau ambil "preset" orang lain. Jadi, Jangan cepat mengalah OK! :]

Penjelasan ni mestilah kena dalam bahasa English. Kalau dalam bahasa Melayu memang jadi mengarut ayatnya nanti.

In this part, I'm going to go through and explain some of the settings in x264, as well as the advantages and disadvantages of these settings.

The first thing I will point out is that sitting around manually tweaking settings won't make your encodes look much better than just using defaults and presets. But if you’re going to touch the settings, it’s useful to know what they all do.

Secondly, I don't use presets or tunings so I won't be explaining them.

Lastly, I'm not going to get into really technical, mathematical explanations of how it all works, so if it seems like I'm oversimplifying things, that's because I am. Now onto the guide.

Encoding/Rate Control Mode

x264 has several different modes that control the relationship between file size and quality. These modes are:

CQ, aka Constant Quantizer
In x264 everything works with quantizers or "quants". Basically, quants are a measure of how lossy or compressed a frame is, in comparison to lossless. A quant of 0 is lossless, while the highest quant of 51 is as lossy as it gets.

Constant Quantizer mode gives the exact same quant to every frame, disables qcomp, ignores AQ and locks out MB-Tree. Complex scenes with lots of detail, grain, contrast etc.. will have the same quality as simpler scenes and the file size will be large as well as unpredictable. Definitely the worst mode for low-bitrate encodes.

CRF, aka Constant Rate Factor/Quality
CRF mode is similar to CQ mode, only far more advanced. It uses qcomp to strike a balance between complex scenes and simple scenes, adding much needed variance in quants. It also allows the use of AQ and MB-Tree, so it retains a lot more detail than CQ mode at the same file size.

CRF mode isn’t based on a set bitrate, so although the file size is unpredictable, you won't get massive fluctuations in quality between scenes of varying complexity.

In my encodes of Baccano, I turned the unpredictable file sizes into a positive thing. All episodes were encoded at CRF 18, so the episode which only needed 40MB has the same level of quality as the episode that needed 84MB. There were 16 episodes in total and at 60MB each the series would've been 960MB in size. Add up all the sizes of my CRF encodes and you get 959MB. But CRF mode didn't just save me a measly megabyte, it made sure that the action packed episodes didn't turn out all blocky and disgusting. It didn't do all the work itself however, I went through several encodes and tweaked the settings until I got the sizes I wanted.

ABR, aka average bitrate
A single pass mode that gives out a size according to the bitrate you set. This mode is as fast as CRF and kind of similar, but the variance in bitrate is much more limited. At low birates, this mode is either slightly better or equal to Constant Quantizer, but worse than CRF. I wouldn't bother using it.

2-Pass VBR
This mode can also encode to a specific file size, but the variance in bitrate isn’t as limited, so the quality is much higher than ABR and pretty much identical to CRF.

The first of the two passes is used to determine where each type of frame should be placed, and what CRF value is needed to hit the target bitrate.

One of the advantages of a 2-Pass encode is that if you don't like the results of the second pass, you can simply change your settings and do another second pass. Some settings can't be changed on the second pass: number of b-frames, b-adapt, weighted b/p-frames, no-fast-pskip, rc-lookahead and enabling/disabling mbtree.

Encoding Options:
X264 has tons of encoding options that can be adjusted to your liking. The ones that trade speed for quality are generally the most important options, but there are really slow options that provide little to no benefit. Also, there are some options that should never be adjusted. After reading this, you should begin to understand which options are which.

Turbo First Pass
For 2-Pass encodes, most encoder GUIs have an option called Turbo mode or something similar. Older versions of x264 would use your slow settings on both passes, and enabling this option would make the GUI use faster options on the first pass. Newer versions of x264 do this by default, because using slow settings on the first pass is practically useless.

This option should always be on; if you have time to spare, you’re better off using slower options on the second pass, e.g. more reference frames.

If you disable this option, --slow-firstpass will be added to the commandline.

Deblock, aka Loop Filter
x264, like any other encoder, sees your video as one big arrangement of blocks that move around and change colour. Anime episodes with lots of action are harder to compress because there are more rapid changes in blocks on a frame by frame basis.

All modes except Constant Quantizer will use higher quants for action scenes. Higher quants mean more blocks and this is where deblocking comes in.

The deblock setting has two parts, the first number - Alpha which controls the strength of deblocking in areas of where the blocks are similar, and the second number - Beta, which controls the overall strength of deblocking/ block detection. Higher deblock settings give a blurrier image. Lower deblock settings give a sharper image. It’s important to remember that a deblock setting of 0:0 does not mean zero deblocking; it is simply the default deblocking strength.

You can actually go into your video decoding settings and disable deblocking if you want to see what zero deblocking really looks like. Or, you can just believe me when I say it looks terrible.

Reference Frames, aka Refs
A reference frame is a frame that other frames copy blocks from. Setting this to 16 means x264 can copy blocks from up to 16 previous frames, which can be of great benefit to anime due to large amounts of duplicate frames, low amounts of noise and large areas of flat color.

Having a high number of refs will heavily affect encoding speed, because it increases how far back x264 has to look while tracking changes in blocks. However, it is the best option in terms of trading speed for quality.

A B-Frame is a highly compressed frame that only contains information on blocks that are different from the previous and next frames. Increasing the maximum number of B-Frames allows x264 to use more B-Frames in a row, which again, provides great benefit in anime. When using B-Adapt=2, higher numbers of B-Frames will slow down your first/single pass.

x264 has two different types of adaptive B-Frame prediction. Mode 1 – which is quick and dirty, and Mode 2 – which is slow and extensive. The first mode is very fast and gets slower as you decrease the maximum amount of B-frames. The second mode can produce better looking encodes even with the default maximum of 3 B-Frames, so if you have the time, use Mode 2.

Weighted B-Frames
Different GUIs have different names for it. Don’t disable it.

This setting allows B-Frames to be used as reference frames, which increases encoding efficiency. B-Pyramid has two modes, Normal – the default mode and Strict – a mode that complies with the standards of blu-ray disc encoding. Unless you find yourself encoding a blu-ray disc, you’ll want to leave this set to normal. Don’t disable this option.

This setting increases the chance that x264 will use a B-Frame over another type of frame.
Because B-Frames are so efficient, this option could be useful for encoding at low bitrates, but B-Adapt=2 tends to be very efficient anyways.

Weighted P-Frames
This option increases the quality of fades, especially when used with MB-Tree. It has two modes, the default mode – Smart and a slightly faster mode – Blind. Keep this set to smart mode.

Enabling this option will noticeably slow down encoding, especially with high amounts of refs. The amount of quality you gain is either non-existent, or extremely unnoticeable.

In video encoding, a scene change is when a new frame has a very high percentage of difference from a group of previous frames. Increasing scenecut makes the scene change detection more sensitive, which can lead to x264 placing more high quality, bitrate heavy I-Frames. Decreasing it will lessen sensitivity.

As I mentioned earlier, encoders see your video as a bunch of blocks. Some of these blocks don’t have many details, and are very compressible, while others have lots of detail and aren’t very compressible.

Without AQ, most of the bitrate in a frame goes towards very detailed parts and smooth parts can end up blocky. AQ counters this by taking bitrate away from complex parts like edges and shifting it towards the smoother parts of the frame. AQ has two modes, but mode 2 is better for anime, because it varies the strength automatically.

MBTree works similarly to AQ, but instead of only looking for simple blocks within a single frame, it uses lookahead to find the most static parts of your video, and moves bitrate away from moving blocks to these more static blocks. For anime, this works much better than only using qcomp, because if there are scenes that are mostly static, e.g. only a characters lips are moving, a character walks in front of a static background etc, MBTree can reduce the detail on the moving parts and increase the detail on the static parts.

This setting controls how far ahead MBTree will look, for consistently static blocks. Higher settings will increase the amount of detail kept, but will also increase your ram usage. 120 is a good setting for anything from SD to 720p. For higher resolutions, you'll probably need to decrease it to 72, or x264 will attempt to go over the 32-bit 2GB ram limit and crash.

Again, qcomp is similar to AQ and MBTree, but instead of acting upon blocks within a frame, it can only vary the bitrate given to the entire frame. So instead of giving more bitrate to static parts of a frame, qcomp gives less bitrate to high motion frames and gives more bitrate to static frames.

However, when MBTree is enabled, qcomp also controls the balance between giving more bitrate to static parts vs moving parts.

Motion Estimation Mode/Algorithm
In video encoding, motion estimation is used to track the movement of blocks between frames.

Higher/slower modes track blocks more accurately, which increases compression. Uneven multi-hexagon or UMH is the most commonly used mode and isn’t much slower than the lower modes. The exhaustive search modes, ESA and TESA give a huge speed hit for tiny gains in quality.

Subme aka Subpixel Refinement
Subme tracks the motion of pixels within blocks. Again, higher/slower settings do this more accurately and will increase compression.

Subme 9 isn’t much slower than subme 7, but gives very noticeable gains in quality.
Subme 10 is quite a bit slower than subme 9, but the gains in quality aren’t as noticeable.

ME Range
This setting controls the range of pixels that motion estimation will search through while tracking the motion of blocks. When using UMH, setting this to 32 won’t be much slower than setting it to 16.

Higher settings can increase compression, especially at high resolutions.

Trellis aka Trellis Quantization
Trellis quantization has two modes, Mode 1 – which only affects how many bits go to each block within a frame, and Mode 2 – which also effects the kinds of blocks that are chosen within a frame. Trellis basically has the opposite effect of AQ, it increases compression by taking bitrate away from flat, smooth areas. Mode 2 is very beneficial to anime and is required by subme 10.

This setting increases sharpness by applying less compression to sharp, detailed and/or grainy areas. Setting this too high can lead to artifacts, especially at low bitrates in anime.

Psy-Trellis basically does the same thing trellis does, but it doesn’t increase compression. It tries to make the image sharper by taking bitrate away from fine details and textures and uses that bitrate on complex parts of the image, like edges. As with Psy-RD, setting this too high can lead to artifacts.

This option zeroes out any psy-rd values and disables all psy-optimizations, leading to a blurrier image. Only for experimental purposes.

This setting will reduce compression.

At low bitrates, it will do one of two things:
  1. Hurt quality
  2. Nothing

Don’t bother using it.

We Appreciate Your Comments

3 Respones to "Penjelasan MeGUI Encoding Settings"

Muhibbul Tabris said...

Zzzz curi post org dari website lain

August 20, 2012 at 12:50 PM
BRAT said...


July 8, 2013 at 7:32 PM
Shiva Gali said...

Thank you so much. i was searching so much an d couldn't able to find what you have written in here.

July 27, 2015 at 9:15 AM

Post a Comment

Blog Fansub XLAWS

J-Rock | J-Pop | Visual-Kei Fansub
Return to top of page Copyright © 2011 | Platinum Theme Edited By XLAWS