Random jagged frames when encoding 1080i footage

HandBrake for Windows support
Forum rules
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.
Post Reply
kenzarxv
Posts: 4
Joined: Thu May 21, 2020 9:09 am

Random jagged frames when encoding 1080i footage

Post by kenzarxv »

Description of problem or question:
Random jagged frames when encoding 1080i footage

I have TV shows I recorded and wanted to re-encode them as they're quite large in file size. We're talking about 20gb+ .ts 2-2.5hr shows.
They play very well using either IINA (mac) and MPC-HC (windows) with deinterlace turned on at a smooth 60 fps.
However, when I try to encode them either using H265 or AMD VCE, I get these random jagged frames in the middle of the show. I am playing back the source file and those jagged frames doesn't exist.
Any idea what's causing it and what settings I can tweak? I'm almost tempted to just play it back and record my screen using OBS.

Reference comparison: https://imgur.com/a/UuoOQjb (both are from the same encoded file, just different time stamps)
Settings: MKV, Detelecine, Decomb Bob, H265 10bit or AMD VCE, 60 fps Constant.

HandBrake version 1.3.1

Operating system and version:
Windows 10 1903

Code: Select all

HandBrake 1.3.1 (2020010400)
OS: Microsoft Windows NT 10.0.18362.0
CPU: AMD Ryzen 5 2600 Six-Core Processor            
Ram: 16337 MB, 
GPU Information:
  AMD Radeon RX 5600 XT - 26.20.15019.19000
Screen: 1920x1080
Temp Dir: C:\Users\[TRUNCATED]\AppData\Local\Temp\
Install Dir: C:\Program Files\HandBrake
Data Dir: C:\Users\[TRUNCATED]\AppData\Roaming\HandBrake

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


# Starting Encode ...

[06:30:27] base preset: Enstars 4th H265 10bit
[18:30:27] hb_init: starting libhb thread
[18:30:27] Starting work at: Wed May 20 18:30:27 2020
[18:30:27] 1 job(s) to process
[18:30:27] json job:
{
  "Audio": {
    "AudioList": [
      {
        "DRC": 0.0,
        "Encoder": "av_aac",
        "Gain": 0.0,
        "Mixdown": 4,
        "NormalizeMixLevel": false,
        "Quality": 7.0,
        "Samplerate": 0,
        "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": "[TRUNCATED]",
    "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": 12,
        "Settings": {
          "crop-bottom": "0",
          "crop-left": "0",
          "crop-right": "0",
          "crop-top": "0",
          "height": "1080",
          "width": "1920"
        }
      },
      {
        "ID": 6,
        "Settings": {
          "mode": "1",
          "rate": "27000000/450000"
        }
      }
    ]
  },
  "PAR": {
    "Num": 1,
    "Den": 1
  },
  "Metadata": {},
  "SequenceID": 0,
  "Source": {
    "Angle": 1,
    "Range": {
      "Type": "chapter",
      "Start": 1,
      "End": 1
    },
    "Title": 1,
    "Path": "[TRUNCATED]"
  },
  "Subtitle": {
    "Search": {
      "Burn": true,
      "Default": false,
      "Enable": true,
      "Forced": true
    },
    "SubtitleList": []
  },
  "Video": {
    "Encoder": "x265_10bit",
    "Level": "auto",
    "Bitrate": 9000,
    "TwoPass": false,
    "Turbo": false,
    "ColorMatrixCode": 0,
    "Options": "",
    "Preset": "fast",
    "Profile": "auto",
    "QSV": {
      "Decode": false,
      "AsyncDepth": 0
    }
  }
}
[18:30:27] CPU:
[18:30:27]  - logical processor count: 12
[18:30:27] Intel Quick Sync Video support: no
[18:30:27] hb_scan: path=[TRUNCATED]
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
src/libbluray/bluray.c:2585: nav_get_title_list([TRUNCATED]) failed
[18:30:27] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 6.0.1
libdvdread: Encrypted DVD support unavailable.
libdvdread: Can't open [TRUNCATED] for reading
libdvdnav: vm: failed to open/read the DVD
[18:30:27] dvd: not a dvd - trying as a stream/file instead
[18:30:27] file is MPEG Transport Stream with 188 byte packets offset 0 bytes
[18:30:27] Probing 2 unknown streams
[18:30:57] hb_ts_stream_decode - eof
[18:30:57] hb_ts_stream_decode - eof
[18:30:57] Found the following PIDS
[18:30:57]     Video PIDS :
[18:30:57]       0x240 type MPEG2 (0x2)
[18:30:57]     Audio PIDS :
[18:30:57]       0x241 type AAC (0xf)
[18:30:57]     Subtitle PIDS :
[18:30:57]     Other PIDS :
[18:30:57]       0x245 type ISO 13818-1 PES private data (0x6)
[18:30:57]       0x146 type ISO 13818-1 PES private data (0x6)
[18:30:57]       0x211 type Unknown (0xff) (PCR)
[18:30:57] stream id 0x241 (type 0xf substream 0x0) audio 0x241
[18:30:57] scan: decoding previews for title 1
[18:30:57] file is MPEG Transport Stream with 188 byte packets offset 0 bytes
[18:30:57] Probing 2 unknown streams
[18:31:27] hb_ts_stream_decode - eof
[18:31:27] hb_ts_stream_decode - eof
[aac @ 0000018666776b00] Sample rate index in program config element does not match the sample rate index configured by the container.
[aac @ 0000018666776b00] channel element 3.4 is not allocated
[aac @ 0000018666776b00] Sample rate index in program config element does not match the sample rate index configured by the container.
[aac @ 0000018666776b00] channel element 3.4 is not allocated
[aac @ 0000018666772b00] Sample rate index in program config element does not match the sample rate index configured by the container.
[aac @ 0000018666772b00] channel element 3.4 is not allocated
[aac @ 0000018666772200] Sample rate index in program config element does not match the sample rate index configured by the container.
[aac @ 0000018666772200] channel element 3.4 is not allocated
[aac @ 0000018666772200] Sample rate index in program config element does not match the sample rate index configured by the container.
[aac @ 0000018666772200] channel element 3.4 is not allocated
[aac @ 0000018666772200] Sample rate index in program config element does not match the sample rate index configured by the container.
[aac @ 0000018666772200] channel element 3.4 is not allocated
[aac @ 0000018666776680] Sample rate index in program config element does not match the sample rate index configured by the container.
[aac @ 0000018666776680] channel element 3.4 is not allocated
[aac @ 0000018666772200] Sample rate index in program config element does not match the sample rate index configured by the container.
[aac @ 0000018666772200] channel element 3.4 is not allocated
[aac @ 0000018666776680] Sample rate index in program config element does not match the sample rate index configured by the container.
[aac @ 0000018666776680] channel element 3.4 is not allocated
[aac @ 0000018666770b40] Sample rate index in program config element does not match the sample rate index configured by the container.
[aac @ 0000018666770b40] channel element 3.4 is not allocated
[aac @ 0000018666772200] Sample rate index in program config element does not match the sample rate index configured by the container.
[aac @ 0000018666772200] channel element 3.4 is not allocated
[aac @ 0000018666770b40] Sample rate index in program config element does not match the sample rate index configured by the container.
[aac @ 0000018666770b40] channel element 3.4 is not allocated
[aac @ 0000018666770b40] channel element 1.0 is not allocated
[aac @ 0000018666770b40] channel element 2.15 is not allocated
[aac @ 0000018666776680] Sample rate index in program config element does not match the sample rate index configured by the container.
[aac @ 0000018666776680] channel element 3.4 is not allocated
[aac @ 0000018666776680] channel element 1.0 is not allocated
[aac @ 0000018666776680] channel element 2.15 is not allocated
[18:31:28] scan: audio 0x241: aac, rate=48000Hz, bitrate=177000 Unknown (AAC LC) (2.0 ch) (177 kbps)
[18:31:28] stream: 18 good frames, 0 errors (0%)
[18:31:28] scan: 10 previews, 1920x1080, 29.970 fps, autocrop = 0/0/0/0, aspect 16:9, PAR 1:1
[18:31:28] libhb: scan thread found 1 valid title(s)
[18:31:28] Skipping subtitle scan.  No suitable subtitle tracks.
[18:31:28] Starting Task: Encoding Pass
[18:31:28] Skipping crop/scale filter
[18:31:28] work: only 1 chapter, disabling chapter markers
[18:31:28] job configuration:
[18:31:28]  * source
[18:31:28]    + [TRUNCATED]
[18:31:28]    + title 1, chapter(s) 1 to 1
[18:31:28]  * destination
[18:31:28]    + [TRUNCATED]
[18:31:28]    + container: Matroska (libavformat)
[18:31:28]  * video track
[18:31:28]    + decoder: mpeg2video
[18:31:28]      + bitrate 200 kbps
[18:31:28]    + filters
[18:31:28]      + Detelecine (pullup) ()
[18:31:28]      + 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)
[18:31:28]      + Decomb (mode=55)
[18:31:28]      + Framerate Shaper (mode=1:rate=27000000/450000)
[18:31:28]        + frame rate: 29.970 fps -> constant 60.000 fps
[18:31:28]    + Output geometry
[18:31:28]      + storage dimensions: 1920 x 1080
[18:31:28]      + pixel aspect ratio: 1 : 1
[18:31:28]      + display dimensions: 1920 x 1080
[18:31:28]    + encoder: H.265 10-bit (libx265)
[18:31:28]      + preset:  fast
[18:31:28]      + profile: auto
[18:31:28]      + level:   auto
[18:31:28]      + bitrate: 9000 kbps, pass: 0
[18:31:28]      + color profile: 1-1-1
[18:31:28]  * audio track 1
[18:31:28]    + decoder: Unknown (AAC LC) (2.0 ch) (177 kbps) (track 1, id 0x241)
[18:31:28]      + bitrate: 177 kbps, samplerate: 48000 Hz
[18:31:28]    + mixdown: Stereo
[18:31:28]    + dither: none
[18:31:28]    + encoder: AAC (libavcodec)
[18:31:28]      + quality: 7.00, samplerate: 48000 Hz
[18:31:28] file is MPEG Transport Stream with 188 byte packets offset 0 bytes
[18:31:28] Probing 2 unknown streams
[18:31:58] hb_ts_stream_decode - eof
[18:31:58] hb_ts_stream_decode - eof
[18:31:58] sync: expecting 269058 video frames
x265 [info]: HEVC encoder version 3.2.1+1-b5c86a64bbbe
x265 [info]: build info [Windows][GCC 9.2.0][64 bit] 10bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
x265 [info]: Main 10 profile, Level-4.1 (Main tier)
x265 [info]: Thread pool created using 12 threads
x265 [info]: Slices                              : 1
x265 [info]: frame threads / pool features       : 3 / 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        : 15 / 4 / 0
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  : 2 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : ABR-9000 kbps / 0.60
x265 [info]: tools: rd=2 psy-rd=2.00 rskip signhide tmvp fast-intra
x265 [info]: tools: strong-intra-smoothing lslices=6 deblock sao
[aac @ 0000018666772200] Sample rate index in program config element does not match the sample rate index configured by the container.
[18:31:58] sync: first pts audio 0x241 is 0
[18:31:58] sync: first pts video is 34417
[02:49:16] 8684.324219s: Video -> Film
[02:49:21] 8686.693359s: Film -> Video
[02:49:27] 8689.329102s: Video -> Film
[02:49:28] 8690.030273s: Film -> Video
[02:49:30] 8690.831055s: Video -> Film
[02:49:30] 8691.030273s: Film -> Video
[02:49:39] 8695.501953s: Video -> Film
[02:49:42] 8696.870117s: Film -> Video
[02:52:45] 8761.133789s: Video -> Film
[02:52:46] 8762.168945s: Film -> Video
[02:52:49] 8763.302734s: Video -> Film
[02:53:12] 8772.178711s: Film -> Video
[02:53:14] 8772.812500s: Video -> Film
[02:53:50] 8785.692383s: Film -> Video
[02:53:52] 8786.326172s: Video -> Film
[02:53:57] 8788.862305s: Film -> Video
[02:54:00] 8789.496094s: Video -> Film
[02:54:25] 8797.704102s: Film -> Video
[02:54:34] 8800.840820s: Video -> Film
[02:56:15] 8832.572266s: Film -> Video
[02:56:18] 8833.373047s: Video -> Film
[02:56:19] 8833.907227s: Film -> Video
[02:56:21] 8834.541016s: Video -> Film
[02:56:31] 8838.578125s: Film -> Video
[02:56:41] 8842.214844s: Video -> Film
[02:56:53] 8846.585938s: Film -> Video
[02:58:57] 8887.960938s: Video -> Film
[02:59:02] 8889.496094s: Film -> Video
[02:59:04] 8890.029297s: Video -> Film
[02:59:07] 8891.397461s: Film -> Video
[02:59:10] 8892.032227s: Video -> Film
[02:59:10] 8892.231445s: Film -> Video
[02:59:11] 8892.732422s: Video -> Film
[02:59:11] 8892.932617s: Film -> Video
[02:59:15] 8894.034180s: Video -> Film
[02:59:19] 8895.735352s: Film -> Video
[02:59:21] 8896.302734s: Video -> Film
[02:59:26] 8897.837891s: Film -> Video
[02:59:28] 8898.371094s: Video -> Film
[02:59:31] 8899.572266s: Film -> Video
[02:59:32] 8900.073242s: Video -> Film
[02:59:35] 8901.108398s: Film -> Video
[02:59:37] 8901.641602s: Video -> Film
[02:59:40] 8903.009766s: Film -> Video
[02:59:42] 8903.577148s: Video -> Film
[02:59:48] 8905.445313s: Film -> Video
[02:59:54] 8907.514648s: Video -> Film
[03:00:02] 8910.883789s: Film -> Video
[03:00:09] 8913.019531s: Video -> Film
[03:00:11] 8913.386719s: Film -> Video
[03:00:12] 8914.020508s: Video -> Film
[03:00:15] 8914.887695s: Film -> Video
[03:00:16] 8915.488281s: Video -> Film
[03:00:18] 8915.855469s: Film -> Video
[03:00:20] 8916.623047s: Video -> Film
[03:00:22] 8917.490234s: Film -> Video
[03:00:25] 8918.257813s: Video -> Film
[03:00:28] 8919.291992s: Film -> Video
[03:00:29] 8919.792969s: Video -> Film
[03:00:33] 8920.994141s: Film -> Video
[03:00:35] 8921.627930s: Video -> Film
[03:00:40] 8923.329102s: Film -> Video
[03:04:08] hb_ts_stream_decode - eof
[03:04:08] hb_ts_stream_decode - eof
[03:04:08] reader: done. 1 scr changes
[aac @ 0000018666772200] decode_band_types: Input buffer exhausted before END element found
[03:04:19] work: average encoding speed for job is 8.758710 fps
[03:04:19] comb detect: heavy 256546 | light 5979 | uncombed 5211 | total 267736
[03:04:19] decomb: deinterlaced 513092 | blended 11958 | unfiltered 5211 | total 530261
[03:04:19] vfr: 540157 frames output, 1 dropped and 9897 duped for CFR/PFR
[03:04:19] vfr: lost time: 4429425 (0 frames)
[03:04:19] vfr: gained time: 4429425 (5884 frames) (0 not accounted for)
[03:04:19] stream: 269217 good frames, 0 errors (0%)
[03:04:19] aac-decoder done: 421982 frames, 0 decoder errors
[03:04:19] mpeg2video-decoder done: 269210 frames, 0 decoder errors
[03:04:19] sync: got 269210 frames, 269058 expected
[03:04:19] sync: framerate min 9.990 fps, max 29.970 fps, avg 29.903 fps
[aac @ 0000018666776b00] Qavg: 829.106
x265 [info]: frame I:   2753, Avg QP:21.89  kb/s: 33728.24
x265 [info]: frame P: 108400, Avg QP:22.96  kb/s: 19663.71
x265 [info]: frame B: 429004, Avg QP:27.19  kb/s: 6139.95
x265 [info]: Weighted P-Frames: Y:14.7% UV:13.6%
x265 [info]: consecutive B-frames: 2.7% 0.6% 0.5% 0.6% 95.6%
encoded 540157 frames in 30741.02s (17.57 fps), 8994.54 kb/s, Avg QP:26.31
[03:04:19] mux: track 0, 540157 frames, 10123956913 bytes, 8996.07 kbps, fifo 2048
[03:04:19] mux: track 1, 421995 frames, 535135546 bytes, 475.52 kbps, fifo 2048
[03:04:19] Finished work at: Thu May 21 03:04:19 2020
[03:04:19] libhb: work result = 0

# Encode Completed ...
Woodstock
Veteran User
Posts: 4614
Joined: Tue Aug 27, 2013 6:39 am

Re: Random jagged frames when encoding 1080i footage

Post by Woodstock »

Try turning off Comb Detect. That forces the decomb/deinterlace to be applied to ALL frames, not just those that are obvious to the filter.
kenzarxv
Posts: 4
Joined: Thu May 21, 2020 9:09 am

Re: Random jagged frames when encoding 1080i footage

Post by kenzarxv »

Woodstock wrote: Thu May 21, 2020 12:30 pm Try turning off Comb Detect. That forces the decomb/deinterlace to be applied to ALL frames, not just those that are obvious to the filter.
Made a quick 120 second preview and it works perfectly! Will try to re-encode completely. Thanks for the help!
mduell
Veteran User
Posts: 8187
Joined: Sat Apr 21, 2007 8:54 pm

Re: Random jagged frames when encoding 1080i footage

Post by mduell »

Unless you're trying to take this into an editor (in which case you're using the wrong settings otherwise), don't force constant framerate, use variable (peak) framerate.
kenzarxv
Posts: 4
Joined: Thu May 21, 2020 9:09 am

Re: Random jagged frames when encoding 1080i footage

Post by kenzarxv »

mduell wrote: Thu May 21, 2020 2:55 pm Unless you're trying to take this into an editor (in which case you're using the wrong settings otherwise), don't force constant framerate, use variable (peak) framerate.
Does it make a big difference with the file size or quality?
mduell
Veteran User
Posts: 8187
Joined: Sat Apr 21, 2007 8:54 pm

Re: Random jagged frames when encoding 1080i footage

Post by mduell »

Small improvements to filesize and playback smoothness.
kenzarxv
Posts: 4
Joined: Thu May 21, 2020 9:09 am

Re: Random jagged frames when encoding 1080i footage

Post by kenzarxv »

mduell wrote: Thu May 21, 2020 3:38 pm Small improvements to filesize and playback smoothness.
Will try to experiment with my next encode. Still trying to find the sweet spot. Thanks!
Post Reply