Switching Field Order with Decomb Bob

General questions or discussion about HandBrake, Video and/or audio transcoding, trends etc.
Post Reply
giddie
Posts: 3
Joined: Thu Jan 04, 2018 10:11 am

Switching Field Order with Decomb Bob

Post by giddie » Thu Jan 04, 2018 10:22 am

I'm on Linux (though I suspect it's not relevant), and wondering if anyone else is encountering this:

Using the following filters:

Detelecine: Default
Interlace Detection: Default
Deinterlace: Decomb
Deinterlace Preset: Bob

I find that Handbrake often detects the field order incorrectly, which results in deinterlaced video with frequent sections where every pair of frames is reversed. It's hard to spot a solid pattern to this: sometimes the field ordering seems to switch mid-shot. I tend to use auto-detection on sources with a mix of progressive and interlaced content, but isn't the auto-detection algorithm designed for precisely this kind of situation?

Has anyone else come across this? Is there something that can be done to mitigate it?

rollin_eng
Veteran User
Posts: 2848
Joined: Wed May 04, 2011 11:06 pm

Re: Switching Field Order with Decomb Bob

Post by rollin_eng » Thu Jan 04, 2018 1:26 pm

Could you please post your logs, instructions can be found here:

https://handbrake.fr/docs/en/latest/hel ... y-log.html

giddie
Posts: 3
Joined: Thu Jan 04, 2018 10:11 am

Re: Switching Field Order with Decomb Bob

Post by giddie » Thu Jan 04, 2018 4:42 pm

Here's an example. After experimentation, I've discovered that it's the detelecine filter that is causing this. This encode had "Interlace Detection: Off", and still experiences the same field order issue. My understanding is that the detelecine filter should "do the right thing" when no pulldown is present?

Code: Select all

Handbrake Version: 1.0.7 (2017041000)
[11:07:34] gtkgui: Modified Custom Preset:
[11:07:34] 1 job(s) to process
[11:07:34] json job:
{
    "Audio": {
        "AudioList": [
            {
                "Bitrate": 160,
                "CompressionLevel": -1.0,
                "DRC": 0.0,
                "DitherMethod": "auto",
                "Encoder": "opus",
                "Gain": -0.025641025641021997,
                "Mixdown": "stereo",
                "NormalizeMixLevel": false,
                "PresetEncoder": "opus",
                "Quality": -3.0,
                "Samplerate": "auto",
                "Track": 0
            }
        ],
        "CopyMask": [
            "copy:ac3"
        ],
        "FallbackEncoder": "ac3"
    },
    "Destination": {
        "ChapterList": [
            {
                "Name": ""
            }
        ],
        "ChapterMarkers": false,
        "File": "full-bob-detelecine.mkv",
        "Mp4Options": {
            "IpodAtom": false,
            "Mp4Optimize": false
        },
        "Mux": "mkv"
    },
    "Filters": {
        "FilterList": [
            {
                "ID": 2,
                "Settings": {
                    "plane": "0",
                    "skip-bottom": "4",
                    "skip-left": "1",
                    "skip-right": "1",
                    "skip-top": "4"
                }
            },
            {
                "ID": 4,
                "Settings": {
                    "mode": "23"
                }
            },
            {
                "ID": 6,
                "Settings": {
                    "mode": 0
                }
            },
            {
                "ID": 11,
                "Settings": {
                    "crop-bottom": 4,
                    "crop-left": 0,
                    "crop-right": 0,
                    "crop-top": 4,
                    "height": 568,
                    "width": 720
                }
            }
        ]
    },
    "Metadata": {},
    "PAR": {
        "Den": 15,
        "Num": 16
    },
    "SequenceID": 0,
    "Source": {
        "Angle": 0,
        "Path": "source.mkv",
        "Range": {
            "End": 1,
            "Start": 1,
            "Type": "chapter"
        },
        "Title": 1
    },
    "Subtitle": {
        "Search": {
            "Burn": true,
            "Default": false,
            "Enable": false,
            "Forced": false
        },
        "SubtitleList": [
            {
                "Burn": false,
                "Default": true,
                "Forced": false,
                "Track": 0
            }
        ]
    },
    "Video": {
        "ColorMatrixCode": 0,
        "Encoder": "x264",
        "Level": "auto",
        "OpenCL": false,
        "Options": "",
        "Preset": "medium",
        "Profile": "high",
        "QSV": {
            "AsyncDepth": 4,
            "Decode": false
        },
        "Quality": 22.0,
        "Tune": "",
        "Turbo": false,
        "TwoPass": false
    }
}
[11:07:34] CPU: Intel(R) Core(TM) i5-4570 CPU @ 3.20GHz
[11:07:34]  - Intel microarchitecture Haswell
[11:07:34]  - logical processor count: 4
[11:07:34] hb_scan: path=source.mkv, title_index=1
udfread ERROR: ECMA 167 Volume Recognition failed
disc.c:274: failed opening UDF image source.mkv
disc.c:352: error opening file BDMV/index.bdmv
disc.c:352: error opening file BDMV/BACKUP/index.bdmv
[11:07:34] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 5.0.1
libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.BUP failed
libdvdread: Can't open file VIDEO_TS.IFO.
libdvdnav: vm: failed to read VIDEO_TS.IFO
[11:07:34] dvd: not a dvd - trying as a stream/file instead
Input #0, matroska,webm, from 'source.mkv':
  Duration: 00:02:25.12, start: 0.000000, bitrate: N/A
    Stream #0:0(eng): Video: mpeg2video (Main)
      yuv420p, tv, 720x576 [PAR 16:15 DAR 4:3], 9800 kb/s, PAR 16:15 DAR 4:3
      25 fps, 1k tbn
    Metadata:
      BPS-eng         : 8101159
      DURATION-eng    : 00:02:25.120000000
      NUMBER_OF_FRAMES-eng: 3628
      NUMBER_OF_BYTES-eng: 146955036
      SOURCE_ID-eng   : 0100E0
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.10.8 linux(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-01-04 10:42:24
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
    Stream #0:1(eng): Audio: ac3
      48000 Hz, stereo, fltp, 192 kb/s (default)
    Metadata:
      title           : Stereo
      BPS-eng         : 192000
      DURATION-eng    : 00:02:25.056000000
      NUMBER_OF_FRAMES-eng: 4533
      NUMBER_OF_BYTES-eng: 3481344
      SOURCE_ID-eng   : 0180BD
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.10.8 linux(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-01-04 10:42:24
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
    Stream #0:2(eng): Subtitle: dvd_subtitle (default)
    Metadata:
      BPS-eng         : 9523
      DURATION-eng    : 00:02:03.119466666
      NUMBER_OF_FRAMES-eng: 50
      NUMBER_OF_BYTES-eng: 146568
      SOURCE_ID-eng   : 0120BD
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.10.8 linux(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-01-04 10:42:24
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
[11:07:34] scan: decoding previews for title 1
[11:07:34] scan: audio 0x1: ac3, rate=48000Hz, bitrate=192000 English (AC3) (2.0 ch)
[11:07:34] scan: 10 previews, 720x576, 25.000 fps, autocrop = 4/4/0/0, aspect 4:3, PAR 16:15
[11:07:34] libhb: scan thread found 1 valid title(s)
[11:07:34] starting job
[11:07:34] yadif thread started for segment 0
[11:07:34] yadif thread started for segment 1
[11:07:34] yadif thread started for segment 3
[11:07:34] work: compression level not specified, track 1 setting compression level 10.00
[11:07:34] job configuration:
[11:07:34]  * source
[11:07:34]    + source.mkv
[11:07:34]    + title 1, chapter(s) 1 to 1
[11:07:34]    + container: matroska,webm
[11:07:34]  * destination
[11:07:34]    + full-bob-detelecine.mkv
[11:07:34]    + container: Matroska (libavformat)
[11:07:34]  * video track
[11:07:34]    + decoder: mpeg2video
[11:07:34]      + bitrate 9800 kbps
[11:07:34]    + filters
[11:07:34]      + Detelecine (pullup) (skip-left=1:skip-right=1:skip-top=4:skip-bottom=4:plane=0)
[11:07:34]      + Decomb (mode=23)
[11:07:34]      + Framerate Shaper (mode=0)
[11:07:34]        + frame rate: same as source (around 25.000 fps)
[11:07:34]      + Crop and Scale (width=720:height=568:crop-top=4:crop-bottom=4:crop-left=0:crop-right=0)
[11:07:34]        + source: 720 * 576, crop (4/4/0/0): 720 * 568, scale: 720 * 568
[11:07:34]    + Output geometry
[11:07:34]      + storage dimensions: 720 x 568
[11:07:34]      + pixel aspect ratio: 16 : 15
[11:07:34]      + display dimensions: 768 x 568
[11:07:34]    + encoder: H.264 (libx264)
[11:07:34]      + preset:  medium
[11:07:34]      + profile: high
[11:07:34]      + level:   auto
[11:07:34]      + quality: 22.00 (RF)
[11:07:34]  * subtitle track 1, English (track 0, id 0x2) Picture [VOBSUB] -> Passthrough, Default
[11:07:34]  * audio track 1
[11:07:34]    + decoder: English (AC3) (2.0 ch) (track 1, id 0x1)
[11:07:34]      + bitrate: 192 kbps, samplerate: 48000 Hz
[11:07:34]    + mixdown: Stereo
[11:07:34]    + gain: -0dB
[11:07:34]    + encoder: Opus (libopus)
[11:07:34]      + bitrate: 160 kbps, samplerate: 48000 Hz
[11:07:34]      + compression level: 10.00
[11:07:34] yadif thread started for segment 2
[11:07:34] sync: expecting 3628 video frames
[11:07:34] encx264: encoding at constant RF 22.000000
x264 [info]: using SAR=16/15
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
x264 [info]: profile High, level 3.0
[11:07:34] sync: first pts video is 0
[11:07:34] sync: first pts audio 0x1 is 3600
[11:07:34] sync: Chapter 1 at frame 3 time 10800
[11:07:37] sync: first pts subtitle 0x2 is 464400
[11:09:55] reader: done. 1 scr changes
[11:09:59] work: average encoding speed for job is 25.210737 fps
[11:09:59] decomb: deinterlaced 6238 | blended 0 | unfiltered 0 | total 6238
[11:09:59] vfr: lost time: 1832400 (0 frames)
[11:09:59] vfr: gained time: 1832400 (1972 frames) (0 not accounted for)
[11:09:59] ac3-decoder done: 4533 frames, 0 decoder errors
[11:09:59] mpeg2video-decoder done: 3628 frames, 0 decoder errors
[11:09:59] sync: got 3628 frames, 3628 expected
[11:09:59] sync: framerate min 12.500 fps, max 25.000 fps, avg 24.993 fps
x264 [info]: frame I:152   Avg QP:22.37  size: 18504
x264 [info]: frame P:1755  Avg QP:24.59  size:  7138
x264 [info]: frame B:4331  Avg QP:27.21  size:  2286
x264 [info]: consecutive B-frames:  6.3%  2.2%  3.1% 88.4%
x264 [info]: mb I  I16..4: 13.3% 74.3% 12.4%
x264 [info]: mb P  I16..4:  2.3%  8.3%  0.9%  P16..4: 41.6% 12.1%  6.2%  0.0%  0.0%    skip:28.7%
x264 [info]: mb B  I16..4:  0.2%  0.8%  0.1%  B16..8: 38.1%  3.2%  0.5%  direct: 2.4%  skip:54.8%  L0:54.1% L1:42.3% BI: 3.6%
x264 [info]: 8x8 transform intra:73.0% inter:80.8%
x264 [info]: coded y,uvDC,uvAC intra: 64.2% 64.9% 15.8% inter: 14.5% 14.9% 0.1%
x264 [info]: i16 v,h,dc,p: 33% 22%  4% 41%
x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 17% 14%  6%  7%  9%  8%  8%  8%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 22% 10%  6%  9%  8% 10%  6%  6%
x264 [info]: i8c dc,h,v,p: 55% 17% 21%  6%
x264 [info]: Weighted P-Frames: Y:12.8% UV:3.7%
x264 [info]: ref P L0: 55.7% 17.4% 19.7%  6.6%  0.7%
x264 [info]: ref B L0: 86.9% 11.3%  1.8%
x264 [info]: ref B L1: 94.5%  5.5%
x264 [info]: kb/s:1390.99
[11:09:59] mux: track 0, 6238 frames, 25235156 bytes, 1390.37 kbps, fifo 4096
[11:09:59] mux: track 1, 7253 frames, 2214892 bytes, 122.03 kbps, fifo 4096
[11:09:59] mux: track 2, 50 frames, 146568 bytes, 8.08 kbps, fifo 32
[11:09:59] libhb: work result = 0

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

Re: Switching Field Order with Decomb Bob

Post by JohnAStebbins » Thu Jan 04, 2018 5:28 pm

My understanding is that the detelecine filter should "do the right thing" when no pulldown is present?
In theory, yes. In practice, no. The detelcine filter looks for a specific cadence of interlaced vs. non-interlaced frames. It can be fooled by video sequences that spoof this cadence. And for some reason it is especially bad when the source is PAL framerate.

When transcoding, I always look at the source framerate that HandBrake reports. If it is *not* 29.97fps, I disable detelecine. Any other framerate is either not hard telecined or telecined in some way that the detelecine filter was not designed to handle.

giddie
Posts: 3
Joined: Thu Jan 04, 2018 10:11 am

Re: Switching Field Order with Decomb Bob

Post by giddie » Fri Jan 05, 2018 9:44 am

Awesome; that's exactly the kind of information I was looking for. I'm in the UK, so most of my sources are indeed PAL. There's only one source I came across that needed detelecine (Matrix Trilogy BluRay special features), and that source had only certain shots telecined. It did such a good job detecting the right sections to detelecine that I left it on by default, thinking I could trust it. How strange that it did so well on that mongrel intermittent source but completely falls over on most of my PAL sources :p

Anyway, the framerate tip is exactly the kind of idea I was looking for, and makes perfect sense. Thanks a ton :)

Post Reply