FFMPEG Deinterlacing Modes

FFMPEG has multiple supported deinterlacing filters.  Here they are:
10.14 bwdif
Deinterlace the input video ("bwdif" stands for "Bob Weaver Deinterlacing Filter").
Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic interpolation algorithms. It accepts the following parameters:
mode
The interlacing mode to adopt. It accepts one of the following values:
0, send_frame
Output one frame for each frame.
1, send_field
Output one frame for each field.
The default value is send_field.
parity
The picture field parity assumed for the input interlaced video. It accepts one of the following values:
0, tff
Assume the top field is first.
1, bff
Assume the bottom field is first.
-1, auto
Enable automatic detection of field parity.
The default value is auto. If the interlacing is unknown or the decoder does not export this information, top field first will be assumed.
deint
Specify which frames to deinterlace. Accept one of the following values:
0, all
Deinterlace all frames.
1, interlaced
Only deinterlace frames marked as interlaced.
The default value is all.
==================================================================================
==================================================================================
10.96 kerndeint
Deinterlace input video by applying Donald Graft’s adaptive kernel deinterling. Work on interlaced parts of a video to produce progressive frames.
The description of the accepted parameters follows.
thresh
Set the threshold which affects the filter’s tolerance when determining if a pixel line must be processed. It must be an integer in the range [0,255] and defaults to 10. A value of 0 will result in applying the process on every pixels.
map
Paint pixels exceeding the threshold value to white if set to 1. Default is 0.
order
Set the fields order. Swap fields if set to 1, leave fields alone if 0. Default is 0.
sharp
Enable additional sharpening if set to 1. Default is 0.
twoway
Enable twoway sharpening if set to 1. Default is 0.
==================================================================================
==================================================================================
10.109 mcdeint
Apply motion-compensation deinterlacing.
It needs one field per frame as input and must thus be used together with yadif=1/3 or equivalent.
This filter accepts the following options:
mode
Set the deinterlacing mode.
It accepts one of the following values:
‘fast’
‘medium’
‘slow’
use iterative motion estimation
‘extra_slow’
like ‘slow’, but use multiple reference frames.
Default value is ‘fast’.
parity
Set the picture field parity assumed for the input video. It must be one of the following values:
‘0, tff’
assume top field first
‘1, bff’
assume bottom field first
Default value is ‘bff’.
qp
Set per-block quantization parameter (QP) used by the internal encoder.
Higher values should result in a smoother motion vector field but less optimal individual vectors. Default value is 1.
==================================================================================
==================================================================================
10.118 nnedi
Deinterlace video using neural network edge directed interpolation.
This filter accepts the following options:
weights
Mandatory option, without binary file filter can not work. Currently file can be found here: https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
deint
Set which frames to deinterlace, by default it is all. Can be all or interlaced.
field
Set mode of operation.
Can be one of the following:
‘af’
Use frame flags, both fields.
‘a’
Use frame flags, single field.
‘t’
Use top field only.
‘b’
Use bottom field only.
‘tf’
Use both fields, top first.
‘bf’
Use both fields, bottom first.
planes
Set which planes to process, by default filter process all frames.
nsize
Set size of local neighborhood around each pixel, used by the predictor neural network.
Can be one of the following:
‘s8x6’
‘s16x6’
‘s32x6’
‘s48x6’
‘s8x4’
‘s16x4’
‘s32x4’
nns
Set the number of neurons in predictor neural network. Can be one of the following:
‘n16’
‘n32’
‘n64’
‘n128’
‘n256’
qual
Controls the number of different neural network predictions that are blended together to compute the final output value. Can be fast, default or slow.
etype
Set which set of weights to use in the predictor. Can be one of the following:
‘a’
weights trained to minimize absolute error
‘s’
weights trained to minimize squared error
pscrn
Controls whether or not the prescreener neural network is used to decide which pixels should be processed by the predictor neural network and which can be handled by simple cubic interpolation. The prescreener is trained to know whether cubic interpolation will be sufficient for a pixel or whether it should be predicted by the predictor nn. The computational complexity of the prescreener nn is much less than that of the predictor nn. Since most pixels can be handled by cubic interpolation, using the prescreener generally results in much faster processing. The prescreener is pretty accurate, so the difference between using it and not using it is almost always unnoticeable.
Can be one of the following:
‘none’
‘original’
‘new’
Default is new.
fapprox
Set various debugging flags.
==================================================================================
==================================================================================
10.135 pp
Enable the specified chain of postprocessing subfilters using libpostproc. This library should be automatically selected with a GPL build (--enable-gpl). Subfilters must be separated by ’/’ and can be disabled by prepending a ’-’. Each subfilter and some options have a short and a long name that can be used interchangeably, i.e. dr/dering are the same.
lb/linblenddeint
Linear blend deinterlacing filter that deinterlaces the given block by filtering all lines with a (1 2 1) filter.
li/linipoldeint
Linear interpolating deinterlacing filter that deinterlaces the given block by linearly interpolating every second line.
ci/cubicipoldeint
Cubic interpolating deinterlacing filter deinterlaces the given block by cubically interpolating every second line.
md/mediandeint
Median deinterlacing filter that deinterlaces the given block by applying a median filter to every second line.
fd/ffmpegdeint
FFmpeg deinterlacing filter that deinterlaces the given block by filtering every second line with a (-1 4 2 4 -1) filter.
l5/lowpass5
Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given block by filtering all lines with a (-1 2 6 2 -1) filter.
==================================================================================
==================================================================================
10.201 w3fdif
Deinterlace the input video ("w3fdif" stands for "Weston 3 Field Deinterlacing Filter").
Based on the process described by Martin Weston for BBC R&D, and implemented based on the de-interlace algorithm written by Jim Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter uses filter coefficients calculated by BBC R&D.
There are two sets of filter coefficients, so called "simple": and "complex". Which set of filter coefficients is used can be set by passing an optional parameter:
filter
Set the interlacing filter coefficients. Accepts one of the following values:
‘simple’
Simple filter coefficient set.
‘complex’
More-complex filter coefficient set.
Default value is ‘complex’.
deint
Specify which frames to deinterlace. Accept one of the following values:
‘all’
Deinterlace all frames,
‘interlaced’
Only deinterlace frames marked as interlaced.
Default value is ‘all’.
==================================================================================
==================================================================================
10.205 yadif
Deinterlace the input video ("yadif" means "yet another deinterlacing filter").
It accepts the following parameters:
mode
The interlacing mode to adopt. It accepts one of the following values:
0, send_frame
Output one frame for each frame.
1, send_field
Output one frame for each field.
2, send_frame_nospatial
Like send_frame, but it skips the spatial interlacing check.
3, send_field_nospatial
Like send_field, but it skips the spatial interlacing check.
The default value is send_frame.
parity
The picture field parity assumed for the input interlaced video. It accepts one of the following values:
0, tff
Assume the top field is first.
1, bff
Assume the bottom field is first.
-1, auto
Enable automatic detection of field parity.
The default value is auto. If the interlacing is unknown or the decoder does not export this information, top field first will be assumed.
deint
Specify which frames to deinterlace. Accept one of the following values:
0, all
Deinterlace all frames.
1, interlaced
Only deinterlace frames marked as interlaced.
The default value is all.

Comments

  1. All that and no examples. THIS IS FRUSTRATING

    ReplyDelete
  2. If you are looking for how to actually use a video filter in ffmpeg, here is an example command line. Just supply the -vf flag.

    ffmpeg -i input.vob -vf yadif -c:v libx264 -c:a aac -b:a 256k output.mp4

    ReplyDelete
  3. The syntax you want for Linux use is

    ffmpeg -i input.mkv -vf bwdif="mode=send_field:deint=all:parity=bff" -tune grain -c:v libx264 -preset slow -crf 17 -c:a copy output.mkv

    and you may need to replace "bff" with "tff" depending on the source of the interlaced material. The automatic detection of field order failed for me and caused poor judder in the final image. Just try both and whichever results in smooth movement is the correct one.

    If you use Windows, I think you might need to drop the double quote marks in the above example.

    Above will require about 10-15 fast CPU cores to run at real time speeds with 1080i input but should result in really high quality output. The nnedi algorithm should output even higher quality output if correctly tuned but I don't have enough CPU power to really use that.

    ReplyDelete

Post a Comment

Popular posts from this blog

Remote debugging with GDB and GDBServer on Alpine and Visual Studio Code

Build FFMPEG for Windows Using Visual Studio Toolchain