Many years ago, I created this guide to 'extreme' compression using x264 - attaining compact, high-quality files through the use of the most heavily optimised configuration, without regard to processing time or to the amount of human attention required.

In the years since, technology and expectations have advanced and rendered much of this guide obsolete. HTML5 video, then a new technology, has become widely established. Where once almost all video was downloaded, it is now as likely to be streamed. Most importantly, device profiles matter a lot more, as viewing video on comparatively low-powered devices such as tablets and phones has become just as important as viewing on PCs and laptops.

As I write this new introduction, h265 is poised to take over from h264 - a codec substantially more advanced. I hae decided against updating this guide to modern technologies and conventions, as this would be a near-total rewrite. Certain portions of it, however, still hold value, and so nor am I going to take it down entirely. Insead I am archiving it into IPFS, to serve as both a reference and as a historical view into the video technology of the 2000's.

Please bear this in mind when using anything you read below: Much of it is written with old technology in mind, and no longer conforms to current best practices. These instructions are aimed at creating the most compact possible file for download, and push the playback device to a limit that many portables are unable to play back. Nothing below should be followed blindly, but only taken as a suggestion.

- Codebird, 2017, with regard to Codebird, 2007.


Contents:
Introduction
Preparing the source
Filtering and restoration
Basic encoding settings
Advanced encoding settings
Audio, muxing and metadata

Introduction.

H.264 is perhaps the most sophisticated general-purpose video codec in common use today, and x264 without doubt its most refined encoder implementation. Even when used on default settings, it can achieve an impressive quality for the bitrate.

There are some times when storage is at a premium, most often in internet distribution. In those situations, merely impressive just isn't enough - extensive fine-tuning of the encoder settings and the use of any amount of processor time is justified to achieve even small savings, as these savings are multiplied by the number of downloads. If a file is downloaded a thousand times, even a one-megabyte saving on file size can cut a gigabyte from the network traffic.

This is not a guide to achieving merely a good encode. This is for those time when you want the best - when every byte matters, when every pixel should be as close as you can get it, and when you don't care how much processing time it's going to take. This is a guide for those who have eight cores in their workstation and don't mind waiting a week.

There is a cost to this quality: Aside from the processing time to encode, it may require much tweaking of options and experimenting with filtering to find the ideal methods for each video. Achieving the most with x264 also requires disregarding h264 device profiles - not a problem when playing back video on a PC, but it can be an issue when playing on embedded devices using hardware acceleration, and the lack of precise bandwidth control can pose difficulties with streaming or certain media. This is not a guide to 'how to encode a blu-ray' - it's a guide to how to encode compact files for download.

Through this guide I am assuming you use the mencoder front-end for your encoding. If you use another program - for example, x264's executable directly or the popular Handbreak program - you will need to adapt the advice accordingly. The underlying encoder is the same, but options may be entered in a different manner.