I am trying to make a reasonable decision in an automated logic flow if a video is interlaced, and then deinterlace it.
I am using ffmpeg and idet, and I would like some guidance on how to best use the information produced by idet.
I know interlace / telecine is a much more complicated topic than just idet, but please humor me and help with how to interpret idet. (also open to better but as simple solutions using ffmpeg CLI)
I am aware of the following resources on the topic:
Detecting interlaced video with ffmpeg
How to know if a video is interlaced or progressive?
idet.sh
In my testing I found lots of media where the field flags are not set, so using e.g. ffprobe or mediainfo alone is insufficient, so I do use ffprobe and mediainfo and idet.
The no longer maintained idet.sh script from MPV Player (if I interpret the script correctly) only uses multi frame output, and makes a determination based on interlaced being 5% or more of known frames.
When I look at synthetically generated content, it is very easy to make a decision, but when I look at in the wild content, I am not so sure if using 5% and only multi frame is a good approach.
E.g. synthetic interlaced sample:
ffmpeg -an -sn -dn -i "interlaced.mkv" -filter:v 'idet' -f null - Repeated Fields: Neither: 8991 Top: 0 Bottom: 0 Single frame detection: TFF: 8991 BFF: 0 Progressive: 0 Undetermined: 0 Multi frame detection: TFF: 8991 BFF: 0 Progressive: 0 Undetermined: 0 E.g. synthetic progressive sample:
ffmpeg -an -sn -dn -i "progressive.mkv" -filter:v 'idet' -f null - Repeated Fields: Neither: 8992 Top: 0 Bottom: 0 Single frame detection: TFF: 0 BFF: 0 Progressive: 8992 Undetermined: 0 Multi frame detection: TFF: 0 BFF: 0 Progressive: 8992 Undetermined: 0 With real media it is not so clear:
Repeated Fields: Neither: 76434 Top: 0 Bottom: 0 Single frame detection: TFF: 560 BFF: 6353 Progressive: 64750 Undetermined: 4771 Multi frame detection: TFF: 610 BFF: 6459 Progressive: 69231 Undetermined: 134 When should I use single frame vs. multi frame vs. both for decision making?
What are reasonable ratios to use for decision making?
Are there other maintained sources of code/script I can refer to that use idet?