'Interlace Detection' & 'Interlace'

General questions or discussion about HandBrake, Video and/or audio transcoding, trends etc.
markfilipak
Regular User
Posts: 116
Joined: Thu Aug 01, 2019 8:58 pm

'Interlace Detection' & 'Interlace'

Post by markfilipak » Tue Sep 10, 2019 9:19 pm

I'm trying to confirm how these controls work.

If _/Filters\_ 'Deinterlace'=='Off', does 'Interlace Detection'=='Default' actually do anything? Conversely,
is _/Filters\_ 'Deinterlace' ignored when 'Interlace Detection'=='Off'?

I think these two controls are working in tandem, but I can't be sure. If 'Interlace Detection'=='Off' disables 'Deinterlace', then why show the 'Deinterlace' drop-down at all? Or am I missing something?

What I expected (based on my notion of the intended logic):
_/Filters\_ 'Deinterlace'=='Off', 'Deinterlace' drop-down hidden
_/Filters\_ 'Deinterlace'!='Off', 'Deinterlace' drop-down visible

Thanks for HandBrake, and Thanks for Clarification.
- Mark.

mduell
Veteran User
Posts: 6670
Joined: Sat Apr 21, 2007 8:54 pm

Re: 'Interlace Detection' & 'Interlace'

Post by mduell » Tue Sep 10, 2019 9:20 pm

Without interlace detection, all frames are deinterlaced.

markfilipak
Regular User
Posts: 116
Joined: Thu Aug 01, 2019 8:58 pm

Re: 'Interlace Detection' & 'Interlace'

Post by markfilipak » Tue Sep 10, 2019 9:46 pm

mduell wrote:
Tue Sep 10, 2019 9:20 pm
Without interlace detection, all frames are deinterlaced.
Did you mean to write: "Without interlace detection, all frames are not deinterlaced"?

User avatar
JohnAStebbins
HandBrake Team
Posts: 5442
Joined: Sat Feb 09, 2008 7:21 pm

Re: 'Interlace Detection' & 'Interlace'

Post by JohnAStebbins » Tue Sep 10, 2019 10:21 pm

markfilipak wrote:
Tue Sep 10, 2019 9:46 pm
mduell wrote:
Tue Sep 10, 2019 9:20 pm
Without interlace detection, all frames are deinterlaced.
Did you mean to write: "Without interlace detection, all frames are not deinterlaced"?
If interlaced detection filter is not enabled and deinterlace filter is enabled, the deinterlace filter is applied to all frames.
if interlaced detection filter is enabled and deinterlace filter is enabled, the deinterlace filter is only applied to frames where interlacing was detected.
If interlaced detection filter is enabled and deinterlace filter is not enabled, your burning cpu cycles and generating some interesting log output :mrgreen:

Deinterlacing a non-interlaced frame degrades quality so generally, you don't want to do that. But it's faster to just deinterlace every frame if you know your source is interlaced.

mduell
Veteran User
Posts: 6670
Joined: Sat Apr 21, 2007 8:54 pm

Re: 'Interlace Detection' & 'Interlace'

Post by mduell » Tue Sep 10, 2019 10:44 pm

markfilipak wrote:
Tue Sep 10, 2019 9:46 pm
mduell wrote:
Tue Sep 10, 2019 9:20 pm
Without interlace detection, all frames are deinterlaced.
Did you mean to write: "Without interlace detection, all frames are not deinterlaced"?
No, if you have deinterlace default without interlace detection, all frames are deinterlaced.

markfilipak
Regular User
Posts: 116
Joined: Thu Aug 01, 2019 8:58 pm

Re: 'Interlace Detection' & 'Interlace'

Post by markfilipak » Tue Sep 10, 2019 11:09 pm

Thanks John!
JohnAStebbins wrote:
Tue Sep 10, 2019 10:21 pm
markfilipak wrote:
Tue Sep 10, 2019 9:46 pm
mduell wrote:
Tue Sep 10, 2019 9:20 pm
Without interlace detection, all frames are deinterlaced.
Did you mean to write: "Without interlace detection, all frames are not deinterlaced"?
If interlaced detection filter is not enabled and deinterlace filter is enabled, the deinterlace filter is applied to all frames.
I would never do that. If 'Interlace Detection' is reliable, why would anyone ever turn it off? (This is a sincere question.) Why does the control even exist? (Also see code block below.)
If interlaced detection filter is enabled and deinterlace filter is not enabled, your burning cpu cycles and generating some interesting log output :mrgreen:
Well, because I interpreted 'Interlace Detection' as an enabling control, that's exactly what I've been doing.
I wish that Bradley was open to documenting the controls. I can't understand how such a complex application can get along without documenting the GUI. I'm willing to help, but Bradley's rather emphatic.
Deinterlacing a non-interlaced frame degrades quality ...
Man, that sure is right!
... so generally, you don't want to do that. But it's faster to just deinterlace every frame if you know your source is interlaced.
I use ffprobe to test it in advance. Here's what I've written in my documentation:

Code: Select all

Notes:
[1] Using MKV's 'I' control key
[2] ffprobe -i x:\VIDEO_TS\VTS_xx_x.VOB -select_streams v:0 -show_frames -of flat|FINDSTR /R "interlaced_frame top_field_first repeat_pict"


----- Progressive Frames -----

MPV [1] shows this: "FPS: 23.976 (specified) 23.976 (estimated)"
                          |__________________|
                          Note: Both are 23.976

FFPROBE [2] shows this: ...interlaced_frame=0             <--- Note that interlaced_frame is false
                        ...top_field_first=0
                        ...repeat_pict=0                  <--- Note that repeat_pict is always false
                        (more identical blocks...)


----- Hard Telecine -----

MPV [1] shows this: "FPS: 29.970 (specified) 29.970 (estimated)"
                          |__________________|
                          Note: Both are 29.970

FFPROBE [2] shows this: ...interlaced_frame=1             <--- Note that interlaced_frame is true
                        ...top_field_first=1 (or =0)
                        ...repeat_pict=0
                        (more identical blocks...)


----- Soft Telecine -----

MPV [1] shows this: "FPS: 29.970 (specified) 23.976 (estimated)"
                          |__________________|
                          Note: Differing values
                                                          _________________________ Note the patterns _________________________
                                                                              +-+
FFPROBE [2] shows this: ...interlaced_frame=0             ...interlaced_frame=¦0¦                      +-+
                        ...top_field_first=1              ...top_field_first  ¦ ¦   ...top_field_first=¦1¦                  +-+
                        ...repeat_pict=0                  ...repeat_pict      ¦ ¦   ...repeat_pict     ¦ ¦   ...repeat_pict=¦0¦
                        ...interlaced_frame=0             ...interlaced_frame=¦0¦                      ¦ ¦                  ¦ ¦
                        ...top_field_first=1              ...top_field_first  ¦ ¦   ...top_field_first=¦1¦                  ¦ ¦
                        ...repeat_pict=1                  ...repeat_pict      ¦ ¦   ...repeat_pict     ¦ ¦   ...repeat_pict=¦1¦
                        ...interlaced_frame=0             ...interlaced_frame=¦0¦                      ¦ ¦                  ¦ ¦
                        ...top_field_first=0              ...top_field_first  ¦ ¦   ...top_field_first=¦0¦                  ¦ ¦
                        ...repeat_pict=0                  ...repeat_pict      ¦ ¦   ...repeat_pict     ¦ ¦   ...repeat_pict=¦0¦
                        ...interlaced_frame=0             ...interlaced_frame=¦0¦                      ¦ ¦                  ¦ ¦
                        ...top_field_first=0              ...top_field_first  +-+   ...top_field_first=¦0¦                  ¦ ¦
                        ...repeat_pict=1                  ...repeat_pict            ...repeat_pict     +-+   ...repeat_pict=¦1¦
                        (more identical blocks...)                                                                          +-+
I've even written a script

Code: Select all

CMD /K ffprobe -i %1 -select_streams v:0 -show_frames -of flat|FINDSTR /R "interlaced_frame top_field_first repeat_pict"
and put a link to it in the "Send to" context menu for convenient launching from a file browser.

markfilipak
Regular User
Posts: 116
Joined: Thu Aug 01, 2019 8:58 pm

Re: 'Interlace Detection' & 'Interlace'

Post by markfilipak » Tue Sep 10, 2019 11:25 pm

JohnAStebbins wrote:
Tue Sep 10, 2019 10:21 pm
... If interlaced detection filter is enabled and deinterlace filter is not enabled, your burning cpu cycles and generating some interesting log output :mrgreen:
What is the "interesting" log output? (I ask in order to understand the log better.)

Code: Select all

HandBrake 1.2.2 (2019022300)
OS: Microsoft Windows NT 10.0.17134.0
CPU: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
Ram: 32649 MB, 
GPU Information:
  Intel(R) HD Graphics 530 - 20.19.15.4352
  NVIDIA GeForce GTX 980M   - 10.18.13.5900
Screen: 3840x2160
Temp Dir: C:\Users\Administrator\AppData\Local\Temp\
Install Dir: C:\Program Files\HandBrake
Data Dir: C:\Users\Administrator\AppData\Roaming\HandBrake

-------------------------------------------


# Starting Encode ...

[15:33:11] hb_init: starting libhb thread
[15:33:11] 1 job(s) to process
[15:33:11] json job:
{
  "Audio": {
    "AudioList": [
      {
        "DRC": 0.0,
        "Encoder": "copy",
        "Gain": 0.0,
        "Mixdown": -1,
        "NormalizeMixLevel": false,
        "Samplerate": 48000,
        "Track": 0,
        "DitherMethod": 0
      },
      {
        "DRC": 0.0,
        "Encoder": "copy",
        "Gain": 0.0,
        "Mixdown": -1,
        "NormalizeMixLevel": false,
        "Samplerate": 48000,
        "Track": 1,
        "DitherMethod": 0
      }
    ],
    "CopyMask": [
      "copy:aac",
      "copy:ac3",
      "copy:dtshd",
      "copy:dts",
      "copy:eac3",
      "copy:flac",
      "copy:mp3",
      "copy:truehd"
    ],
    "FallbackEncoder": "ac3"
  },
  "Destination": {
    "ChapterList": [
      {
        "Name": "Chapter 1"
      },
      {
        "Name": "Chapter 2"
      }
    ],
    "ChapterMarkers": true,
    "AlignAVStart": false,
    "File": "w:\\=Movies1=\\RESCUE DAWN [2006]\\SPECIAL FEATURES\\Deleted Scenes\\An Attempt at Reflection i30-to-p24 D.D.O.O.O 18.Q .mkv",
    "Mp4Options": {
      "IpodAtom": false,
      "Mp4Optimize": false
    },
    "Mux": "mkv"
  },
  "Filters": {
    "FilterList": [
      {
        "ID": 2,
        "Settings": {}
      },
      {
        "ID": 11,
        "Settings": {
          "crop-bottom": "0",
          "crop-left": "0",
          "crop-right": "0",
          "crop-top": "0",
          "height": "480",
          "width": "720"
        }
      },
      {
        "ID": 6,
        "Settings": {
          "mode": "1",
          "rate": "27000000/1126125"
        }
      }
    ]
  },
  "PAR": {
    "Num": 8,
    "Den": 9
  },
  "Metadata": {},
  "SequenceID": 0,
  "Source": {
    "Angle": 1,
    "Range": {
      "Type": "chapter",
      "Start": 1,
      "End": 2
    },
    "Title": 20,
    "Path": "B:\\"
  },
  "Subtitle": {
    "Search": {
      "Burn": false,
      "Default": false,
      "Enable": true,
      "Forced": true
    },
    "SubtitleList": []
  },
  "Video": {
    "Encoder": "qsv_h265",
    "Level": "auto",
    "TwoPass": false,
    "Turbo": false,
    "ColorMatrixCode": 0,
    "Options": "",
    "Preset": "quality",
    "Profile": "auto",
    "Quality": 18.0,
    "QSV": {
      "Decode": true,
      "AsyncDepth": 0
    }
  }
}
[15:33:11] CPU: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
[15:33:11]  - Intel microarchitecture Skylake
[15:33:11]  - logical processor count: 8
[15:33:11] Intel Quick Sync Video support: yes
[15:33:11]  - Intel Media SDK hardware: API 1.17 (minimum: 1.3)
[15:33:11]  - H.264 encoder: yes
[15:33:11]     - preferred implementation: hardware (any) via D3D11
[15:33:11]     - capabilities (hardware):  breftype icq+la+i+downs vsinfo opt1 opt2+mbbrc+extbrc+trellis+ib_adapt+nmpslice
[15:33:11]  - H.265 encoder: yes (8bit: yes, 10bit: no)
[15:33:11]     - preferred implementation: hardware (any) via D3D11
[15:33:11]     - capabilities (hardware):  bpyramid icq vsinfo opt1
[15:33:11] hb_scan: path=B:\, title_index=20
[15:33:11] scan: BD has 40 title(s)
[15:33:11] bd: scanning title 20
[15:33:11] bd: playlist 00035.MPLS
[15:33:11] bd: duration is 00:00:45 (45979 ms)
[15:33:11] bd: video id=0x1011, stream type=MPEG2, format 480i
[15:33:11] bd: aspect = 4:3
[15:33:11] bd: audio id=0x1100, lang=English (AC3), 3cc=eng
[15:33:11] bd: audio id=0x1101, lang=English (AC3), 3cc=eng
[15:33:11] bd: chap 1 packet=768, 45779 ms
[15:33:11] bd: chap 2 packet=45537408, 200 ms
[15:33:11] bd: title 20 has 2 chapters
[15:33:11] scan: decoding previews for title 20
[15:33:11] scan: title angle(s) 1
[15:33:11] scan: audio 0x1100: ac3, rate=48000Hz, bitrate=224000 English (AC3) (2.0 ch)
[15:33:11] scan: audio 0x1101: ac3, rate=48000Hz, bitrate=224000 English (AC3) (2.0 ch)
[15:33:12] scan: 10 previews, 720x480, 29.970 fps, autocrop = 2/24/0/2, aspect 4:3, PAR 8:9
[15:33:12] stream: 6 good frames, 0 errors (0%)
[15:33:12] libhb: scan thread found 1 valid title(s)
[15:33:12] Skipping subtitle scan.  No suitable subtitle tracks.
[15:33:12] starting job
[15:33:12] Auto Passthru: allowed codecs are AAC, AC3, E-AC3, TrueHD, DTS, DTS-HD, MP3, FLAC
[15:33:12] Auto Passthru: fallback is AC3
[15:33:12] Auto Passthru: using AC3 Passthru for track 1
[15:33:12] Auto Passthru: using AC3 Passthru for track 2
[15:33:12] job configuration:
[15:33:12]  * source
[15:33:12]    + B:\
[15:33:12]    + title 20, chapter(s) 1 to 2
[15:33:12]  * destination
[15:33:12]    + w:\=Movies1=\RESCUE DAWN [2006]\SPECIAL FEATURES\Deleted Scenes\An Attempt at Reflection i30-to-p24 D.D.O.O.O 18.Q .mkv
[15:33:12]    + container: Matroska (libavformat)
[15:33:12]      + chapter markers
[15:33:12]  * video track
[15:33:12]    + decoder: mpeg2video
[15:33:12]      + bitrate 200 kbps
[15:33:12]    + filters
[15:33:12]      + Detelecine (pullup) ()
[15:33:12]      + Framerate Shaper (mode=1:rate=27000000/1126125)
[15:33:12]        + frame rate: 29.970 fps -> constant 23.976 fps
[15:33:12]      + Crop and Scale (width=720:height=480:crop-top=0:crop-bottom=0:crop-left=0:crop-right=0)
[15:33:12]        + source: 720 * 480, crop (0/0/0/0): 720 * 480, scale: 720 * 480
[15:33:12]    + Output geometry
[15:33:12]      + storage dimensions: 720 x 480
[15:33:12]      + pixel aspect ratio: 8 : 9
[15:33:12]      + display dimensions: 640 x 480
[15:33:12]    + encoder: H.265 (Intel Media SDK)
[15:33:12]      + preset:  quality
[15:33:12]      + profile: auto
[15:33:12]      + level:   auto
[15:33:12]      + quality: 18.00 (ICQ)
[15:33:12]      + color profile: 6-1-6
[15:33:12]  * audio track 1
[15:33:12]    + decoder: English (AC3) (2.0 ch) (track 1, id 0x1100)
[15:33:12]      + bitrate: 224 kbps, samplerate: 48000 Hz
[15:33:12]    + AC3 Passthru
[15:33:12]  * audio track 2
[15:33:12]    + decoder: English (AC3) (2.0 ch) (track 2, id 0x1101)
[15:33:12]      + bitrate: 224 kbps, samplerate: 48000 Hz
[15:33:12]    + AC3 Passthru
[15:33:12] sync: expecting 1378 video frames
[15:33:12] encqsvInit: using encode-only path
[15:33:12] encqsvInit: H.265/HEVC Main profile @ level 3.0
[15:33:12] encqsvInit: TargetUsage 1 AsyncDepth 5
[15:33:12] encqsvInit: GopRefDist 3 GopPicSize 24 NumRefFrame 4
[15:33:12] encqsvInit: BFramesMax 2 BRefType off
[15:33:12] encqsvInit: RateControlMethod ICQ ICQQuality 18
[15:33:12] sync: first pts video is 0
[15:33:12] sync: "Chapter 1" (1) at frame 1 time 0
[15:33:12] sync: first pts audio 0x1100 is 0
[15:33:12] sync: first pts audio 0x1101 is 0
[15:33:12] qsv_enc_init: using 'hardware (1) via D3D11' implementation, API: 1.17
[15:33:12] encqsv: BPyramid off not respected (delay: 1)
[15:33:25] bd: End of title
[15:33:25] reader: done. 1 scr changes
[15:33:26] work: average encoding speed for job is 97.513901 fps
[15:33:26] vfr: 1103 frames output, 21 dropped and 0 duped for CFR/PFR
[15:33:26] vfr: lost time: 762762 (0 frames)
[15:33:26] vfr: gained time: 762762 (1016 frames) (0 not accounted for)
[15:33:27] stream: 1378 good frames, 0 errors (0%)
[15:33:27] ac3-decoder done: 1437 frames, 0 decoder errors
[15:33:27] ac3-decoder done: 1437 frames, 0 decoder errors
[15:33:27] mpeg2video-decoder done: 1378 frames, 0 decoder errors
[15:33:27] sync: got 1378 frames, 1378 expected
[15:33:27] sync: framerate min 29.970 fps, max 29.970 fps, avg 29.970 fps
[15:33:27] mux: track 0, 1103 frames, 23293047 bytes, 4050.59 kbps, fifo 1024
[15:33:27] mux: track 1, 1437 frames, 1287552 bytes, 223.90 kbps, fifo 1024
[15:33:27] mux: track 2, 1437 frames, 1287552 bytes, 223.90 kbps, fifo 1024
[15:33:27] libhb: work result = 0

# Encode Completed ...

User avatar
Rodeo
HandBrake Team
Posts: 12195
Joined: Tue Mar 03, 2009 8:55 pm

Re: 'Interlace Detection' & 'Interlace'

Post by Rodeo » Tue Sep 10, 2019 11:33 pm

Interlace detection is off in your log. Probably the Windows GUI sanitized it for you.

mduell
Veteran User
Posts: 6670
Joined: Sat Apr 21, 2007 8:54 pm

Re: 'Interlace Detection' & 'Interlace'

Post by mduell » Tue Sep 10, 2019 11:35 pm

markfilipak wrote:
Tue Sep 10, 2019 11:09 pm
markfilipak wrote:
Tue Sep 10, 2019 9:46 pm
mduell wrote:
Tue Sep 10, 2019 9:20 pm
Without interlace detection, all frames are deinterlaced.
Did you mean to write: "Without interlace detection, all frames are not deinterlaced"?
If interlaced detection filter is not enabled and deinterlace filter is enabled, the deinterlace filter is applied to all frames.
I would never do that. If 'Interlace Detection' is reliable, why would anyone ever turn it off? (This is a sincere question.) Why does the control even exist? (Also see code block below.)
It's not perfect, in either direction.

For the rest, if there's no interlacing artifacts (combing), you're better off not deinterlacing even if the source is encoded interlaced.
markfilipak wrote:
Tue Sep 10, 2019 11:09 pm
I wish that Bradley was open to documenting the controls. I can't understand how such a complex application can get along without documenting the GUI. I'm willing to help, but Bradley's rather emphatic.
The GUI is just angry spaghetti, if you can use a CLI skip right past it. The sensible interface (CLI) is reasonably documented.
Last edited by mduell on Tue Sep 10, 2019 11:40 pm, edited 1 time in total.

markfilipak
Regular User
Posts: 116
Joined: Thu Aug 01, 2019 8:58 pm

Re: 'Interlace Detection' & 'Interlace'

Post by markfilipak » Tue Sep 10, 2019 11:39 pm

CLI's generally don't get invited to the dance.

User avatar
Rodeo
HandBrake Team
Posts: 12195
Joined: Tue Mar 03, 2009 8:55 pm

Re: 'Interlace Detection' & 'Interlace'

Post by Rodeo » Tue Sep 10, 2019 11:40 pm

GUI hasn't been angry for a while. Got upgraded to fresh, calm and reasonably happy pasta.

markfilipak
Regular User
Posts: 116
Joined: Thu Aug 01, 2019 8:58 pm

Re: 'Interlace Detection' & 'Interlace'

Post by markfilipak » Tue Sep 10, 2019 11:49 pm

Rodeo wrote:
Tue Sep 10, 2019 11:33 pm
Interlace detection is off in your log. Probably the Windows GUI sanitized it for you.
Ooops! I appologize. I've been making dozens of presets and logs (with preset name attached to the MKV file name), so I've apparently gotten a little mixed up.

As I become more familiar with the GUI settings, I'm having to redo past work :(
In only the last few minutes I've discovered that all my presets have 'Dimensions:' set to 'Always use Source' whereas I really want 'None' (in order to make the preset general), but dimensions can only be set in the 'Add Preset' dialog, so I have to redo and re-export all my presets.

mduell
Veteran User
Posts: 6670
Joined: Sat Apr 21, 2007 8:54 pm

Re: 'Interlace Detection' & 'Interlace'

Post by mduell » Tue Sep 10, 2019 11:59 pm

Yet another reason to use the CLI.

markfilipak
Regular User
Posts: 116
Joined: Thu Aug 01, 2019 8:58 pm

Re: 'Interlace Detection' & 'Interlace'

Post by markfilipak » Wed Sep 11, 2019 2:23 am

JohnAStebbins wrote:
Tue Sep 10, 2019 10:21 pm
... If interlaced detection filter is enabled and deinterlace filter is not enabled, your burning cpu cycles and generating some interesting log output :mrgreen:
Well, boys & girls, I did a test using a 46 second deleted scene from a BD.

Preset: 'i30-to-p24 D.O.O.O.O 18.Q' has 'Detelecine' but not 'Interlace Detection'
Preset: 'i30-to-p24 D.D.O.O.O 18.Q' has both 'Detelecine' & 'Interlace Detection'

There's no difference in the logs or in the videos. And the 'Detelecine'-only actually took longer (15 seconds as opposed to 12 seconds for 'Detelecine' & 'Interlace Detection').

User avatar
JohnAStebbins
HandBrake Team
Posts: 5442
Joined: Sat Feb 09, 2008 7:21 pm

Re: 'Interlace Detection' & 'Interlace'

Post by JohnAStebbins » Wed Sep 11, 2019 5:30 pm

Umm, detelecine isn't deinterlace

markfilipak
Regular User
Posts: 116
Joined: Thu Aug 01, 2019 8:58 pm

Re: 'Interlace Detection' & 'Interlace'

Post by markfilipak » Thu Sep 12, 2019 12:44 am

JohnAStebbins wrote:
Wed Sep 11, 2019 5:30 pm
Umm, detelecine isn't deinterlace
Well... actually... it is, in a way. p24 is not interlaced whereas i30 is interlaced, so in a sense, detelecine is deinterlace. Now, p30 isn't interlaced, so going from p30 to p24 would be detelecine without deinterlace. But p30 is so rare...

I guess what I'm trying to say is that selecting detelecine makes the deinterlace setting moot. That by turning on detelecine, the deinterlace control might as well disappear. In fact, making deinterlace a modal control would be a logical thing to do.

mduell
Veteran User
Posts: 6670
Joined: Sat Apr 21, 2007 8:54 pm

Re: 'Interlace Detection' & 'Interlace'

Post by mduell » Thu Sep 12, 2019 1:07 am

No, no it's not. Mixed content exists.

markfilipak
Regular User
Posts: 116
Joined: Thu Aug 01, 2019 8:58 pm

Re: 'Interlace Detection' & 'Interlace'

Post by markfilipak » Thu Sep 12, 2019 4:29 am

Sure mixed content exists. I have some that's a mix of i30-telecast that's made with an NTSC broadcast camera interspersed with p24-telecined movie clips. Since it can't be reduced to p24 without ruining the telecast portions, I don't even try to detelecine it or run a test case. Since I don't detelecine it, mixed content doesn't enter into my comment that, if a user selects 'Detelecine', interlace (and deinterlace) is moot. I think that HandBrake should make intelligent decisions like voiding 'Deinterlace' when 'Detelecine' is selected. To do otherwise unnecessarily confuses users into thinking that they're not related (which they are, but we can agree to disagree).

The logic is: if (!detelecine) showDeinterlace(); else hideDeinterlace();
or (the way I code): void detelecine ? hideDeinterlace() : showDeinterlace();

mduell
Veteran User
Posts: 6670
Joined: Sat Apr 21, 2007 8:54 pm

Re: 'Interlace Detection' & 'Interlace'

Post by mduell » Thu Sep 12, 2019 3:45 pm

Deinterlace is absolutely not moot when you have detelecine on, because content can be a mix of telecined and interlaced. And you may as well decomb because there can be some clean frames in there too.

User avatar
JohnAStebbins
HandBrake Team
Posts: 5442
Joined: Sat Feb 09, 2008 7:21 pm

Re: 'Interlace Detection' & 'Interlace'

Post by JohnAStebbins » Thu Sep 12, 2019 4:38 pm

Well... actually... it is, in a way. p24 is not interlaced whereas i30 is interlaced, so in a sense, detelecine is deinterlace.
You are conflating multiple terms.

detelecine and deinterlace are algorithms.
interlacing and telecine are picture formats that both use interleaved fields.

The detelecine algorithm reverses hard telecine without loss of picture quality
The deinterlace algorithm removes combing artefacts and results in loss of picture quality

If you apply the detelecine algorithm to interlaced content, the output will still be interlaced content. i.e. it does mostly nothing.
If you apply the deinterlace algorithm to telecined content, the output will be lower quality and you will lose the original progressive frames and framerate. motion will not be smooth.

HandBrake allows you to enable both detelecine and deinterlace with interlace detection at the same time because it allows you to construct a "set it and forget it" filter chain that can be applied to most sources. The detelecine filter is run first. If the frame is progressive or interlaced, the filter doesn't affect the frame. If the frame is telecined, the filter reverses the telecine to output a progressive frame. interlace detection is run next. If the original frame was telecined or progressive, the detection filter will not detect interlacing and the deinterlace filter will do nothing. If the original frame was interlaced, the detelecine filter left it untouched, it will be detected as interlaced and the deinterlace filter will be applied to the frame.

markfilipak
Regular User
Posts: 116
Joined: Thu Aug 01, 2019 8:58 pm

Re: 'Interlace Detection' & 'Interlace'

Post by markfilipak » Thu Sep 12, 2019 11:55 pm

JohnAStebbins wrote:
Thu Sep 12, 2019 4:38 pm
Well... actually... it is, in a way. p24 is not interlaced whereas i30 is interlaced, so in a sense, detelecine is deinterlace.
You are conflating multiple terms.

detelecine and deinterlace are algorithms.
interlacing and telecine are picture formats that both use interleaved fields.

The detelecine algorithm reverses hard telecine without loss of picture quality
The deinterlace algorithm removes combing artefacts and results in loss of picture quality

If you apply the detelecine algorithm to interlaced content, the output will still be interlaced content. i.e. it does mostly nothing.
"Mostly nothing"? Correct me if I'm wrong. Detelecine generates p24 output from p30-telecine source and i24 output from i30-telecine source -- or in the nomenclature of ffmpeg filter stacks, detelecine is 'fieldmatch' followed by 'decimate'.

Comment: No offense intended -- your help is invaluable -- but if users are actually going to be helped, helpers need to employ precise language, such as "p30-telecine" & "i30-telecine", to characterize streams, otherwise, their explanations seem vague ...I reiterate, no offense intended. If such precise nomenclature doesn't exist, it needs to be created.

Code: Select all

                i30 = [A][a][B][b][C][c][D][d][E][e]   ...out of an NTSC camera
         i30-bottom = [a][A][b][B][c][C][d][D][e][E]   ...probably not found in the wild
                p30 = [A/a][B/b][C/c][D/d][E/e]
       i30-telecine = [A][a][B][b][B][c][C][d][D][d]   ...telecined from p24 movie film samples
i30-telecine-bottom = [a][A][b][B][b][C][c][D][d][D]   ...no sane video engineer would do this
       p30-telecine = [A/a][B/b][B/c][C/d][D/d]
       p30-telecine = [A/a][B/b][C/b][C/d][D/d]
                p24 = [A/a][B/b][C/c][D/d]
At this point I should probably point out that the 'i30-telecine' above is via 2-3-2-3 pull-down. There's also 2-3-3-2 pull-down but I don't think that's ever actually done since it causes 6Hz judder.
If you apply the deinterlace algorithm to telecined content, the output will be lower quality and you will lose the original progressive frames and framerate. motion will not be smooth.
Okay, let's see. Starting with i30-telecine...

Code: Select all

[A][a][B][b][B][c][C][d][D][d] --deinterlace--> [A/a][B/b][B/c][C/d][D/d]
... we get p30-telecine.
I don't see that anything's been lost and aside from some slight combing caused by the temporal proximity of [B/_][_/d], I don't see that motion will be affected (that is, beyond the 2-3-2-3 cadence that's inherent in telecine that lacks interfield blending). Now, if the p30-telecine is then detelecined...

Code: Select all

[A/a][B/b][B/c][C/d][D/d] --fieldmatch--> [A/a][B/b][B/b][C/c][D/d] --decimation --> [A/a][B/b][C/c][D/d]
The total process is

Code: Select all

[A][a][B][b][B][c][C][d][D][d] --deinterlace--> [A/a][B/b][B/c][C/d][D/d] --fieldmatch--> [A/a][B/b][B/b][C/c][D/d] --decimation --> [A/a][B/b][C/c][D/d]
What's not to like?

Now suppose the processing order is changed to

Code: Select all

[A][a][B][b][B][c][C][d][D][d] --fieldmatch--> [A][a][B][b][B][b][C][c][D][d] --deinterlace--> [A/a][B/b][B/b][C/c][D/d] --decimation --> [A/a][B/b][C/c][D/d]
I don't see any problem there, either.

Now suppose the processing order is changed to

Code: Select all

[A][a][B][b][B][c][C][d][D][d] --fieldmatch--> [A][a][B][b][B][b][C][c][D][d] --decimation --> [A][a][B][b][C][c][D][d] --deinterlace--> [A/a][B/b][C/c][D/d]
The above assumes that decimation works on fields as it works on frames (and that's not at all clear), but I see no problem here, either.

(Repeating the above starting with i30-telecine-bottom instead of starting with i30-telecine is left up to the reader.)

Note that the author of http://ffmpeg.org/ffmpeg-filters.html#toc-p_002fc_002fn calls using the complimentary field, "parity", but it's not parity of course ...that's just ad hoc terminology. (More ad hoc terms: "top" instead of "odd", "bottom" instead of "even", "filter" instead of "process" -- many of the so-called filters go way beyond simply filtering, example: decimate is a filter but deinterlace is a process -- and "graph" instead of "stack" or "fifo" ...but I'm sure we disagree ...no matter ...I can translate in my head.)
HandBrake allows you to enable both detelecine and deinterlace with interlace detection at the same time because it allows you to construct a "set it and forget it" filter chain that can be applied to most sources. The detelecine filter is run first. If the frame is progressive or interlaced, the filter doesn't affect the frame. If the frame is telecined, the filter reverses the telecine to output a progressive frame. interlace detection is run next. If the original frame was telecined or progressive, the detection filter will not detect interlacing and the deinterlace filter will do nothing. If the original frame was interlaced, the detelecine filter left it untouched, it will be detected as interlaced and the deinterlace filter will be applied to the frame.
I like my diagrams better than your textual explanation ...no offense intended. At this point you may think: "This Mark Filipak fellow is on to something", or you may think: "This Mark Filipak fellow is a crackpot". It's your choice.

User avatar
JohnAStebbins
HandBrake Team
Posts: 5442
Joined: Sat Feb 09, 2008 7:21 pm

Re: 'Interlace Detection' & 'Interlace'

Post by JohnAStebbins » Fri Sep 13, 2019 12:06 am

Detelecine generates p24 output from p30-telecine source and i24 output from i30-telecine source
I don't have the time right now to read your entire post. But no and no. Detelecine works with one and only one type of source material and that is i30. If that source is telecined content, it converts it to p24. And that's all it does.

markfilipak
Regular User
Posts: 116
Joined: Thu Aug 01, 2019 8:58 pm

Re: 'Interlace Detection' & 'Interlace'

Post by markfilipak » Fri Sep 13, 2019 1:03 am

When you have time, John, I'd value your opinion of my notation.

So, detelecine (i.e., fieldmatch+decimate) don't work with p30 sources, eh? That's good to know.

User avatar
JohnAStebbins
HandBrake Team
Posts: 5442
Joined: Sat Feb 09, 2008 7:21 pm

Re: 'Interlace Detection' & 'Interlace'

Post by JohnAStebbins » Fri Sep 13, 2019 7:48 pm

So, detelecine (i.e., fieldmatch+decimate) don't work with p30 sources, eh?
Correct. But HandBrake has another filter that is always enabled whenever doing constant framerate encoding. It selectively discards frames with the least measured change when converting from a higher framerate to a lower framerate. So if you have progressive video that has been converted to a higher framerate by duplicating frames, you can convert it back to the original lower framerate simply by setting the appropriate constant framerate setting.

markfilipak
Regular User
Posts: 116
Joined: Thu Aug 01, 2019 8:58 pm

Re: 'Interlace Detection' & 'Interlace'

Post by markfilipak » Sat Sep 14, 2019 12:24 am

Hey, John,

p30-telecine is rare -- I've only run across one -- but if the need arises and the source is known to originate from 24fps, how can I convert it to p24? I assume I would need to split fields to i30 first. Is that best done by directly invoking ffmpeg? Would I need to do the whole p30-telecine --> i30-telecine --> p24 via ffmpeg or is there a way to do a 2-stage process like that with HB?

Locked