wiki:

Postprocessing


Version 11 (modified by arwa, 5 years ago) (diff)

--

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 from the movie "Matrix" (187 seconds) compressed to 200kbps. The following table shows the filter options used, corresponding time taken to process the video, and the output frame number "123".
Original Image Query Image
spp=4:10 spp=6:20 spp=6:44:1
Time taken:198.784s Time taken:686.319s Time taken:678.862s
fspp=4:10 fspp=4:10:5 fspp=5:44:10
Time taken:107.847s Time taken:107.551s Time taken:191.128s
pp7=10:0 pp7=20:1 pp7=42
Time taken:195.468s Time taken:192.840s Time taken:197.956s
uspp=5:10 uspp=5:20 uspp=5:40
Time taken:6853.268s Time taken:6738.385s Time taken:6641.159s
pp=hb/vb/dr/fq|8 pp=hb/vb/dr/fq|16 pp=hb/vb/dr/fq|32
Time taken:39.978s Time taken:45.595s Time taken:44.119s
  1. Test sequence from the movie "Hannibal" (139 seconds) compressed to 200kbps. The following table shows the filter options used, corresponding time taken to process the video, and the output frame number "121".
Original Image Query Image
spp=5:10:0:1 spp=5:20 spp=5:40:0:1
Time taken:85.465s Time taken:83.173s Time taken:82.045s
fspp=4:10 fspp=4:10:10 fspp=5:20
Time taken:27.182s Time taken:27.146s Time taken:44.639s
pp7=10:0 pp7=10:1 pp7=20
Time taken:46.091s Time taken:47.187s Time taken:46.791s
uspp=4:10 uspp=6:20 uspp=6:44
Time taken:782.629s Time taken:3053.199s Time taken:2936.984s
pp=hb/vb/dr/fq|8 pp=hb/vb/dr/fq|16 pp=hb/vb/dr/fq|32
Time taken:14.137s Time taken:14.277s Time taken:14.053s

Attachments (60)