[FFmpeg-user] fieldmatch "marked as interlaced" -- doesn't work

Mark Filipak (ffmpeg) markfilipak at bog.us
Thu Mar 18 08:54:09 EET 2021

On 2021-03-18 01:55, pdr0 wrote:
> Mark Filipak (ffmpeg) wrote
>> I hoped that "marked as interlaced" [1] meant that
>> 'select=expr=not(eq(interlace_type\,TOPFIRST)+eq(interlace_type\,BOTTOMFIRST))'
>> [2]
>> would work. However, the 'select' doesn't work. I'm counting on the
>> 'select' working -- not working
>> is a complete show stopper.
>> Is there some other species of "marked as interlaced" that will make the
>> 'select' work?
>> Thanks,
>> Mark.
>> [1] From https://ffmpeg.org/ffmpeg-filters.html#fieldmatch
>> "The separation of the field matching and the decimation is notably
>> motivated by the possibility of inserting a de-interlacing filter
>> fallback between the two. If the source has mixed telecined and real
>> interlaced content, fieldmatch will not be able to match fields for
>> the interlaced parts. But these remaining combed frames will be
>> *marked as interlaced*, and thus can be de-interlaced by a later
>> filter such as yadif before decimation."
>> [2] From https://ffmpeg.org/ffmpeg-filters.html#select_002c-aselect
>> "interlace_type (video only)
>> "    The frame interlace type. It can assume one of the following values:
>> "        The frame is progressive (not interlaced).
>> "    TOPFIRST
>> "        The frame is top-field-first.
>> "        The frame is bottom-field-first."
> Try using combmatch=full for fieldmatch

Really? ...I didn't think of that. The default is 'combmatch=sc'. I assumed that added scene change 
logic to 'full'.

> In this zip file is a sample test video "cadence.mp4". It has 23.976p
> content, 29.97i (59.94 fields/sec interlaced) content, and 29.97p content,
> all in a 29.97i stream. (There are many others cadences, but those are the 3
> most common)
> https://www.mediafire.com/file/m46kc4p1uvt7ae3/cadence_tests.zip/file

Thanks! That was very kind of you! I'll give it a look.

My current test video is very mixed (and mixed-up) content:
29.970fps(24pps)        ...telecined (movie clips)
+ 29.970fps(59.940sps)   ...scan-interlaced (interviews)
+ 29.970fps(29.970pps)   ...progressive (interviews)
+ 29.970fps(mutt)       ...[1] (location shots)
[1] A mess of nearly random combed, progressive, and repeated frames (amazingly, it looks quite good 
The video is from an actual Blu-ray -- would you believe it?

Here is my current filter complex (awaiting methods to 'split' the stream into secondary streams):


> In this example for -vf select after fieldmatch, the 2 branches are
> "progressive" and "not progressive". You can experiment with split and
> various processing with interleave in the filter chain

Really?! I tried 'eq(interlace_type\,PROGRESSIVE)' in my first attempt and, when that didn't work, 
went with functions of 'TOPFIRST' & 'BOTTOMFIRST'. Hmmm... I guess it's time to download the latest 
ffmpeg git and try again.

BTW, Tonight I submitted Subject: "'streampatterns' -- a proposed stream structure filter". I think 
it would make for an excellent, general purpose solution. I'm eager to read what the folks think of 
it. I could do all the algorithm coding but I don't write 'C' (only 'C' syntax), so have never 
compiled 'C' and don't know how to use structs. I'd need help with the integration.

Thanks Again,

Robotics will make bitcoin worthless. Why? Visualize millions of solar powered, self-replicating 
bitcoin miners. How much would they be worth? Bitcoin maintains marginal value solely via built-in 
inflation. That essentially makes bitcoin a Ponzi scheme, and it will be shut down by governments.

More information about the ffmpeg-user mailing list