How to Run an x264 FHD Benchmark for Accurate Encoding ScoresRunning an x264 FHD benchmark gives you a reproducible way to measure your system’s video encoding performance using the widely used x264 encoder for H.264/AVC. This guide walks you through everything needed to produce accurate, repeatable results: prerequisites, choosing test material and settings, running the benchmark, interpreting scores, troubleshooting variability, and how to compare systems fairly.
What the x264 FHD benchmark measures
The x264 FHD benchmark encodes a Full HD (1920×1080) source using x264 and reports how many frames per second (FPS) your system can encode under the chosen preset and quality settings. It primarily stresses CPU performance (single-threaded and multi-threaded scheduling, cache, memory bandwidth), but I/O and thermal throttling can affect results.
Key fact: x264 benchmarks measure encoding throughput in FPS and are sensitive to presets, bitrates, and CPU characteristics.
Prerequisites and environment setup
-
Hardware checklist
- A stable, powered desktop or laptop with adequate cooling.
- Disable turbo limits or thermal throttling where possible for consistent results.
- If comparing systems, ensure similar ambient temperature and power profiles.
-
Software checklist
- Latest stable build of x264 (source-compiled or prebuilt binary recommended).
- A consistent OS image (Windows, Linux, or macOS) with minimal background processes.
- Tools for system monitoring (CPU temperature, frequency, core utilization) such as HWInfo, top/htop, or lm-sensors.
- A clean environment: close unnecessary apps, disable Windows Update, antivirus scans, scheduled tasks.
-
Reproducibility steps
- Use the same x264 version for all runs.
- Use the same input source file and storage device (preferably SSD for consistent read times).
- Fix CPU frequency governors to “performance” on Linux or set high-performance power plan on Windows.
- Run multiple iterations (3–5) and compute median or mean excluding outliers.
Choosing source material
- Use a Full HD (1920×1080) source file encoded with a high-quality, high-bitrate intra or lightly compressed format to avoid decode bottlenecks.
- Suitable formats: uncompressed YUV (YUV4MPEG2), ProRes, DNxHR, or a high-bitrate H.264/H.265 source.
- For consistent codec behavior, many benchmarking guides use a synthetic test clip or a long movie segment (60–600 seconds). Example: a 2–3 minute action scene stresses motion estimation more than a talking-head clip.
x264 build and command-line options
-
Obtaining x264
- On Linux, compile from source for maximum control:
git clone https://code.videolan.org/videolan/x264.git cd x264 ./configure --enable-shared make -j$(nproc) sudo make install
- Alternatively, use a packaged binary for your OS, ensuring version consistency.
- On Linux, compile from source for maximum control:
-
Recommended command-line template
- A common benchmarking line for FHD:
x264 --preset veryfast --profile high --level 4.1 --input-res 1920x1080 --fps 24 --output - input.y4m -o /dev/null
- Explanation of important flags:
- –preset: controls encoder speed vs quality. Presets range from ultrafast to placebo. For throughput benchmarks choose the preset(s) you want to compare (e.g., medium, fast, veryfast).
- –profile/–level: compatibility targets; level 4.1 is typical for FHD.
- –input-res / input format: match the source.
- Output to /dev/null or NUL to avoid disk I/O influencing results.
- A common benchmarking line for FHD:
-
Example commands for common environments
- Linux (using YUV4MPEG2 input):
ffmpeg -i source.mp4 -f yuv4mpegpipe - | x264 --preset fast --profile high --input-res 1920x1080 --fps 30 -o /dev/null -
- Windows (PowerShell):
ffmpeg -i source.mp4 -f yuv4mpegpipe - | x264 --preset fast --profile high --input-res 1920x1080 --fps 30 -o NUL -
- Linux (using YUV4MPEG2 input):
Choosing presets and quality settings
- Preset selection is the dominant factor for encoding speed. For comparative throughput:
- Ultrafast/veryfast: high FPS, lower compression efficiency.
- Fast/medium: balanced; often used in benchmarks for realistic scenarios.
- Slow/slower: much lower FPS but higher compression; suitable if testing quality trade-offs.
- Rate control modes:
- CRF (constant rate factor) affects quality; lower CRF => higher quality => more CPU work sometimes. For throughput, use a fixed preset and CRF (e.g., CRF 18–23) if comparing quality-aware performance.
- ABR/CQ/CBR can change encoder decisions; pick one and keep it consistent.
Running the benchmark
- Warm-up run: perform a single run to warm CPU caches and reach steady thermal state, then wait a short cooldown if needed.
- Execute multiple timed runs (3–10). Use consistent timing (x264 prints fps and time).
- Record:
- Average FPS reported by x264.
- CPU temperatures and per-core frequencies during runs.
- Any background activity or thermal throttling events.
Example run script (Linux bash):
#!/bin/bash for i in 1 2 3 4 5; do ffmpeg -i source.mp4 -f yuv4mpegpipe - | x264 --preset fast --crf 20 --profile high --input-res 1920x1080 --fps 30 -o /dev/null - done
Interpreting scores and comparing systems
- Use FPS as the primary metric. Higher FPS = faster encoding.
- Compare medians across runs to reduce outlier effects.
- When comparing systems, normalize by core count or CPU clock if you need per-core or per-clock comparisons.
- Consider plotting FPS vs preset to visualize scaling across presets.
Simple comparison table example:
System | CPU | Cores/Threads | Preset | Median FPS |
---|---|---|---|---|
A | Intel i7-13700K | ⁄24 | fast | 220 |
B | AMD 7800X3D | ⁄16 | fast | 185 |
Sources of variability and how to minimize them
- Thermal throttling: ensure good cooling and monitor temps.
- Background processes and OS scheduling: use a clean environment and performance power plans.
- CPU frequency scaling: set governor to performance on Linux or high-performance power plan on Windows.
- Input I/O: pipe input to x264 or use fast local SSDs to avoid disk stalls.
- Different x264 builds or compiler optimizations: compile with identical flags where possible.
Advanced tips
- Pin threads or set CPU affinity to control scheduling behavior.
- Use perf or VTune for hotspot analysis to see which functions dominate time.
- If testing GPU-accelerated encoders (e.g., NVENC) for comparison, keep CPU workload separate and note the encoder type.
- For quality vs speed analysis, measure output file size and PSNR/SSIM/VMAF on encoded outputs at different presets/CRF values.
Example workflow summary (concise)
- Prepare a high-bitrate FHD source and a fresh system state.
- Build or obtain a consistent x264 binary.
- Set power/CPU governors to performance and monitor temps.
- Run warm-up, then 3–5 timed runs piping input to x264, output to null.
- Record median FPS and system telemetry.
- Compare using consistent presets/CRF and normalize where needed.
Troubleshooting common issues
- Low FPS despite high CPU: check for thermal throttling or background tasks.
- Inconsistent runs: verify governors, disable C-states, ensure same x264 build.
- Decoding bottleneck: use uncompressed or faster decode formats as input.
Running x264 FHD benchmarks carefully—controlling input, presets, system state, and repeating runs—yields reliable, comparable encoding scores that reflect real-world CPU encoding performance.
Leave a Reply