Page 1 of 1

Can handbrake deinterlace with same frame rate as field rate?

Posted: Thu Oct 18, 2018 8:39 pm
by wgf_bean
We all know that with interlaced video there are odd and even fields. Each field only has information for half the image.

From my testing of the output of Handbrake the deinterlacer appears to combine fields as follows:

frame 1 = field 1 + field 2
frame 2 = field 3 + field 4
frame 3 = field 5 + field 6
etc.
This results in a frame rate that is half the field rate.

However this is not how hardware deinterlacing works. Hardware deinterlacing does this:

frame 1 = field 1 + field 2
frame 2 = field 2 + field 3
frame 3 = field 3 + field 4
frame 2 = field 4 + field 5
frame 3 = field 5 + field 6
etc.
This results in a frame rate the same as the field rate.

Interlaced video was originally developed to maintain the higher frame rate at 1/2 the bandwidth. Having frame 2 be derived from fields 3 and 4, rather than 2 and 3 violates the intended purpose of interlaced video.

Is there a deinterlace setting to keep the frame rate the same as the field rate so there's a new and unique frame with each new field?

I've tried forcing the output frame rate to be correct but that just makes each frame get repeated once, which is pointless.

The version of handbrake I'm running is a nightly from:
HandBrake-20180912-09ed0b5_x86_64-Win_GUI.exe

Re: Can handbrake deinterlace with same frame rate as field rate?

Posted: Thu Oct 18, 2018 8:51 pm
by JohnAStebbins
Hardware deinterlacers work in a variety of ways just as software deinterlacers do. Not all hardware deinterlacers produce double rate output.

What you are looking for is the "bob" preset in either the decomb or deinterlace filters.

Re: Can handbrake deinterlace with same frame rate as field rate?

Posted: Thu Oct 18, 2018 9:45 pm
by wgf_bean
Thanks. When I use "bob" preset in either I get a frame rate that's half the field rate. The deinterlacing itself works great. Just not the correct frame rate. For example with an input file from broadcast television mpeg-2 1080i, the rate becomes 29.97 rather than 59.94. For sports broadcast, 29.97 doesn't look right.

Am I missing another setting?

Re: Can handbrake deinterlace with same frame rate as field rate?

Posted: Thu Oct 18, 2018 9:54 pm
by mduell
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.

Re: Can handbrake deinterlace with same frame rate as field rate?

Posted: Thu Oct 18, 2018 9:55 pm
by JohnAStebbins
Am I missing another setting?
No idea. An activity log would likely provide the information we need to diagnose. See the red box at the top of the page.

Re: Can handbrake deinterlace with same frame rate as field rate?

Posted: Mon Oct 22, 2018 7:48 pm
by wgf_bean
I created a small test file - only about 3 seconds of video. Here's the log file for it: https://we.tl/t-sVvEZI3UJZ

I also did some reading on FFMPEG. It has a filter option -vf yadif=1. If I perform this it gives the desired result:

Code: Select all

ffmpeg -i "R:\Temp8\test3.mkv" -vf yadif=1 -c:v libx265 -crf 28 "I:\Handbrake\output3.mkv" -hide_banner
From the FFMPEG documentation...

Code: Select all

10.207 yadif
Deinterlace the input video ("yadif" means "yet another deinterlacing filter").

It accepts the following parameters:

mode
The interlacing mode to adopt. It accepts one of the following values:

0, send_frame
Output one frame for each frame.

1, send_field
Output one frame for each field.

2, send_frame_nospatial
Like send_frame, but it skips the spatial interlacing check.

3, send_field_nospatial
Like send_field, but it skips the spatial interlacing check.
It appears Handbrake uses yadif mode=0 (Output one frame for each frame).
I need yadif mode=1 (Output one frame for each field)

How do I get Handbrake to do yadif=1?

Re: Can handbrake deinterlace with same frame rate as field rate?

Posted: Mon Oct 22, 2018 8:21 pm
by JohnAStebbins
So, according to your log, you used the decomb filter, but did not use the "bob" preset.

ffmpeg options are not the same as HandBrake options.

Are you wanting to use the CLI or the GUI? If GUI, simply select the bob preset on either the decomb or deinterlace filter. If the CLI, "HandBrakeCLI --help" and read the documentation for the decomb and deinterlace filters. They both list the bob preset and how to specify it on the command line.

Re: Can handbrake deinterlace with same frame rate as field rate?

Posted: Mon Oct 22, 2018 8:39 pm
by wgf_bean
I prefer to use Handbrake. I only used FFMPEG to confirm the library can do what I'm looking for.

So I processed again explicitly selecting Deinterlace: "Decomb" Preset "Bob"

The result is still not the desired output.

Here's the log file:

Code: Select all

HandBrake Nightly 20180909191723-09ed0b5-master (2018091201)
OS: Microsoft Windows NT 6.1.7601 Service Pack 1
Ram: 16281 MB, 
GPU Information:
  Intel(R) HD Graphics 4000 - 10.18.10.5059
Screen: 1920x1080
Temp Dir: C:\Users\Bob\AppData\Local\Temp\
Install Dir: C:\Program Files\HandBrake Nightly
Data Dir: C:\Users\Bob\AppData\Roaming\HandBrake\Nightly

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


# Starting Encode ...

[16:24:48] hb_init: starting libhb thread
[16:24:48] 1 job(s) to process
[16:24:48] json job:
{
  "Audio": {
    "AudioList": [
      {
        "DRC": 0.0,
        "Encoder": "copy",
        "Gain": 0.0,
        "Mixdown": -1,
        "NormalizeMixLevel": false,
        "Samplerate": 48000,
        "Track": 0,
        "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"
      }
    ],
    "ChapterMarkers": true,
    "AlignAVStart": false,
    "File": "I:\\Handbrake\\test3-2-cq24-x265-med.mkv",
    "Mp4Options": {
      "IpodAtom": false,
      "Mp4Optimize": false
    },
    "Mux": "mkv"
  },
  "Filters": {
    "FilterList": [
      {
        "ID": 2,
        "Settings": {}
      },
      {
        "ID": 4,
        "Settings": {
          "mode": "23"
        }
      },
      {
        "ID": 3,
        "Settings": {
          "block-height": "16",
          "block-thresh": "40",
          "block-width": "16",
          "filter-mode": "2",
          "mode": "3",
          "motion-thresh": "1",
          "spatial-metric": "2",
          "spatial-thresh": "1"
        }
      },
      {
        "ID": 11,
        "Settings": {
          "crop-bottom": "0",
          "crop-left": "0",
          "crop-right": "0",
          "crop-top": "0",
          "height": "1080",
          "width": "1920"
        }
      },
      {
        "ID": 6,
        "Settings": {
          "mode": "1"
        }
      }
    ]
  },
  "PAR": {
    "Num": 1,
    "Den": 1
  },
  "Metadata": {},
  "SequenceID": 0,
  "Source": {
    "Angle": 1,
    "Range": {
      "Type": "chapter",
      "Start": 1,
      "End": 1
    },
    "Title": 1,
    "Path": "R:\\Temp8\\test3.mkv"
  },
  "Subtitle": {
    "Search": {
      "Burn": false,
      "Default": false,
      "Enable": false,
      "Forced": false
    },
    "SubtitleList": [
      {
        "Burn": false,
        "Default": false,
        "Forced": false,
        "ID": 1,
        "Offset": 0,
        "Track": 0
      }
    ]
  },
  "Video": {
    "Encoder": "x265",
    "TwoPass": false,
    "Turbo": false,
    "ColorMatrixCode": 0,
    "Preset": "medium",
    "Quality": 24.0,
    "QSV": {
      "Decode": false,
      "AsyncDepth": 0
    }
  }
}
[16:24:48] CPU: Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz
[16:24:48]  - Intel microarchitecture Ivy Bridge
[16:24:48]  - logical processor count: 4
[16:24:48] Intel Quick Sync Video support: yes
[16:24:48]  - Intel Media SDK hardware: API 1.11 (minimum: 1.3)
[16:24:48]  - H.264 encoder: yes
[16:24:48]     - preferred implementation: hardware (any) via D3D11
[16:24:48]     - capabilities (hardware):  vsinfo opt1 opt2+extbrc+ib_adapt+nmpslice
[16:24:48]  - H.265 encoder: no
[16:24:48] hb_scan: path=R:\Temp8\test3.mkv, title_index=1
udfread ERROR: ECMA 167 Volume Recognition failed
src/libbluray/disc/disc.c:323: failed opening UDF image R:\Temp8\test3.mkv
src/libbluray/disc/disc.c:424: error opening file BDMV\index.bdmv
src/libbluray/disc/disc.c:424: error opening file BDMV\BACKUP\index.bdmv
[16:24:48] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 6.0.0
libdvdread: Encrypted DVD support unavailable.
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
[16:24:48] dvd: not a dvd - trying as a stream/file instead
Input #0, matroska,webm, from 'R:\Temp8\test3.mkv':
  Metadata:
    ENCODER         : VideoReDo (Lavf56.25.101)
  Duration: 00:00:03.98, start: 0.031000, bitrate: 12297 kb/s
    Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, top first), 1920x1080 [SAR 1:1 DAR 16:9], Closed Captions, 29.97 fps, 29.97 tbr, 1k tbn, 59.94 tbc
    Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s (default)
    Stream #0:2(spa): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
[16:24:48] scan: decoding previews for title 1
[16:24:48] scan: audio 0x1: ac3, rate=48000Hz, bitrate=448000 English (AC3) (5.1 ch)
[16:24:48] scan: audio 0x2: ac3, rate=48000Hz, bitrate=192000 español (AC3) (2.0 ch)
[16:24:49] scan: 10 previews, 1920x1080, 29.970 fps, autocrop = 0/0/0/0, aspect 16:9, PAR 1:1
[16:24:49] Title is likely interlaced or telecined (6 out of 10 previews). You should do something about that.
[16:24:49] libhb: scan thread found 1 valid title(s)
[16:24:49] starting job
[16:24:49] decomb filter thread started for segment 0
[16:24:49] decomb filter thread started for segment 1
[16:24:49] decomb filter thread started for segment 2
[16:24:49] decomb filter thread started for segment 3
[16:24:49] decomb check thread started for segment 0
[16:24:49] decomb check thread started for segment 1
[16:24:49] decomb check thread started for segment 2
[16:24:49] decomb check thread started for segment 3
[16:24:49] mask filter thread started for segment 0
[16:24:49] mask filter thread started for segment 1
[16:24:49] mask filter thread started for segment 2
[16:24:49] mask filter thread started for segment 3
[16:24:49] mask erode thread started for segment 0
[16:24:49] mask erode thread started for segment 1
[16:24:49] mask erode thread started for segment 2
[16:24:49] mask erode thread started for segment 3
[16:24:49] mask dilate thread started for segment 0
[16:24:49] mask dilate thread started for segment 1
[16:24:49] mask dilate thread started for segment 2
[16:24:49] mask dilate thread started for segment 3
[16:24:49] yadif thread started for segment 0
[16:24:49] yadif thread started for segment 1
[16:24:49] yadif thread started for segment 2
[16:24:49] yadif thread started for segment 3
[16:24:49] Auto Passthru: allowed codecs are AAC, AC3, E-AC3, TrueHD, DTS, DTS-HD, MP3, FLAC
[16:24:49] Auto Passthru: fallback is AC3
[16:24:49] Auto Passthru: using AC3 Passthru for track 1
[16:24:49] work: only 1 chapter, disabling chapter markers
[16:24:49] job configuration:
[16:24:49]  * source
[16:24:49]    + R:\Temp8\test3.mkv
[16:24:49]    + title 1, chapter(s) 1 to 1
[16:24:49]    + container: matroska,webm
[16:24:49]    + data rate: 12297 kbps
[16:24:49]  * destination
[16:24:49]    + I:\Handbrake\test3-2-cq24-x265-med.mkv
[16:24:49]    + container: Matroska (libavformat)
[16:24:49]  * video track
[16:24:49]    + decoder: mpeg2video
[16:24:49]    + filters
[16:24:49]      + Detelecine (pullup) ()
[16:24:49]      + Comb Detect (mode=3:spatial-metric=2:motion-thresh=1:spatial-thresh=1:filter-mode=2:block-thresh=40:block-width=16:block-height=16)
[16:24:49]      + Decomb (mode=55)
[16:24:49]      + Framerate Shaper (mode=1)
[16:24:49]        + frame rate: 29.970 fps -> constant 29.970 fps
[16:24:49]      + Crop and Scale (width=1920:height=1080:crop-top=0:crop-bottom=0:crop-left=0:crop-right=0)
[16:24:49]        + source: 1920 * 1080, crop (0/0/0/0): 1920 * 1080, scale: 1920 * 1080
[16:24:49]    + Output geometry
[16:24:49]      + storage dimensions: 1920 x 1080
[16:24:49]      + pixel aspect ratio: 1 : 1
[16:24:49]      + display dimensions: 1920 x 1080
[16:24:49]    + encoder: H.265 (libx265)
[16:24:49]      + preset:  medium
[16:24:49]      + quality: 24.00 (RF)
[16:24:49]      + color profile: 1-1-1
[16:24:49]  * subtitle track 1, English, Closed Caption [CC608] (track 0, id 0x0, Text) -> Passthrough
[16:24:49]  * audio track 1
[16:24:49]    + decoder: English (AC3) (5.1 ch) (track 1, id 0x1)
[16:24:49]      + bitrate: 448 kbps, samplerate: 48000 Hz
[16:24:49]    + AC3 Passthru
[16:24:49] sync: expecting 119 video frames
x265 [info]: HEVC encoder version 2.8
x265 [info]: build info [Windows][GCC 7.1.0][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
x265 [info]: Main profile, Level-4 (Main tier)
x265 [info]: Thread pool created using 4 threads
x265 [info]: Slices                              : 1
x265 [info]: frame threads / pool features       : 2 / wpp(17 rows)
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 2
x265 [info]: Keyframe min / max / scenecut / bias: 30 / 300 / 40 / 5.00
x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
x265 [info]: References / ref-limit  cu / depth  : 3 / on / on
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 1 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : CRF-24.0 / 0.60
x265 [info]: tools: rd=3 psy-rd=2.00 rskip signhide tmvp strong-intra-smoothing
x265 [info]: tools: lslices=6 deblock sao
[16:24:49] sync: first pts audio 0x1 is 0
[16:24:49] sync: first pts video is 180
[16:24:49] sync: "Chapter 1" (1) at frame 1 time 180
[16:24:49] sync: first pts subtitle 0x0 is 42210
[16:24:50] reader: done. 1 scr changes
[16:25:10] work: average encoding speed for job is 0.000000 fps
[16:25:10] comb detect: heavy 116 | light 0 | uncombed 1 | total 117
[16:25:10] decomb: deinterlaced 232 | blended 0 | unfiltered 1 | total 233
[16:25:10] vfr: 119 frames output, 114 dropped and 0 duped for CFR/PFR
[16:25:10] vfr: lost time: 6006 (0 frames)
[16:25:10] vfr: gained time: 6006 (4 frames) (0 not accounted for)
[16:25:10] ac3-decoder done: 123 frames, 0 decoder errors
[16:25:10] mpeg2video-decoder done: 118 frames, 0 decoder errors
[16:25:10] sync: got 118 frames, 119 expected
[16:25:10] sync: framerate min 29.970 fps, max 29.970 fps, avg 29.970 fps
x265 [info]: frame I:      1, Avg QP:24.17  kb/s: 20322.32
x265 [info]: frame P:     32, Avg QP:25.62  kb/s: 13182.42
x265 [info]: frame B:     86, Avg QP:30.46  kb/s: 2941.94
x265 [info]: Weighted P-Frames: Y:3.1% UV:3.1%
x265 [info]: consecutive B-frames: 6.1% 12.1% 3.0% 72.7% 6.1%
encoded 119 frames in 21.01s (5.66 fps), 5841.74 kb/s, Avg QP:29.11
[16:25:10] mux: track 0, 119 frames, 2899901 bytes, 5794.01 kbps, fifo 128
[16:25:10] mux: track 1, 123 frames, 220416 bytes, 440.39 kbps, fifo 128
[16:25:10] mux: track 2, 3 frames, 214 bytes, 0.43 kbps, fifo 8
[16:25:10] libhb: work result = 0

# Encode Completed ...
I've tried many combinations but they all result in output files with a frame rate of 29.97 rather than 59.94.
I can force the output to 59.94 but then the output simple repeats frames rather than having unique ones. Deinterlacing is working fine. The output frame rate is what I'm having an issue with.

I realize the interface to the FFMPEG library Handbrake uses is different than the command line interface, but I thought the functions are fundamentally the same.

Re: Can handbrake deinterlace with same frame rate as field rate?

Posted: Mon Oct 22, 2018 9:19 pm
by JohnAStebbins

Code: Select all

[16:24:49]      + Framerate Shaper (mode=1)
[16:24:49]        + frame rate: 29.970 fps -> constant 29.970 fps
You selected a specific constant framerate that is not the framerate that you say that you want. It did exactly what you asked for.
On the video tab, either leave the framerate set to variable, or set it to the framerate you actually desire.

Re: Can handbrake deinterlace with same frame rate as field rate?

Posted: Mon Oct 22, 2018 9:52 pm
by wgf_bean
I processed again selecting Deinterlace: "Decomb" Preset "Bob", and output frame rate 59.94

The output did create the correct number of frames per second, but the output frame data was not correct.

As I playback the output stepping one frame at a time the motion reverses direction every other frame, as if the filter is selecting the wrong fields when creating the output frames.

Here's the log file:

Code: Select all

HandBrake Nightly 20180909191723-09ed0b5-master (2018091201)
OS: Microsoft Windows NT 6.1.7601 Service Pack 1
Ram: 16281 MB, 
GPU Information:
  Intel(R) HD Graphics 4000 - 10.18.10.5059
Screen: 1920x1080
Temp Dir: C:\Users\Bob\AppData\Local\Temp\
Install Dir: C:\Program Files\HandBrake Nightly
Data Dir: C:\Users\Bob\AppData\Roaming\HandBrake\Nightly

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


# Starting Encode ...

[17:31:11] hb_init: starting libhb thread
[17:31:11] 1 job(s) to process
[17:31:11] json job:
{
  "Audio": {
    "AudioList": [
      {
        "DRC": 0.0,
        "Encoder": "copy",
        "Gain": 0.0,
        "Mixdown": -1,
        "NormalizeMixLevel": false,
        "Samplerate": 48000,
        "Track": 0,
        "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"
      }
    ],
    "ChapterMarkers": true,
    "AlignAVStart": false,
    "File": "I:\\Handbrake\\test3-3-cq24-x265-med.mkv",
    "Mp4Options": {
      "IpodAtom": false,
      "Mp4Optimize": false
    },
    "Mux": "mkv"
  },
  "Filters": {
    "FilterList": [
      {
        "ID": 2,
        "Settings": {}
      },
      {
        "ID": 4,
        "Settings": {
          "mode": "23"
        }
      },
      {
        "ID": 3,
        "Settings": {
          "block-height": "16",
          "block-thresh": "40",
          "block-width": "16",
          "filter-mode": "2",
          "mode": "3",
          "motion-thresh": "1",
          "spatial-metric": "2",
          "spatial-thresh": "1"
        }
      },
      {
        "ID": 11,
        "Settings": {
          "crop-bottom": "0",
          "crop-left": "0",
          "crop-right": "0",
          "crop-top": "0",
          "height": "1080",
          "width": "1920"
        }
      },
      {
        "ID": 6,
        "Settings": {
          "mode": "1",
          "rate": "27000000/450450"
        }
      }
    ]
  },
  "PAR": {
    "Num": 1,
    "Den": 1
  },
  "Metadata": {},
  "SequenceID": 0,
  "Source": {
    "Angle": 1,
    "Range": {
      "Type": "chapter",
      "Start": 1,
      "End": 1
    },
    "Title": 1,
    "Path": "R:\\Temp8\\test3.mkv"
  },
  "Subtitle": {
    "Search": {
      "Burn": false,
      "Default": false,
      "Enable": false,
      "Forced": false
    },
    "SubtitleList": [
      {
        "Burn": false,
        "Default": false,
        "Forced": false,
        "ID": 1,
        "Offset": 0,
        "Track": 0
      }
    ]
  },
  "Video": {
    "Encoder": "x265",
    "TwoPass": false,
    "Turbo": false,
    "ColorMatrixCode": 0,
    "Preset": "medium",
    "Quality": 24.0,
    "QSV": {
      "Decode": false,
      "AsyncDepth": 0
    }
  }
}
[17:31:11] CPU: Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz
[17:31:11]  - Intel microarchitecture Ivy Bridge
[17:31:11]  - logical processor count: 4
[17:31:11] Intel Quick Sync Video support: yes
[17:31:11]  - Intel Media SDK hardware: API 1.11 (minimum: 1.3)
[17:31:11]  - H.264 encoder: yes
[17:31:11]     - preferred implementation: hardware (any) via D3D11
[17:31:11]     - capabilities (hardware):  vsinfo opt1 opt2+extbrc+ib_adapt+nmpslice
[17:31:11]  - H.265 encoder: no
[17:31:11] hb_scan: path=R:\Temp8\test3.mkv, title_index=1
udfread ERROR: ECMA 167 Volume Recognition failed
src/libbluray/disc/disc.c:323: failed opening UDF image R:\Temp8\test3.mkv
src/libbluray/disc/disc.c:424: error opening file BDMV\index.bdmv
src/libbluray/disc/disc.c:424: error opening file BDMV\BACKUP\index.bdmv
[17:31:11] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 6.0.0
libdvdread: Encrypted DVD support unavailable.
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
[17:31:11] dvd: not a dvd - trying as a stream/file instead
Input #0, matroska,webm, from 'R:\Temp8\test3.mkv':
  Metadata:
    ENCODER         : VideoReDo (Lavf56.25.101)
  Duration: 00:00:03.98, start: 0.031000, bitrate: 12297 kb/s
    Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, top first), 1920x1080 [SAR 1:1 DAR 16:9], Closed Captions, 29.97 fps, 29.97 tbr, 1k tbn, 59.94 tbc
    Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s (default)
    Stream #0:2(spa): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
[17:31:11] scan: decoding previews for title 1
[17:31:11] scan: audio 0x1: ac3, rate=48000Hz, bitrate=448000 English (AC3) (5.1 ch)
[17:31:11] scan: audio 0x2: ac3, rate=48000Hz, bitrate=192000 español (AC3) (2.0 ch)
[17:31:12] scan: 10 previews, 1920x1080, 29.970 fps, autocrop = 0/0/0/0, aspect 16:9, PAR 1:1
[17:31:12] Title is likely interlaced or telecined (6 out of 10 previews). You should do something about that.
[17:31:12] libhb: scan thread found 1 valid title(s)
[17:31:12] starting job
[17:31:12] decomb filter thread started for segment 0
[17:31:12] decomb filter thread started for segment 2
[17:31:12] decomb filter thread started for segment 1
[17:31:12] decomb filter thread started for segment 3
[17:31:12] decomb check thread started for segment 0
[17:31:12] decomb check thread started for segment 1
[17:31:12] decomb check thread started for segment 2
[17:31:12] decomb check thread started for segment 3
[17:31:12] mask filter thread started for segment 0
[17:31:12] mask filter thread started for segment 1
[17:31:12] mask filter thread started for segment 2
[17:31:12] mask filter thread started for segment 3
[17:31:12] mask erode thread started for segment 0
[17:31:12] mask erode thread started for segment 1
[17:31:12] mask erode thread started for segment 2
[17:31:12] mask erode thread started for segment 3
[17:31:12] mask dilate thread started for segment 0
[17:31:12] mask dilate thread started for segment 1
[17:31:12] mask dilate thread started for segment 2
[17:31:12] mask dilate thread started for segment 3
[17:31:12] yadif thread started for segment 0
[17:31:12] yadif thread started for segment 1
[17:31:12] yadif thread started for segment 2
[17:31:12] yadif thread started for segment 3
[17:31:12] Auto Passthru: allowed codecs are AAC, AC3, E-AC3, TrueHD, DTS, DTS-HD, MP3, FLAC
[17:31:12] Auto Passthru: fallback is AC3
[17:31:12] Auto Passthru: using AC3 Passthru for track 1
[17:31:12] work: only 1 chapter, disabling chapter markers
[17:31:12] job configuration:
[17:31:12]  * source
[17:31:12]    + R:\Temp8\test3.mkv
[17:31:12]    + title 1, chapter(s) 1 to 1
[17:31:12]    + container: matroska,webm
[17:31:12]    + data rate: 12297 kbps
[17:31:12]  * destination
[17:31:12]    + I:\Handbrake\test3-3-cq24-x265-med.mkv
[17:31:12]    + container: Matroska (libavformat)
[17:31:12]  * video track
[17:31:12]    + decoder: mpeg2video
[17:31:12]    + filters
[17:31:12]      + Detelecine (pullup) ()
[17:31:12]      + Comb Detect (mode=3:spatial-metric=2:motion-thresh=1:spatial-thresh=1:filter-mode=2:block-thresh=40:block-width=16:block-height=16)
[17:31:12]      + Decomb (mode=55)
[17:31:12]      + Framerate Shaper (mode=1:rate=27000000/450450)
[17:31:12]        + frame rate: 29.970 fps -> constant 59.940 fps
[17:31:12]      + Crop and Scale (width=1920:height=1080:crop-top=0:crop-bottom=0:crop-left=0:crop-right=0)
[17:31:12]        + source: 1920 * 1080, crop (0/0/0/0): 1920 * 1080, scale: 1920 * 1080
[17:31:12]    + Output geometry
[17:31:12]      + storage dimensions: 1920 x 1080
[17:31:12]      + pixel aspect ratio: 1 : 1
[17:31:12]      + display dimensions: 1920 x 1080
[17:31:12]    + encoder: H.265 (libx265)
[17:31:12]      + preset:  medium
[17:31:12]      + quality: 24.00 (RF)
[17:31:12]      + color profile: 1-1-1
[17:31:12]  * subtitle track 1, English, Closed Caption [CC608] (track 0, id 0x0, Text) -> Passthrough
[17:31:12]  * audio track 1
[17:31:12]    + decoder: English (AC3) (5.1 ch) (track 1, id 0x1)
[17:31:12]      + bitrate: 448 kbps, samplerate: 48000 Hz
[17:31:12]    + AC3 Passthru
[17:31:12] sync: expecting 119 video frames
x265 [info]: HEVC encoder version 2.8
x265 [info]: build info [Windows][GCC 7.1.0][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
x265 [info]: Main profile, Level-4.1 (Main tier)
x265 [info]: Thread pool created using 4 threads
x265 [info]: Slices                              : 1
x265 [info]: frame threads / pool features       : 2 / wpp(17 rows)
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 2
x265 [info]: Keyframe min / max / scenecut / bias: 60 / 600 / 40 / 5.00
x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
x265 [info]: References / ref-limit  cu / depth  : 3 / on / on
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 1 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : CRF-24.0 / 0.60
x265 [info]: tools: rd=3 psy-rd=2.00 rskip signhide tmvp strong-intra-smoothing
x265 [info]: tools: lslices=6 deblock sao
[17:31:12] sync: first pts audio 0x1 is 0
[17:31:12] sync: first pts video is 180
[17:31:12] sync: "Chapter 1" (1) at frame 1 time 180
[17:31:12] sync: first pts subtitle 0x0 is 42210
[17:31:13] reader: done. 1 scr changes
[17:31:49] work: average encoding speed for job is 8.912656 fps
[17:31:49] comb detect: heavy 116 | light 0 | uncombed 1 | total 117
[17:31:49] decomb: deinterlaced 232 | blended 0 | unfiltered 1 | total 233
[17:31:49] vfr: 236 frames output, 2 dropped and 5 duped for CFR/PFR
[17:31:49] vfr: lost time: 6006 (0 frames)
[17:31:49] vfr: gained time: 6006 (4 frames) (0 not accounted for)
[17:31:49] ac3-decoder done: 123 frames, 0 decoder errors
[17:31:49] mpeg2video-decoder done: 118 frames, 0 decoder errors
[17:31:49] sync: got 118 frames, 119 expected
[17:31:49] sync: framerate min 29.970 fps, max 29.970 fps, avg 29.970 fps
x265 [info]: frame I:      1, Avg QP:25.15  kb/s: 36354.37
x265 [info]: frame P:     59, Avg QP:27.71  kb/s: 16049.02
x265 [info]: frame B:    176, Avg QP:33.35  kb/s: 3180.19
x265 [info]: Weighted P-Frames: Y:1.7% UV:1.7%
x265 [info]: consecutive B-frames: 5.0% 3.3% 3.3% 70.0% 18.3%
encoded 236 frames in 37.40s (6.31 fps), 6537.97 kb/s, Avg QP:31.90
[17:31:49] mux: track 0, 236 frames, 3218658 bytes, 6512.29 kbps, fifo 256
[17:31:49] mux: track 1, 123 frames, 220416 bytes, 445.97 kbps, fifo 128
[17:31:49] mux: track 2, 3 frames, 214 bytes, 0.43 kbps, fifo 8
[17:31:49] libhb: work result = 0

# Encode Completed ...
So I tried again selecting Deinterlace: "Yadif" Preset: "Bob", and output frame rate 59.94
This created an output with every other frame repeated, and also not properly deinterlaced.
Here's the log file for this test:

Code: Select all

HandBrake Nightly 20180909191723-09ed0b5-master (2018091201)
OS: Microsoft Windows NT 6.1.7601 Service Pack 1
Ram: 16281 MB, 
GPU Information:
  Intel(R) HD Graphics 4000 - 10.18.10.5059
Screen: 1920x1080
Temp Dir: C:\Users\Bob\AppData\Local\Temp\
Install Dir: C:\Program Files\HandBrake Nightly
Data Dir: C:\Users\Bob\AppData\Roaming\HandBrake\Nightly

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


# Starting Encode ...

[17:44:38] hb_init: starting libhb thread
[17:44:38] 1 job(s) to process
[17:44:38] json job:
{
  "Audio": {
    "AudioList": [
      {
        "DRC": 0.0,
        "Encoder": "copy",
        "Gain": 0.0,
        "Mixdown": -1,
        "NormalizeMixLevel": false,
        "Samplerate": 48000,
        "Track": 0,
        "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"
      }
    ],
    "ChapterMarkers": true,
    "AlignAVStart": false,
    "File": "I:\\Handbrake\\test3-4-cq24-x265-med.mkv",
    "Mp4Options": {
      "IpodAtom": false,
      "Mp4Optimize": false
    },
    "Mux": "mkv"
  },
  "Filters": {
    "FilterList": [
      {
        "ID": 2,
        "Settings": {}
      },
      {
        "ID": 5,
        "Settings": {
          "mode": "7"
        }
      },
      {
        "ID": 3,
        "Settings": {
          "block-height": "16",
          "block-thresh": "40",
          "block-width": "16",
          "filter-mode": "2",
          "mode": "3",
          "motion-thresh": "1",
          "spatial-metric": "2",
          "spatial-thresh": "1"
        }
      },
      {
        "ID": 11,
        "Settings": {
          "crop-bottom": "0",
          "crop-left": "0",
          "crop-right": "0",
          "crop-top": "0",
          "height": "1080",
          "width": "1920"
        }
      },
      {
        "ID": 6,
        "Settings": {
          "mode": "1",
          "rate": "27000000/450450"
        }
      }
    ]
  },
  "PAR": {
    "Num": 1,
    "Den": 1
  },
  "Metadata": {},
  "SequenceID": 0,
  "Source": {
    "Angle": 1,
    "Range": {
      "Type": "chapter",
      "Start": 1,
      "End": 1
    },
    "Title": 1,
    "Path": "R:\\Temp8\\test3.mkv"
  },
  "Subtitle": {
    "Search": {
      "Burn": false,
      "Default": false,
      "Enable": false,
      "Forced": false
    },
    "SubtitleList": [
      {
        "Burn": false,
        "Default": false,
        "Forced": false,
        "ID": 1,
        "Offset": 0,
        "Track": 0
      }
    ]
  },
  "Video": {
    "Encoder": "x265",
    "TwoPass": false,
    "Turbo": false,
    "ColorMatrixCode": 0,
    "Preset": "medium",
    "Quality": 24.0,
    "QSV": {
      "Decode": false,
      "AsyncDepth": 0
    }
  }
}
[17:44:38] CPU: Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz
[17:44:38]  - Intel microarchitecture Ivy Bridge
[17:44:38]  - logical processor count: 4
[17:44:38] Intel Quick Sync Video support: yes
[17:44:38]  - Intel Media SDK hardware: API 1.11 (minimum: 1.3)
[17:44:38]  - H.264 encoder: yes
[17:44:38]     - preferred implementation: hardware (any) via D3D11
[17:44:38]     - capabilities (hardware):  vsinfo opt1 opt2+extbrc+ib_adapt+nmpslice
[17:44:38]  - H.265 encoder: no
[17:44:38] hb_scan: path=R:\Temp8\test3.mkv, title_index=1
udfread ERROR: ECMA 167 Volume Recognition failed
src/libbluray/disc/disc.c:323: failed opening UDF image R:\Temp8\test3.mkv
src/libbluray/disc/disc.c:424: error opening file BDMV\index.bdmv
src/libbluray/disc/disc.c:424: error opening file BDMV\BACKUP\index.bdmv
[17:44:38] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 6.0.0
libdvdread: Encrypted DVD support unavailable.
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
[17:44:38] dvd: not a dvd - trying as a stream/file instead
Input #0, matroska,webm, from 'R:\Temp8\test3.mkv':
  Metadata:
    ENCODER         : VideoReDo (Lavf56.25.101)
  Duration: 00:00:03.98, start: 0.031000, bitrate: 12297 kb/s
    Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, top first), 1920x1080 [SAR 1:1 DAR 16:9], Closed Captions, 29.97 fps, 29.97 tbr, 1k tbn, 59.94 tbc
    Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s (default)
    Stream #0:2(spa): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
[17:44:38] scan: decoding previews for title 1
[17:44:38] scan: audio 0x1: ac3, rate=48000Hz, bitrate=448000 English (AC3) (5.1 ch)
[17:44:38] scan: audio 0x2: ac3, rate=48000Hz, bitrate=192000 español (AC3) (2.0 ch)
[17:44:39] scan: 10 previews, 1920x1080, 29.970 fps, autocrop = 0/0/0/0, aspect 16:9, PAR 1:1
[17:44:39] Title is likely interlaced or telecined (6 out of 10 previews). You should do something about that.
[17:44:39] libhb: scan thread found 1 valid title(s)
[17:44:39] starting job
[17:44:39] decomb filter thread started for segment 0
[17:44:39] decomb filter thread started for segment 2
[17:44:39] decomb filter thread started for segment 3
[17:44:39] decomb check thread started for segment 0
[17:44:39] decomb filter thread started for segment 1
[17:44:39] decomb check thread started for segment 1
[17:44:39] decomb check thread started for segment 2
[17:44:39] decomb check thread started for segment 3
[17:44:39] mask filter thread started for segment 0
[17:44:39] mask filter thread started for segment 1
[17:44:39] mask filter thread started for segment 2
[17:44:39] mask filter thread started for segment 3
[17:44:39] mask erode thread started for segment 0
[17:44:39] mask erode thread started for segment 1
[17:44:39] mask erode thread started for segment 2
[17:44:39] mask dilate thread started for segment 0
[17:44:39] mask erode thread started for segment 3
[17:44:39] mask dilate thread started for segment 3
[17:44:39] mask dilate thread started for segment 1
[17:44:39] mask dilate thread started for segment 2
[Parsed_yadif_0 @ 0000000000ad7200] Option 'auto' not found
[AVFilterGraph @ 0000000037049480] Error initializing filter 'yadif' with args 'mode=1:auto=1'
avfilter_init: avfilter_graph_parse2 failed (yadif='mode=1:auto=1')
avfilter_init: avfilter_graph_parse2 failed (yadif='mode=1:auto=1')
[17:44:39] Failure to initialise filter 'avfilter', disabling
[17:44:39] Auto Passthru: allowed codecs are AAC, AC3, E-AC3, TrueHD, DTS, DTS-HD, MP3, FLAC
[17:44:39] Auto Passthru: fallback is AC3
[17:44:39] Auto Passthru: using AC3 Passthru for track 1
[17:44:39] work: only 1 chapter, disabling chapter markers
[17:44:39] job configuration:
[17:44:39]  * source
[17:44:39]    + R:\Temp8\test3.mkv
[17:44:39]    + title 1, chapter(s) 1 to 1
[17:44:39]    + container: matroska,webm
[17:44:39]    + data rate: 12297 kbps
[17:44:39]  * destination
[17:44:39]    + I:\Handbrake\test3-4-cq24-x265-med.mkv
[17:44:39]    + container: Matroska (libavformat)
[17:44:39]  * video track
[17:44:39]    + decoder: mpeg2video
[17:44:39]    + filters
[17:44:39]      + Detelecine (pullup) ()
[17:44:39]      + Comb Detect (mode=3:spatial-metric=2:motion-thresh=1:spatial-thresh=1:filter-mode=2:block-thresh=40:block-width=16:block-height=16)
[17:44:39]      + Framerate Shaper (mode=1:rate=27000000/450450)
[17:44:39]        + frame rate: 29.970 fps -> constant 59.940 fps
[17:44:39]      + Crop and Scale (width=1920:height=1080:crop-top=0:crop-bottom=0:crop-left=0:crop-right=0)
[17:44:39]        + source: 1920 * 1080, crop (0/0/0/0): 1920 * 1080, scale: 1920 * 1080
[17:44:39]    + Output geometry
[17:44:39]      + storage dimensions: 1920 x 1080
[17:44:39]      + pixel aspect ratio: 1 : 1
[17:44:39]      + display dimensions: 1920 x 1080
[17:44:39]    + encoder: H.265 (libx265)
[17:44:39]      + preset:  medium
[17:44:39]      + quality: 24.00 (RF)
[17:44:39]      + color profile: 1-1-1
[17:44:39]  * subtitle track 1, English, Closed Caption [CC608] (track 0, id 0x0, Text) -> Passthrough
[17:44:39]  * audio track 1
[17:44:39]    + decoder: English (AC3) (5.1 ch) (track 1, id 0x1)
[17:44:39]      + bitrate: 448 kbps, samplerate: 48000 Hz
[17:44:39]    + AC3 Passthru
[17:44:39] sync: expecting 119 video frames
x265 [info]: HEVC encoder version 2.8
x265 [info]: build info [Windows][GCC 7.1.0][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
x265 [info]: Main profile, Level-4.1 (Main tier)
x265 [info]: Thread pool created using 4 threads
x265 [info]: Slices                              : 1
x265 [info]: frame threads / pool features       : 2 / wpp(17 rows)
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 2
x265 [info]: Keyframe min / max / scenecut / bias: 60 / 600 / 40 / 5.00
x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
x265 [info]: References / ref-limit  cu / depth  : 3 / on / on
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 1 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : CRF-24.0 / 0.60
x265 [info]: tools: rd=3 psy-rd=2.00 rskip signhide tmvp strong-intra-smoothing
x265 [info]: tools: lslices=6 deblock sao
[17:44:39] sync: first pts audio 0x1 is 0
[17:44:39] sync: first pts video is 180
[17:44:39] sync: "Chapter 1" (1) at frame 1 time 180
[17:44:39] sync: first pts subtitle 0x0 is 42210
[17:44:40] reader: done. 1 scr changes
[17:45:07] work: average encoding speed for job is 11.099121 fps
[17:45:08] comb detect: heavy 116 | light 0 | uncombed 1 | total 117
[17:45:08] vfr: 236 frames output, 2 dropped and 121 duped for CFR/PFR
[17:45:08] vfr: lost time: 9009 (0 frames)
[17:45:08] vfr: gained time: 9009 (4 frames) (0 not accounted for)
[17:45:08] ac3-decoder done: 123 frames, 0 decoder errors
[17:45:08] mpeg2video-decoder done: 118 frames, 0 decoder errors
[17:45:08] sync: got 118 frames, 119 expected
[17:45:08] sync: framerate min 29.970 fps, max 29.970 fps, avg 29.970 fps
x265 [info]: frame I:      1, Avg QP:24.42  kb/s: 42239.04
x265 [info]: frame P:     60, Avg QP:27.84  kb/s: 23469.67
x265 [info]: frame B:    175, Avg QP:33.83  kb/s: 2207.88
x265 [info]: Weighted P-Frames: Y:3.3% UV:3.3%
x265 [info]: consecutive B-frames: 1.6% 3.3% 18.0% 60.7% 16.4%
encoded 236 frames in 28.93s (8.16 fps), 7783.04 kb/s, Avg QP:32.27
[17:45:08] mux: track 0, 236 frames, 3831434 bytes, 7752.11 kbps, fifo 256
[17:45:08] mux: track 1, 123 frames, 220416 bytes, 445.97 kbps, fifo 128
[17:45:08] mux: track 2, 3 frames, 229 bytes, 0.46 kbps, fifo 8
[17:45:08] libhb: work result = 0

# Encode Completed ...
The source file is small test file of only 5978 KB should you want to try yourself.

Re: Can handbrake deinterlace with same frame rate as field rate?

Posted: Mon Oct 22, 2018 10:20 pm
by JohnAStebbins
Why are you enabling the detelecine filter? That may be the cause of some of this behaviour. The detelecine filter can lock to false telecine patterns in interlaced input and produce odd results. Try disabling this first, then see the rest of my comments since this could be skewing the results.

If disabling detelecine doesn't improve things and the motion reversal problem persists, your content either signals the wrong field parity or it doesn't signal it at all and HandBrake's default doesn't match.

You can set the parity manually by using custom decomb settings (select custom in decomb's preset option and you'll get a text entry box to enter the custom option. E.g. "mode=23:parity=0" is the same as bob with Top Field First parity. Try parity=1 for Bottom Field First.

You can do the same with yadif, but the custom settings would be "mode=7:parity=0".

Re: Can handbrake deinterlace with same frame rate as field rate?

Posted: Mon Oct 22, 2018 10:48 pm
by wgf_bean
I had set the Detelecine to Default, assuming it would chose the correct option. So I changed that to Off and now it works! The output is now as expected - smooth with no motion reversals, and a unique frame at 59.94 Hz.

As a summary to anyone else trying to get the output frame rate to match the field rate for interlaced TV content:

Detelecine: Off
Deinterlace: Decomb Preset:Bob
Then set the video output frame rate to double the input frame rate. (since the input field rate is double the input frame rate)

Thank you JohnAStebbins, you're my hero!

Re: Can handbrake deinterlace with same frame rate as field rate?

Posted: Mon Oct 22, 2018 11:07 pm
by JohnAStebbins
Glad you got it working. I should have noticed that earlier, would have saved us both a little time :mrgreen: