[FFmpeg-devel] avfilter/vf_decimate: Improve decimation factor precision

Vladimir Petrov vppetrovmms at gmail.com
Tue Oct 3 15:26:38 EEST 2023


Currently, decimate video filter supports dropping of only single frame per
cycle, limiting the range of available framerate decimation factors. Now,
adding a new option 'dropcount' allows increasing of drop count, so more
fractional factors could be chosen. Also added an option 'spread' to set
percentage of dropped frame metrics spreading to adjanced frames. Bigger
value of 'spread' option means that non-duplicate frames will be
distributed more evenly to output. Especially, this is useful in case of
static scenes to avoid skipping of large frame sequences, i.e. to avoid
jumpy motion. Added a new option 'compat' (compatibility with the old
behaviour / 2nd patch). When set to 'true', no metrics recalculation will
be done when marking a new frame to be dropped. In case of scene change
detection, the last one per batch will be prioritized, instead of the best
one. In mixed mode, checking for interlaced frames will be omited.
Compatibility option is intended to keep matching with the original VIVTC
VDecimate filter code. Rules to drop frames are as follow: First priority
drops will be duplicate frames, in ascending order by their 'maxbdiff'
metrics. If these are not enough and have scene change, then will be
dropped first frames of the new scene. If all these are insufficient, then
will drop some frames with less 'maxbdiff' metrics. The logic (with
'dropcount=1') corresponds to the current behaviour.

Examples below (both converts 29.97 fps 3:2 pulldown content mixed with
interlaced content to 23.976 fps video):

1. Deinterlace after decimation.
fieldmatch=order=tff:mode=pcn:field=top:combmatch=full,decimate=mixed=1,bwdif=parity=tff:deint=1,fps=30000/1001

2. Deinterlace before decimation.
fieldmatch=order=tff:mode=pcn:field=top:combmatch=full,bwdif=parity=tff:deint=1,fps=60000/1001,decimate=mixed=0:cycle=10:dropcount=6:compat=0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-avfilter-vf_decimate-Improve-decimation-factor-preci.patch
Type: text/x-patch
Size: 16398 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20231003/9a9b4aca/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-avfilter-vf_decimate-Add-compatibility-option.patch
Type: text/x-patch
Size: 5051 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20231003/9a9b4aca/attachment-0001.bin>


More information about the ffmpeg-devel mailing list