wiki:

Postprocessing


Version 8 (modified by saste, 3 years ago) (diff)

add short comment clarifying when PP can issue good results in transcoding

Post-processing filters are used in videos for quality-improvement. They are especially relevant for filtering video material encoded with low-quality, as they allow to remove the more common encoding artifacts (e.g. blocking and ringing).

These filters are intended for recovering quality of videos ripped from DVD, VideoCD or after decompressing.

FFmpeg includes the following post-processing filters:

  • spp - Simple Postprocessing
  • uspp - Ultra Simple or Slow Postprocessing
  • fspp - Fast Simple Postprocessing
  • pp7 - Postprocessing 7
  • pp - libpostproc wrapper

These filters basically smooth away blocking and other artifacts from low quality sources. The QP parameter is chosen by the encoder used to create the video, VCD, DVD, etc. Lower QP for the encoder results in higher bitrate and higher quality encoding. If no "QP" parameter is specified by the user to postprocessing filter uses the one that is stored in the encoded file for the specific area. In particular, the quantization parameter QP regulates how much spatial detail is saved. When QP is very small, almost all detail is retained. As QP is increased, some of that detail is aggregated so that the bit rate drops – but at the price of some increase in distortion and some loss of quality.

uspp uses an encoder, hence, should be used only when one has a powerful CPU. Also, uspp is very slow as compared to other filters. Therefore, for processing large amount of data, fspp is a good option (It gives good results if parameters are chosen wisely).

Postprocessing filters can be used on the ffmpeg commandline like this:

ffmpeg -i INPUT ... -vf PP OUTPUT

or can be used to playback the input with ffplay like this:

ffplay INPUT -vf PP

where PP is the postprocessing filter with its parameters.

When using postprocessing filters before encoding, keep in mind that even if encoding artifacts will be removed by the filter, new artifacts will be added by the new encoding. In some cases the postprocessing filters though will increase the visual quality (or even reduce the encoding output size), especially when encoding from low-quality content to high-quality (using a better codec or a higher bitrate).

Let's consider the example of

  1. Test sequence called "Foreman"(frame 155, compressed using Xvid with bitrate option 50, 75, 100kbs):
Reference Image
benchmark1 for comparing the post-processing filters
spp=4:10 spp=6:20 spp=6:44:1
spp=4:10 spp=6:20 spp=6:44:1
fspp=4:10 fspp=4:10:5 fspp=5:44:10
fspp=4:10 fspp=4:10:5 fspp=5:44:10
pp7=10:0 pp7=20:1 pp7=42
PP7=10:0 PP7=20:1 fspp=5:44:10
  1. The standard lena 256×256 image which is saved by gimp to 10% quality.
Reference Image
benchmark2 for comparing the post-processing filters
spp=5:10:0:1 spp=5:20 spp=5:40:0:1
spp=5:10:0:1 spp=5:20 spp=5:40:0:1
fspp=4:10 fspp=4:10:10 fspp=5:20
fspp=4:10 fspp=4:10:10 fspp=5:20
pp7=10:0 pp7=10:1 pp7=20
PP7=10:0 PP7=10:1 PP7=20

Attachments (60)