Changes between Version 5 and Version 6 of x264EncodingGuide
- Timestamp:
- 08/11/2012 08:36:51 AM (10 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
x264EncodingGuide
v5 v6 3 3 x264 is a H.264/MPEG-4 AVC encoder. The goal of this guide is to inform new users how to create a high-quality H.264 video. 4 4 5 First you must choose your ratecontrol. A ratecontrol is a method that will decide how many bits will be used for each frame. This will determine the file size and how quality is distributed. There are two main methods that are useful for general users: Constant Rate Factor (CRF) and Two-Pass. Use CRF if you don't know what ratecontrol method to use.5 First you must choose your ratecontrol. A ratecontrol is a method that will decide how many bits will be used for each frame. This will determine the file size and also how quality is distributed. 6 6 7 If you need help compiling and installing see one of our [wiki:CompilationGuide FFmpeg and x264 compiling guides]. 7 There are two most popular methods that are useful for general use: Constant Rate Factor (CRF) and Two-Pass Encoding. Use CRF if you don't know what ratecontrol method to use. 8 9 CRF is basically a "keep this same constant quality always" setting. 0 is considered lossless, 51 is worst quality. You can either set this value, or set a bit rate with one of the other methods, not both. This is easy to use for beginners--just figure out how much quality you want, then record using this setting. 10 11 The default is ABR (Average Bit Rate). Like 12 {{{ 13 ffmpeg -i input -vcodec libx264 -b 1000k ... 14 }}} 15 16 This is something of a "running average" that allows for swings above and below this number, with the end goal that the final file will match this number "on average" (so basically, if it gets a lot of black frames, which cost very little, the next few seconds of non-black frames it will encode at very high quality, to bring the average back in line). Using 2-pass can help this method to be more effective. You can also use this in combination with a "max bit rate" setting in order to prevent some of the swing. 17 18 You can "fake" a Constant Bit Rate setting by tuning the parameters of the ABR, like 19 {{{ 20 ffmpeg -i myfile.avi -vcodec libx264 -b 4000k -minrate 4000k -maxrate 4000k -bufsize 1835k out.m2v 21 }}} 22 23 bufsize is the "rate control buffer" so it will keep that "average" (4000k in this case) across every block of 1835k. 24 25 Of course, if it's all just empty/black frames then it will still serve less than that many bits/s (but it will raise the quality level as much as it can to try to satisfy the requested parameters). 26 27 If you need help compiling and installing libx264 see one of our [wiki:CompilationGuide FFmpeg and x264 compiling guides]. 8 28 9 29 == Constant Rate Factor (CRF) == … … 13 33 The range is 0-51 where 0 is lossless, 23 is default, and 51 is worst possible. A lower value is a higher quality and a subjectively sane range is 18-28. Consider 18 to be visually lossless: it should look the same as the input but it isn't technically lossless. Increasing the CRF value +6 is roughly half the bitrate while -6 is roughly twice the bitrate. General usage is to choose the highest quality that still provides an acceptable quality. If the output looks good then try a higher value and if it looks bad then choose a lower value. 14 34 15 '''Note:''' The se CRF valuesapply to 8-bit x264 (the typical).35 '''Note:''' The CRF values mentioned apply to 8-bit x264 (the typical). 16 36 17 37 === 2. Choose a preset === … … 78 98 }}} 79 99 100 or 101 {{{ 102 -x264opts vbv-bufsize=3600:vbv-maxrate=1800:crf=23 103 }}} 104 though these are somewhat redundant to other "standard" ffmepg settings, and can also be specified each separately. 105 80 106 ---- 81 107


