x264 optimation notes

http://mewiki.project357.com/wiki/X264_Settings

 

 

1. preset

--preset veryslow --bframes 3 --ref 5 --rc-lookahead 120

2. tune

--tune fastdecode ( --no-cabac --no-deblock --no-weightb --weightp 0).

3.

 

 The number of reference frames is controlled by x264's ref option. It's the number of frames in the Decoded Picture Buffer.
Note: there is a minimum DPB size which depends on b-frame settings.
- b-frames enabled and b-pyramid normal -> 4
- b-frames enabled and b-pyramid strict -> 3
- b-frames enabled and b-pyramid none -> 2
- b-frames disabled -> 1
If you request a lower ref value, there will still be that many frames in the DPB (e.g. as reported by MediaInfo).
As I understand it, however, x264 will not place more references than requested in the DPB.

 

x264 Presets

x264 exposes a preset and tune system. Presets range from:

UltraFast

  • Very high speed encoding, but requires much higher bit-rates to maintain quality. This means you can expect much larger file sizes.

Placebo

  • Extremely slow encoding but provides the best Quality and/or filesize for a given source.
  • This option is often considered a placebo because it offers diminishing returns in terms of quality and filesize.

Typically, it's recommended to use the Very Fast to Slow settings range for best results, or one of the slower options if you don't mind the speed loss. Medium is a good balance and most of HandBrakes presets use this option.

x264 Tunes

The x264 tune options assign some additional options which will optimize theencoder for certain types of content.

If you are unsure or your content doesn't really fit into one of the followingtunes, you can simply leave this option at "None".

  • Film
    • Real life footage, films etc may benifit. (Not Cartoons or Anime). Typically won't do any harm to if left on for most content.
  • Animation
    • Used for hand-drawn animated content. 
  • Grain
    • Typically used for very grainy or old content.
  • Still Image
    • Can be used for Slideshows, Presentations etc where there is very little moving content.
  • PSNR
    • Used for benchmarking quality. Should not be used for normal use.
  • SSIM
    • Used for benchmarking quality. Should not be used for normal use.
  • Fast Decode
    • Optimise for faster decoding. Useful for low power devices that struggle to decode the video.

H.264 Profile

H.264 profiles define the features / capabilities that the encoder can use.

HandBrake exposes 3 profiles for H.264 Encodes. You can think of the profile as the level of complexity required in encode /decode. The higher the complexity, the more CPU power is needed to encode/decode. Setting a profile, constrains the encode to using settings that are allowed for that profile level.

Typically, devices will advertise that they are compatible for a particular profile and level, so you can simply set the option that matches your device for the best chance of compatibility. 

  • Auto  (Recommended)
    • This will automatically set the profile based on all the options that have been selected.
    • It is recommended that you use this option unless you need to set a profile to ensure compatibility for a particular device.
  • Baseline
    • Baseline encodes are the most basic form of encoding. While decoding is much easier, it may also require much higher bit-rates to maintain the same level of quality.
  • Main
    • The middle ground.  Most modern / current devices will support this profile.
  • High Profile
    • For best quality and filesize at the expense of CPU time in both decode and encode.

Note that setting a profile does not mean your encoded file will end up being that profile. It simply prevents options being used that would breach that profile constraint. 

H.264 Levels

The levels are another form of constraints that define things like maximum bitrates, framerates and resolution etc. The wikipedia article lists the relevant information for each level.http://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Levels

Most devices (and sometimes, software decoders) support a "maximum" level. When the video's specifications exceed that level's constraints, the decoder won't be able to decode the video properly (it may simply refuse to play the file).

HandBrake's H.264 encoder, x264, sets the appropriate level automatically based on all the other settings. To make sure your video doesn't exceed a specific level, you simply have to make sure the other parameters fit within the constraints imposed by the level.

It is recommended that you leave this setting on "Auto" unless you require to set it for device compatibility.

For a more detailed guide, see https://forum.handbrake.fr/viewtopic.php?f=6&t=19368

 

你可能感兴趣的:(x264 optimation notes)