[FFmpeg-trac] #5745(avfilter:new): The ‘fieldmatch’ filter sometimes fails to mark combed frames as interlaced.

FFmpeg trac at avcodec.org
Fri Jul 29 12:33:05 EEST 2016


#5745: The ‘fieldmatch’ filter sometimes fails to mark combed frames as
interlaced.
-------------------------------------+-------------------------------------
             Reporter:               |                     Type:  defect
  alexander_behringer                |                 Priority:  normal
               Status:  new          |                  Version:  git-
            Component:  avfilter     |  master
             Keywords:  fieldmatch   |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 == Description ==

 If the `fieldmatch` filter produces a combed frame, it is (according to
 the docs) supposed to mark this frame as interlaced, so that subsequent
 deinterlacing filters set to only deinterlace interlaced frames to remove
 the remaining combing.

 However, under certain circumstances the combing score for the final match
 never gets calculated, leaving it at its default value of `-1`, which
 never will trigger the interlaced marking. With default settings the
 combing score for the final match is only calculated, if the combed frame
 is part of a (detected) scene change. If `combmatch` is set to `0`, scene
 changes are never even checked for.

 As a workaround, if the final match is of type `p`, `c` or `n`, you can
 set the debug option `combdbg` to `pcn`, which as a side effect also
 calculates the combing score for the final match. If the final match is
 potentially of type `u` or `b`, you even need to set `combdbg` to `pcnub`
 to calculate these scores as well.

 Another workaround is to set `combmatch` to `full`, which calculates the
 combing scores for the final match as well, but also alters the matching
 behavior.

 == Example ==

 Here is an artificial example: The following video contains fields, for
 which no fitting matching partner can be found:

 {{{
 ffplay -f "lavfi"
 'nullsrc=s=512x512,geq=lum=255*gt(mod(X+Y-10*N\,W)\,W/4):cr=128:cb=128,telecine=pattern=2222222222211111111'
 }}}

 If this is send through the `fieldmatch` filter, it will inevitable
 produce combed frames:

 {{{
 ffplay -f "lavfi"
 'nullsrc=s=512x512,geq=lum=255*gt(mod(X+Y-10*N\,W)\,W/4):cr=128:cb=128,telecine=pattern=2222222222211111111,fieldmatch'
 }}}

 Adding a deinterlacer set to only deinterlace interlaced frames should fix
 this, but fails because of this bug:

 {{{
 ffplay -f "lavfi"
 'nullsrc=s=512x512,geq=lum=255*gt(mod(X+Y-10*N\,W)\,W/4):cr=128:cb=128,telecine=pattern=2222222222211111111,fieldmatch,w3fdif=deint=interlaced'
 }}}

 As mentioned earlier, adding `combdbg=pcn` to the options of `fieldmatch`
 works around that:

 {{{
 ffplay -f "lavfi"
 'nullsrc=s=512x512,geq=lum=255*gt(mod(X+Y-10*N\,W)\,W/4):cr=128:cb=128,telecine=pattern=2222222222211111111,fieldmatch=combdbg=pcn,w3fdif=deint=interlaced'
 }}}

 == Possible solution ==

 Check if the combing score for the final match has been calculated and if
 not calculated it before using it to potentially mark the frame as
 interlaced.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/5745>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list