Changes between Version 72 and Version 73 of Encode/H.264


Ignore:
Timestamp:
Mar 2, 2020, 10:37:37 PM (5 weeks ago)
Author:
llogan
Comment:

removed confusing and redundant "all devices" section (see Profile section). removed redundant QuickTime section (see FAQ). removed old iOS compatibility chart of mostly obsolete devices.

Legend:

Unmodified
Added
Removed
Modified
  • Encode/H.264

    v72 v73  
    88[[PageOutline(1, Contents)]]
    99
    10 The goal of this H.264 video encoding guide is to inform new users how to create a high-quality video using the encoder x264.
    11 
    12 There are two rate control modes that are usually suggested for general use: [#crf Constant Rate Factor (CRF)] or [#twopass Two-Pass ABR]. Rate control decides how many bits will be used for each frame. This will determine the file size and also how quality is distributed. To know more about what the different rate control modes do see [http://slhck.info/video/2017/03/01/rate-control.html this post].
    13 
    14 If you need help compiling and installing libx264 see one of our [[CompilationGuide|compiling guides]].
    15 
    16 ----
     10This guide focuses on the encoder x264. It assumes you have `ffmpeg` compiled with `--enable-libx264`. If you need help compiling and installing see one of our [[CompilationGuide|compiling guides]].  See [[HWAccelIntro]] for information on supported hardware H.264 encoders.
     11
     12----
     13
     14There are two rate control modes that are usually suggested for general use: [#crf Constant Rate Factor (CRF)] or [#twopass Two-Pass ABR]. Rate control decides how many bits will be used for each frame. This will determine the file size and also how quality is distributed. To know more about what the different rate control modes do see [https://slhck.info/video/2017/03/01/rate-control.html this post].
    1715
    1816= Constant Rate Factor (CRF) =#crf
    1917
    20 Use this mode if you want to keep the best quality and don't care about the file size.
     18Use this rate control mode if you want to keep the best quality and care less about the file size. This is the recommended rate control mode for most uses.
    2119
    2220This method allows the encoder to attempt to achieve a certain output quality for the whole file when output file size is of less importance. This provides maximum compression efficiency with a single pass. By adjusting the so-called quantizer for each frame, it gets the bitrate it needs to keep the requested quality level. The downside is that you can't tell it to get a specific filesize or not go over a specific size or bitrate, which means that this method is not recommended for encoding videos for streaming.
     
    7371=== Profile ===
    7472
    75 Another optional setting is `-profile:v` which will limit the output to a specific H.264 profile. Omit this unless your target device only supports a certain profile (see [#Compatibility Compatibility]). Current profiles include: `baseline`, `main`, `high`, `high10`, `high422`, `high444`. Note that usage of `-profile:v` is incompatible with lossless encoding.
     73The `-profile:v` option limits the output to a specific H.264 profile. Some devices (mostly very old or obsolete) only support the more limited ''Constrained Baseline'' or ''Main'' profiles. You can set these profiles with `-profile:v baseline` or `-profile:v main`.
     74
     75Most modern devices support the more advanced ''High'' profile. Unless you need to support limited devices the recommendation is to omit setting the profile which will allow x264 to automatically select the appropriate profile.
     76
     77Note that usage of `-profile:v` is incompatible with lossless encoding.
    7678
    7779=== List presets and tunes ===
     
    104106= Two-Pass =#twopass
    105107
    106 Use this method if you are targeting a specific output file size, and if output quality from frame to frame is of less importance. This is best explained with an example. Your video is 10 minutes (600 seconds) long and an output of 200 MiB is desired. Since `bitrate = file size / duration`:
     108Use this rate control mode if you are targeting a specific output file size, and if output quality from frame to frame is of less importance. This is best explained with an example. Your video is 10 minutes (600 seconds) long and an output of 200 MiB is desired. Since `bitrate = file size / duration`:
    107109
    108110{{{
     
    217219x264 offers a `-tune zerolatency` option for low latency streaming.
    218220
    219 == Compatibility ==
    220 
    221 === All devices ===
    222 
    223 If you want your videos to have highest compatibility with ancient devices (e.g., old Android phones):
    224 
    225 {{{
    226 -profile:v baseline -level 3.0
    227 }}}
    228 
    229 This disables some advanced features but provides for better compatibility. Typically you may not need this setting (and therefore avoid using `-profile:v` and `-level`), but if you do use this setting it may increase the bit rate compared to what is needed to achieve the same quality in higher profiles.
    230 
    231 === iOS ===
    232 
    233 ||||||||= '''iOS Compatability''' ([https://developer.apple.com/library/mac/documentation/NetworkingInternet/Conceptual/StreamingMediaGuide/UsingHTTPLiveStreaming/UsingHTTPLiveStreaming.html#//apple_ref/doc/uid/TP40008332-CH102-SW8 source]) =||
    234 ||= '''Profile''' =||= '''Level''' =||= '''Devices''' =||= '''Options''' =||
    235 || Baseline || 3.0 || All devices || `-profile:v baseline -level 3.0` ||
    236 || Baseline || 3.1 || iPhone 3G and later, iPod touch 2nd generation and later || `-profile:v baseline -level 3.1` ||
    237 || Main || 3.1 || iPad (all versions), Apple TV 2 and later, iPhone 4 and later || `-profile:v main -level 3.1` ||
    238 || Main || 4.0 || Apple TV 3 and later, iPad 2 and later, iPhone 4s and later || `-profile:v main -level 4.0` ||
    239 || High || 4.0 || Apple TV 3 and later, iPad 2 and later, iPhone 4s and later || `-profile:v high -level 4.0` ||
    240 || High || 4.1 || iPad 2 and later, iPhone 4s and later, iPhone 5c and later || `-profile:v high -level 4.1` ||
    241 || High || 4.2 || iPad Air and later, iPhone 5s and later || `-profile:v high -level 4.2` ||
    242 
    243 === !QuickTime ===
    244 
    245 Although other pixel formats may be supported, YUV planar color space with 4:2:0 chroma subsampling is a safe pixel format for H.264 video; use `-vf format=yuv420p` or `-pix_fmt yuv420p`.
    246 
    247 === Blu-ray ===
     221== Blu-ray ==
    248222
    249223See [http://www.x264bluray.com/ Authoring a professional Blu-ray Disc with x264].
     
    271245== Will two-pass provide a better quality than CRF? ==
    272246
    273 [http://web.archive.org/web/20140206073211/http://doom10.org/index.php?PHPSESSID=okj08qe73ictdtv532augv8nu7&topic=267.msg2071#msg2071 No], though it does allow you to target a file size more accurately.
     247[https://web.archive.org/web/20140206073211/http://doom10.org/index.php?PHPSESSID=okj08qe73ictdtv532augv8nu7&topic=267.msg2071#msg2071 No], though it does allow you to target a file size more accurately.
    274248
    275249== Why is `placebo` a waste of time? ==
     
    307281= Additional Resources =
    308282
    309 * [http://slhck.info/video/2017/02/24/crf-guide.html Constant Rate Factor Guide]
    310 * [http://slhck.info/video/2017/03/01/rate-control.html Understanding Rate Control Modes]
     283* [https://slhck.info/video/2017/02/24/crf-guide.html Constant Rate Factor Guide]
     284* [https://slhck.info/video/2017/03/01/rate-control.html Understanding Rate Control Modes]