I am trying to make a reasonable decision if a video is interlaced and if it is to decomb it using handbrake.
I use ffmpeg with the idet filter, and I'd like some advice on the best way to interpret the values.
I am currently doing a percentage of total interlaced for single and multi frames vs. total undefined or progressive, but I find my results are not reliable.
I did find this script that seems to work based on interlaced or progressive must be 10x the other, and it only looks at multi frame not singe. It does some more processing based on the detection, but I am just looking for making a single decision based on the idet info. (If I read the script correctly)
E.g. if I use a pure interlaced sample:
Code: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. a pure progressive sample:
But when I use some real media the decision is not that clear:Code: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
When should I use single frame vs. multi frame for decision making?Code: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
What are reasonable ratios to use for decision making?
Are there other sources of code I can refer to that use idet?
+ Reply to Thread
Results 1 to 9 of 9
-
-
I would never base my decisions on such statistics. I always separate the fields (using avisynth, Vdub, maybe ffmpeg/ffplay), step through the fields manually and use my eyes to evaluate the fields sequence in order to decide on TFF, BFF, PsF, Telecined, Phase shifted video ..... I am not aware of any reliable 'automatic' tool which meets that purpose.
-
I am not aware of any reliable 'automatic' tool which meets that purpose.
I am trying to make a reasonable decision
Cu Selurusers currently on my ignore list: deadrats, Stears555, marcorocchini -
Thank you for your input, would still like to know how to use idet results, even if suboptimal.
-
No clue how to properly interpret the idet output, but how I would go at it:
Take a few sources where I know what they are.
(progressive, interlaced-tff, interlaced-bff, field shifted, telecined, other patterns)
Analyze these source with idet:
1. and nothing else
2. after applying bob deinterlacing
3. after applying ivtc
4. after applying fieldmatch
compare the changes in the results for each of the types.
At least for non-mixed content, this should allow heuristically identifying each of these types.
If this is not the case, you might have to change the thresholds.
When should I use single frame vs. multi frame for decision making?
=> to get a good heuristic, you probably will have to do tons of analysis on different samples.
Side note: years ago, I tried something similar with mplayer, but it didn't really turn out to be great.
Cu Selurusers currently on my ignore list: deadrats, Stears555, marcorocchini -
With the exception of unambiguous basic cases I don't think it is possible to draw conclusions based on these '-idet' statistics.
Similarly one cannot reconstruct a picture just knowing its levels histograms. -
For fun I called idet on a bff source:
(directly)
Code:ffmpeg -an -sn -dn -i "g:\TestClips&Co\files\interlaceAndTelecineSamples\interlaced\bff.m2v" -filter:v idet -f null NUL [Parsed_idet_0 @ 0000024aec538680] Repeated Fields: Neither: 150 Top: 0 Bottom: 0 [Parsed_idet_0 @ 0000024aec538680] Single frame detection: TFF: 0 BFF: 150 Progressive: 0 Undetermined: 0 [Parsed_idet_0 @ 0000024aec538680] Multi frame detection: TFF: 0 BFF: 150 Progressive: 0 Undetermined: 0
Code:ffmpeg -an -sn -dn -i "g:\TestClips&Co\files\interlaceAndTelecineSamples\interlaced\bff.m2v" -filter:v bwdif=mode=1:parity=0,idet -f null NUL [Parsed_idet_1 @ 0000023e7583db40] Repeated Fields: Neither: 300 Top: 0 Bottom: 0 [Parsed_idet_1 @ 0000023e7583db40] Single frame detection: TFF: 2 BFF: 22 Progressive: 267 Undetermined: 9 [Parsed_idet_1 @ 0000023e7583db40] Multi frame detection: TFF: 7 BFF: 0 Progressive: 293 Undetermined: 0 [out#0/null @ 0000023e755b8940] video:122KiB audio:0KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknown
Code:ffmpeg -an -sn -dn -i "g:\TestClips&Co\files\interlaceAndTelecineSamples\interlaced\bff.m2v" -filter:v bwdif=mode=1:parity=1,idet -f null NUL [Parsed_idet_1 @ 000002ac314b8500] Repeated Fields: Neither: 300 Top: 0 Bottom: 0 [Parsed_idet_1 @ 000002ac314b8500] Single frame detection: TFF: 0 BFF: 2 Progressive: 264 Undetermined: 34 [Parsed_idet_1 @ 000002ac314b8500] Multi frame detection: TFF: 0 BFF: 5 Progressive: 295 Undetermined: 0
(directly)
Code:ffmpeg -an -sn -dn -i "g:\TestClips&Co\files\interlaceAndTelecineSamples\interlaced\numbered_fields_tff.m2v" -filter:v idet -f null NUL [Parsed_idet_0 @ 000001e043f4fec0] Repeated Fields: Neither: 750 Top: 0 Bottom: 0 [Parsed_idet_0 @ 000001e043f4fec0] Single frame detection: TFF: 598 BFF: 152 Progressive: 0 Undetermined: 0 [Parsed_idet_0 @ 000001e043f4fec0] Multi frame detection: TFF: 745 BFF: 5 Progressive: 0 Undetermined: 0
Code:ffmpeg -an -sn -dn -i "g:\TestClips&Co\files\interlaceAndTelecineSamples\interlaced\numbered_fields_tff.m2v" -filter:v bwdif=mode=1:parity=0,idet -f null NUL [Parsed_idet_1 @ 000001cfe92dfc40] Repeated Fields: Neither: 1500 Top: 0 Bottom: 0 [Parsed_idet_1 @ 000001cfe92dfc40] Single frame detection: TFF: 2 BFF: 0 Progressive: 1498 Undetermined: 0 [Parsed_idet_1 @ 000001cfe92dfc40] Multi frame detection: TFF: 4 BFF: 0 Progressive: 1496 Undetermined: 0
Code:ffmpeg -an -sn -dn -i "g:\TestClips&Co\files\interlaceAndTelecineSamples\interlaced\numbered_fields_tff.m2v" -filter:v bwdif=mode=1:parity=1,idet -f null NUL [Parsed_idet_1 @ 0000025eb70ffc40] Repeated Fields: Neither: 1500 Top: 0 Bottom: 0 [Parsed_idet_1 @ 0000025eb70ffc40] Single frame detection: TFF: 0 BFF: 2 Progressive: 1498 Undetermined: 0 [Parsed_idet_1 @ 0000025eb70ffc40] Multi frame detection: TFF: 0 BFF: 4 Progressive: 1496 Undetermined: 0
(directly)
Code:ffmpeg -an -sn -dn -i "g:\TestClips&Co\files\interlaceAndTelecineSamples\telecine\emotion.mpg" -filter:v idet -f null NUL [Parsed_idet_0 @ 000001eb8b039c80] Repeated Fields: Neither: 403 Top: 48 Bottom: 40 [Parsed_idet_0 @ 000001eb8b039c80] Single frame detection: TFF: 332 BFF: 0 Progressive: 52 Undetermined: 107 [Parsed_idet_0 @ 000001eb8b039c80] Multi frame detection: TFF: 491 BFF: 0 Progressive: 0 Undetermined: 0
Code:ffmpeg -an -sn -dn -i "g:\TestClips&Co\files\interlaceAndTelecineSamples\telecine\emotion.mpg" -filter:v bwdif=mode=1:parity=0,idet -f null NUL [Parsed_idet_1 @ 00000251d5dc1500] Repeated Fields: Neither: 982 Top: 0 Bottom: 0 [Parsed_idet_1 @ 00000251d5dc1500] Single frame detection: TFF: 64 BFF: 129 Progressive: 365 Undetermined: 424 [Parsed_idet_1 @ 00000251d5dc1500] Multi frame detection: TFF: 0 BFF: 205 Progressive: 777 Undetermined:
Code:ffmpeg -an -sn -dn -i "g:\TestClips&Co\files\interlaceAndTelecineSamples\telecine\emotion.mpg" -filter:v bwdif=mode=1:parity=0,idet -f null NUL [Parsed_idet_1 @ 000002dda954ec80] Repeated Fields: Neither: 981 Top: 0 Bottom: 1 [Parsed_idet_1 @ 000002dda954ec80] Single frame detection: TFF: 214 BFF: 58 Progressive: 394 Undetermined: 316 [Parsed_idet_1 @ 000002dda954ec80] Multi frame detection: TFF: 210 BFF: 0 Progressive: 772 Undetermined: 0
(directly)
Code:ffmpeg -an -sn -dn -i "g:\TestClips&Co\files\interlaceAndTelecineSamples\soft telecine\dts_96kHz.vob" -filter:v idet -f null NUL [Parsed_idet_0 @ 0000017742849c00] Repeated Fields: Neither: 540 Top: 0 Bottom: 1 [Parsed_idet_0 @ 0000017742849c00] Single frame detection: TFF: 1 BFF: 1 Progressive: 320 Undetermined: 219 [Parsed_idet_0 @ 0000017742849c00] Multi frame detection: TFF: 0 BFF: 0 Progressive: 466 Undetermined: 75
Code:ffmpeg -an -sn -dn -i "g:\TestClips&Co\files\interlaceAndTelecineSamples\soft telecine\dts_96kHz.vob" -filter:v bwdif=mode=1:parity=0,idet -f null NUL [Parsed_idet_1 @ 000001f21624fe00] Repeated Fields: Neither: 1064 Top: 10 Bottom: 8 [Parsed_idet_1 @ 000001f21624fe00] Single frame detection: TFF: 5 BFF: 26 Progressive: 618 Undetermined: 433 [Parsed_idet_1 @ 000001f21624fe00] Multi frame detection: TFF: 0 BFF: 145 Progressive: 787 Undetermined: 150
Code:ffmpeg -an -sn -dn -i "g:\TestClips&Co\files\interlaceAndTelecineSamples\soft telecine\dts_96kHz.vob" -filter:v bwdif=mode=1:parity=1,idet -f null NUL [Parsed_idet_1 @ 000002abb7a07f80] Repeated Fields: Neither: 1065 Top: 7 Bottom: 10 [Parsed_idet_1 @ 000002abb7a07f80] Single frame detection: TFF: 26 BFF: 5 Progressive: 618 Undetermined: 433 [Parsed_idet_1 @ 000002abb7a07f80] Multi frame detection: TFF: 149 BFF: 0 Progressive: 783 Undetermined: 150
=> don't see how these outputs can be reliable with the defaults, so one probably will have to play with the thresholdsusers currently on my ignore list: deadrats, Stears555, marcorocchini -
Well yes .....
From the doc
https://ffmpeg.org/ffmpeg-filters.html#idet
This filter tries to detect if the input frames are interlaced, progressive, top or bottom field first. It will also try to detect fields that are repeated between adjacent frames (a sign of telecine).
Similar Threads
-
Remove ghosting on an interlaced DVD with ffmpeg
By Larsenv in forum Newbie / General discussionsReplies: 12Last Post: 19th Aug 2024, 20:30 -
How to capture interlaced video w/ AIW-pro s-vide and vdub
By armyofquad in forum Capturing and VCRReplies: 0Last Post: 7th Jul 2024, 21:16 -
How to interpret ffmpeg error messages?
By Luke M in forum Video ConversionReplies: 1Last Post: 27th Apr 2022, 07:02 -
FFMPEG Not Flagging Interlaced Video Properly
By ENunn in forum Video ConversionReplies: 3Last Post: 21st Jan 2021, 12:28 -
FFmpeg, and keyframes in vide files
By 2di in forum Video ConversionReplies: 2Last Post: 31st Jul 2020, 01:36