The vocabulary trap
People say 'H.264' to mean three different things: the codec specification, an encoder that produces H.264 bitstreams, and a decoder that reads them. FFmpeg keeps these separate, and once you internalize the difference, error messages become much friendlier.
- Codec — the format specification (H.264, H.265, AV1). Defined by a standards body. Doesn't 'do' anything; it's a document.
- Encoder — software that produces bytes conforming to a codec spec. Multiple encoders can target the same codec:
libx264(CPU),h264_videotoolbox(Apple Silicon hardware),h264_nvenc(NVIDIA),h264_amf(AMD),h264_qsv(Intel) all produce H.264. - Decoder — software that reads bitstream bytes and produces raw frames. Usually one per codec, sometimes accelerated.
Why this matters
Different encoders for the same codec have wildly different speed/quality tradeoffs. libx264 at -preset slow often beats hardware encoders on quality at the same bitrate; hardware encoders crush them on speed. You pick based on the workflow.