> compression

Compression is where you trade file size against quality and encode time. The two core strategies are constant-quality (CRF), when you care about how the result looks and can let the size float, and target-bitrate (two-pass or a capped bitrate), when you must land near a specific file size. Hardware encoders like VideoToolbox and NVENC give a large speed-up at the cost of some compression efficiency.

// compression

5 commands

// faq

Should I use CRF or a target bitrate?

Use CRF when you want consistent visual quality and don't care about the exact output size — the encoder spends bits where the picture needs them. Use two-pass bitrate encoding only when you must hit a specific file size like an upload limit.

How do I hit an exact target file size?

Compute total bitrate = target_size_in_bits / duration_in_seconds, subtract the audio bitrate to get -b:v, then run a two-pass encode with that value. Two-pass analyzes the whole file first, so it distributes the bit budget far more accurately than single-pass CBR.

Why does my hardware encode look worse than libx264 at the same bitrate?

Hardware encoders (VideoToolbox, NVENC) trade compression efficiency for speed, so at a given bitrate they typically look worse than a slow CPU libx264/libx265 encode. Use them when encode time matters more than squeezing out maximum compression efficiency.