Configure fast-pskip in FFmpeg libx264
This article provides a straightforward guide on how to configure the
fast-pskip (Fast P-skip) option within the
libx264 encoder using FFmpeg. You will learn what this
setting does, how it impacts your video encoding speed and quality, and
the exact FFmpeg command-line arguments required to enable or disable
it.
What is Fast P-Skip?
Fast P-skip is an optimization feature in the H.264/MPEG-4 AVC encoder. When encoding a video, the encoder looks for redundant data between frames. If a block of pixels in a P-frame (predictive frame) has not changed significantly from the previous frame, the encoder can “skip” encoding that block to save processing time and bandwidth.
- Enabled (Default): Increases encoding speed but can occasionally cause minor blocky artifacts or loss of detail in areas with subtle gradients, such as dark scenes, skies, or smoke.
- Disabled: Slightly slows down encoding speed but improves visual quality by performing a more thorough analysis of motion vectors before deciding to skip a block.
How to Configure fast-pskip in FFmpeg
In FFmpeg, the libx264 encoder options are configured
using the -x264-params or -x264opts flags. The
internal parameter name in libx264 is
fast-skip.
1. Disabling Fast P-Skip (For Higher Quality)
To disable fast P-skip and achieve the highest possible detail
retention, set fast-skip=0 using the
-x264-params flag.
ffmpeg -i input.mp4 -c:v libx264 -x264-params fast-skip=0 output.mp4Alternatively, you can use the -x264opts flag:
ffmpeg -i input.mp4 -c:v libx264 -x264opts fast-skip=0 output.mp42. Enabling Fast P-Skip (For Faster Encoding)
Fast P-skip is enabled by default in almost all preset
configurations. However, if you need to explicitly enable it, set
fast-skip=1.
ffmpeg -i input.mp4 -c:v libx264 -x264-params fast-skip=1 output.mp4Combining with Other Parameters
If you are already passing other configuration parameters to
libx264, you can append fast-skip to your
existing list by separating the options with a colon
(:).
Here is an example that sets the Constant Rate Factor (CRF) to 20, sets the preset to “slow”, and disables fast P-skip:
ffmpeg -i input.mp4 -c:v libx264 -crf 20 -preset slow -x264-params fast-skip=0:aq-mode=3 output.mp4