VideoHelp Forum




+ Reply to Thread
Results 1 to 9 of 9
  1. 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:

    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
    But when I use some real media the decision is not that clear:

    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
    When should I use single frame vs. multi frame for decision making?
    What are reasonable ratios to use for decision making?
    Are there other sources of code I can refer to that use idet?
    Quote Quote  
  2. 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.
    Quote Quote  
  3. I am not aware of any reliable 'automatic' tool which meets that purpose.
    I agree with Sharc.
    I am trying to make a reasonable decision
    => look at the separate fields or the bobbed frames and look at the patterns,..

    Cu Selur
    users currently on my ignore list: deadrats, Stears555, marcorocchini
    Quote Quote  
  4. Thank you for your input, would still like to know how to use idet results, even if suboptimal.
    Quote Quote  
  5. 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?
    Assuming you have non-mixed content, looking ad 'multi frame' counts should be more robust.

    => 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 Selur
    users currently on my ignore list: deadrats, Stears555, marcorocchini
    Quote Quote  
  6. Originally Posted by Selur View Post
    Side note: years ago, I tried something similar with mplayer, but it didn't really turn out to be great.
    Nice, thank you.
    Quote Quote  
  7. 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.
    Quote Quote  
  8. 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
    (after deinterlacing and assuming tff)
    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
    (after deinterlacing and assuming bff)
    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
    and a tff source:
    (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
    (after deinterlacing and assuming tff)
    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
    (after deinterlacing and assuming bff)
    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
    and a hard telecined source:
    (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
    (after deinterlacing and assuming tff)
    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:
    (after deinterlacing and assuming bff)
    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
    and a sof telecined source:
    (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
    (after deinterlacing and assuming tff)
    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
    (after deinterlacing and assuming bff)
    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 thresholds
    users currently on my ignore list: deadrats, Stears555, marcorocchini
    Quote Quote  
  9. Originally Posted by Selur View Post
    => don't see how these outputs can be reliable with the defaults, so one probably will have to play with the thresholds
    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).
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!