This guide will be a guidance for calculating the bitrate of video for X264 encoding.
Single pass or multi pass?Edit
X264 supports two types of encoding in simple mode (not showing advanced options):
- Targeting quality, and
- Targeting file size.
Targeting quality means that every frame is encoded in the same quality, and you only need one pass for this mode. Because different videos have different compressibility, you cannot control the exact output file size, but you can have an idea on the output. The smaller the number, the better the output, and the bigger the file will be. Because you cannot know the output bitrate before you actually encode it, there is no point of calculating bitrate for this mode. Therefore, please skip this guide if you want to use this mode.
Targeting file size means that you can control the exact output file size, but you need two passes for this. The encoder will analyze the whole file in the first pass, and record where the file needs more bits to a stats file. And then the encoder will actually encode it in the second pass. You can have an idea about what the final quality will be, but you cannot know what the exact quality will be. In this mode, you can calculate the bitrate to control the final file size.
Using Bitrate CalculatorEdit
- On the main interface of MeGUI, load your AVS script now if you have not (by clicking the [...] button next to "Avisynth script").
- Open the Bitrate Calculator in tools. Once it opens, MeGUI should automatically fill in the information such as length and framerate.
- Fill in your audio information:
- If you have already encoded your audio, load it by clicking [...].
- If you have not encoded your audio, choose your desired audio codec and bitrate.
- (Optional) If you have extra streams wanted to add to calculation (e.g. subtitles and chapter files), add them by clicking "Add" on the right of "Audio & Extra".
- Choose the container that your final video file will be in under "Container".
- Click the drop down button on the right of "Total file size". Click "Select custom size".
- Type in the desired size of output file. Click "OK".
- Finally, click "Apply".
- For the documentation of Bitrate Calculator, visit MeGUI/Bitrate Calculator.