x264 Basics

*** the higher the resolution of your output the higher the filesize it needs
*** the lower the resolution of your output the lower the filesize it needs

for example a specific anime episode is encoded with same settings and same encoder and same video source but different 
resolution, at SD resolution it gave around 30mb for example but at HD it gives around 60mb 
(not the actual filesizes but the gist of it that HD needs high filesize is a fact)
 
the higher the resolution output the longer the encoding time too
the lower the resolution output the faster the encoding time too
 
=========================================================
 
Lossy Compression – x264 is mainly about lossy compression meaning it removes data like redundant data
to lower the filesize output, so in other words lossy compression sacrifices quality to get lower filesize, this also mean
that on each re-encode of a video source you do with x264 the quality will degrade, so this fact will tell you that its impossible to retain the same quality of a bigger video file when you re-encode (transrating) it to smaller video file or same video filesize as the original, the point of lossy compression is to reduce the filesize while maintaining a tolerable video quality
Lossless Compression – is the opposite of lossy compression that it retains the quality of the video no matter how many
times you re-encode since it does not remove video data like redundant video data, but non-removal of data also means
the filesize output of lossless compression are big/huge
=========================================================
 
Dark Scenes – x264 like any other DCT (Discrete Cosine Transform) base video compression is bad at compressing dark scenes
you will normally find that when encoding to mini-size (ultra low bitrates) the usual complain is that dark scenes have bad quality
nothing much you can do about this since its just the nature of DCT base video compression, other DCT base video compression that became popular are XVID, DIVX, WMV, RMVB, VP8, etc
 
=========================================================
 
their are 2 kinds of encoding mode (or Rate Control) on x264 they are CRF (Constant Rate Factor) and 2-pass (Multi-Pass encoding) 

*** CRF (Target Quality) is average quality but filesize varies
*** 2-pass (Target FileSize) is average filesize but quality varies 

let me give an example suppose you have one specific video source, same settings, but different resolutions
so if you encode at 720p and CRF=26 for example that video will output higher filesize
than when you encode it at 480p and CRF=26 since its Target Quality and to achieve that target/level
of quality the bitrate will increase if the resolution will increase 
while if you encode using 2-pass at 400kbps and at 720p it will have same output filesize
as when you encode using 2-pass at 400kbps and at 480p this is because 2-pass is considered as
Target Filesize meaning it does not care how the quality will look like it only cares that the
filesize intended for 400kbps is achieve no matter what the resolution is
 
CRF behaves like this, the higher the CRF value set the lower the quality thus lower the filesize, while the lower the CRF value set the higher the quality thus the higher the filesize, read more below to find other things about CRF
 
2-pass behaves like this, the higher the bitrate set the higher quality thus the higher filesize, while the lower the bitrate set the lower the quality thus the lower the filesize
 
==========================================================
 
their is no encoding mode for average quality and average filesize at thesame time because of 
video complexity, when we say video complexity it refers to compressibility
high motion scenes need higher bitrate and thus high filesize on that scene and 
low motion scenes need less bitrate and thus low filesize on that scene, the number 
of high motion and low motion scenes varies from every video and thus video compressibility 
varies from show to show, episode to episode, scene to scene

*** video complexity is the reason why in CRF (Target Quality) encoding the filesize vary a lot too
*** video complexity is the reason why in 2-pass (Target Quality) encoding the quality vary a lot too

high motion scenes examples: scenes that has fast pace action with explosions, scenes like opening songs that has a lot of background moving along with characters dancing 
low motion scenes examples: scenes where anime faces and only lips are moving, scenes that have slow moving to static non-moving backgrounds
 
 
CRF is average quality; CRF encoding means your guessing on its filesize output
2-pass is average size; 2-pass encoding means your guessing on its quality output
 
2-pass is CRF too, whats different in 2-pass is that it picks a CRF value that 
will target the file size you want
 
CRF is average quality if you constantly using a specific CRF value to a given 
resolution like for a 400p you always use CRF=26 no matter what video you re-encode then that 
is how you do CRF encoding
 
CRF is not constant quality if your always changing the CRF value to a given 
resolution just to target a specific filesize, this kind of CRF encoding is called manual 2-pass, so its better if 
you stick to 2-pass mode if your always changing your CRF value on a specific 
resolution just to attain the filesize you want
 
==========================================================
“Presets” are x264 options that are adjusted according to the tradeoff between compression and encoding time/speed, 
so if you set the preset at a slower value then youll end up with slower encoding but at the benefit of more 
reduce filesize, and if you set this at a faster encoding preset then youll end up with a bigger filesize output, 
its not highly recommended to use the “Placebo” on the “Presets” since it just give around 1% compression gain compared 
to “Very Slow” on most cases and at the cost of a whopping double to triple encoding time compared to “Very Slow”
 
“Tunes” option, the “Tunes” are x264 options that further adjust the settings of x264 according to what is the video 
source your encoding, so if your re-encoding any 2D videos like anime or cartoons then set “Tunes” to “Animation”
but if your re-encoding a live-action film with real-life footages then go with “Tunes” set to “Film”, 3D or CGI 
animations are considered on “Film” settings of “Tunes”
 
and the point of Presets and Tunes of x264 is to decrease the learning difficulty on the many/various settings available 
on x264, back in the old days when their is no Presets and Tunes, their are endless debates about the best settings for 
x264 and endless tweaking of values that just made people more confuse and argue a lot
so its better you stick with Presets and Tunes and do not delve much on to tweaking more 
since the Presets and Tunes already tweak those many/various settings of x264 accordingly
 
references

http://mewiki.project357.com/wiki/X264_Encoding_Suggestions#Commandline_Suggestions 
http://forum.doom9.org/showpost.php?p=1583580&postcount=67
http://forum.doom9.org/showpost.php?p=1410319&postcount=11
http://forums.animesuki.com/showpost.php?p=3125075&postcount=9
http://forums.animesuki.com/showpost.php?p=3125675&postcount=12

 
===========================================================
“Profiles” specify which features/settings/options of H264 are allowed (or not allowed), Profiles are needed to make sure 
your video file will play fine on a certain decoder (or device/hardware player, ex. xbox, PS3, mobile phones, etc)
the profile “Baseline” is the good choice for low power devices like mobile phone playback, the profile “Main” 
is mainly for standard definition (SD) TV broadcast, while profile “High” is for any applications that is powerful 
such as a laptop or desktop PC kind/like of devices
 
“Levels” put further restrictions on other properties of the video, these restrictions include the maximum resolution, 
the maximum bitrate, the maximum framerate (for a given resolution) and the maximum number of reference frames. 
In order play your H264 video on a specific device/hardware player
 
you do not have to be concerned about Profiles and Levels if your only playing videos on modern computers
that are using software players like VLC Player, CCCP, K-Lite, MPC-HC Player, etc
Profiles and Levels are just settings restrictions to achieve smooth playback on a target Hardware Player or Device
software players usually don't have such restrictions, as long as your CPU is powerful enough