Use the ultrafast preset when encode speed matters more than size
FFmpeg's H.264 presets control how aggressively the encoder searches for compressible patterns. ultrafast is the minimum-search preset: it runs at near real-time, produces the largest file for a given quality target, and is the right choice when you need to encode fast, not efficiently.
The command
ffmpeg -i input.mp4 -c:v libx264 -preset ultrafast output.mp4What it does
libx264's preset controls motion estimation, mode decision, and partition search. ultrafast turns off all of that: it uses the simplest possible encoder decisions, encodes frame by frame with no lookahead, and produces output that is typically 2 to 10 times larger than the medium preset at the same CRF.
When to use it
For real-time or near-real-time encoding, screen recording, video conferencing, and any time you need the encode to keep up with the input. ultrafast is also a debugging preset: if something does not encode at ultrafast, it is a fundamental issue, not a preset issue.
Video and audio requirements
Any input. ultrafast disables B-frames, which means the output is not as compressible in streaming. For real-time delivery, use a faster preset plus a higher CRF to control size. For example, -preset ultrafast -crf 28 gives a small, real-time file at the cost of quality.
Things to avoid
- Using
ultrafastfor delivery encodes. The files are 2 to 10 times larger than medium at the same quality. Use it for real-time or near-real-time only. - Forgetting that
ultrafastdisables B-frames. The output is I-frame and P-frame only, which inflates bitrate and reduces compression efficiency. - Combining
ultrafastwith high CRF. The preset already produces large files; CRF 28 makes them larger. For real-time at smaller size, usesuperfastorveryfastwith a higher CRF. - For live streaming,
ultrafastis fine, but for recording-then-uploading, prefer a slower preset and let the upload time absorb the encode cost.