Changes between Version 80 and Version 81 of Encode/H.264
- Timestamp:
- Dec 30, 2021, 9:33:42 PM (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Encode/H.264
v80 v81 21 21 22 22 == 1. Choose a CRF value == 23 The range of the CRF scale is 0–51, where 0 is lossless , 23 is the default, and 51 is worst quality possible. A lower value generally leads to higher quality, and a subjectively sane range is 17–28. Consider 17 or 18 to be visually lossless or nearly so; it should look the same or nearly the same as the input but it isn't technically lossless.23 The range of the CRF scale is 0–51, where 0 is lossless (for 8 bit only, for 10 bit use -qp 0), 23 is the default, and 51 is worst quality possible. A lower value generally leads to higher quality, and a subjectively sane range is 17–28. Consider 17 or 18 to be visually lossless or nearly so; it should look the same or nearly the same as the input but it isn't technically lossless. 24 24 25 25 The range is exponential, so increasing the CRF value +6 results in roughly half the bitrate / file size, while -6 leads to roughly twice the bitrate. … … 29 29 {{{ 30 30 #!div style="border: 1px solid #e5e5c7; margin: 1em; background-color: #ffd;" 31 '''Note:''' The 0–51 CRF quantizer scale mentioned on this page only applies to 8-bit x264. When compiled with 10-bit support, x264's quantizer scale is 0–63 . You can see what you are using by referring to the `ffmpeg` console output during encoding (`yuv420p` or similar for 8-bit, and `yuv420p10le` or similar for 10-bit). 8-bit is more common among distributors.31 '''Note:''' The 0–51 CRF quantizer scale mentioned on this page only applies to 8-bit x264. When compiled with 10-bit support, x264's quantizer scale is 0–63 (internally in x264 itself it is from -12 to 51 https://code.videolan.org/videolan/x264/-/blob/master/x264.c#L733 but ffmpeg libx264 wrapper shifted it, so that 0 is lossless, but only in supported profiles, High 10 does not support lossless). You can see what you are using by referring to the `ffmpeg` console output during encoding (`yuv420p` or similar for 8-bit, and `yuv420p10le` or similar for 10-bit). 8-bit is more common among distributors. 32 32 }}} 33 33 … … 148 148 = Lossless H.264 = 149 149 150 You can use `-crf 0` to create a lossless video. Two useful presets for this are `ultrafast` or `veryslow` since either a fast encoding speed or best compression are usually the most important factors.150 If the profile is High 4:4:4 Predictive you can use `-crf 0` to create a lossless video, otherwise use -qp 0 (High 10 profile does not support lossless, https://code.videolan.org/videolan/x264/-/blob/master/x264.c#L579). Two useful presets for this are `ultrafast` or `veryslow` since either a fast encoding speed or best compression are usually the most important factors. 151 151 152 152 Fast encoding example: 153 153 154 154 {{{ 155 ffmpeg -i input -c:v libx264 -preset ultrafast - crf0 output.mkv155 ffmpeg -i input -c:v libx264 -preset ultrafast -qp 0 output.mkv 156 156 }}} 157 157 … … 159 159 160 160 {{{ 161 ffmpeg -i input -c:v libx264 -preset veryslow - crf0 output.mkv161 ffmpeg -i input -c:v libx264 -preset veryslow -qp 0 output.mkv 162 162 }}} 163 163
