h265 encoder questions - am I doing it right?

General questions or discussion about HandBrake, Video and/or audio transcoding, trends etc.
Post Reply
basementjack
Posts: 9
Joined: Fri Dec 20, 2019 3:19 pm

h265 encoder questions - am I doing it right?

Post by basementjack »

Description of problem or question:

Is Constant Quality relative to the encoder being used?
ie would CQ of 21 on NVEnc h265 produce the same output quality as CQ 21 using software h.265?

The reason I ask is I am getting vastly different file sizes. I've read that NVEnc is faster, but produces larger files, and I was prepared for some variance, but this seems too good to be true...


Steps to reproduce the problem (If Applicable):
  • The original source with audio is 24GB
  • converted to h265 using NVEnc, and a quality setting of 21 : 4.82GB
  • converted to h265 with software encoder (8bit) "Slow", CQ21: 1.68GB
  • converted to h265 with software encoder (10bit) "Slow", CQ21: 1.72GB

HandBrake version 1.3.0

Operating system and version windows 10 64 bit 1909:

HandBrake Activity Log:
(I did two software encodes overnight, the log below appears to be from the 10 bit encode)

Code: Select all

HandBrake 1.3.0 (2019110900)
OS: Microsoft Windows NT 10.0.18363.0
CPU: Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz
Ram: 32685 MB, 
GPU Information:
  NVIDIA GeForce RTX 2080 Ti - 26.21.14.4166
Screen: 5120x2160
Temp Dir: C:\Users\user1\AppData\Local\Temp\
Install Dir: C:\Program Files\HandBrake
Data Dir: C:\Users\user1\AppData\Roaming\HandBrake

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


# Starting Encode ...

[01:28:57] base preset: CQ 22 HQ 1080p H.265 Nvidia (Modified)
[01:28:57] hb_init: starting libhb thread
[01:28:57] Starting work at: Fri Dec 20 01:28:57 2019
[01:28:57] 1 job(s) to process
[01:28:57] json job:
{
  "Audio": {
    "AudioList": [
      {
        "DRC": 0.0,
        "Encoder": "copy",
        "Gain": 0.0,
        "Mixdown": -1,
        "NormalizeMixLevel": false,
        "Samplerate": 0,
        "Track": 0,
        "DitherMethod": 0
      }
    ],
    "CopyMask": [
      "copy:aac",
      "copy:ac3",
      "copy:dtshd",
      "copy:dts",
      "copy:eac3",
      "copy:flac",
      "copy:mp3",
      "copy:truehd"
    ],
    "FallbackEncoder": "none"
  },
  "Destination": {
    "ChapterList": [
      {
        "Name": "Chapter 1"
      },
      {
        "Name": "Chapter 2"
      },
      {
        "Name": "Chapter 3"
      },
      {
        "Name": "Chapter 4"
      },
      {
        "Name": "Chapter 5"
      },
      {
        "Name": "Chapter 6"
      },
      {
        "Name": "Chapter 7"
      },
      {
        "Name": "Chapter 8"
      },
      {
        "Name": "Chapter 9"
      },
      {
        "Name": "Chapter 10"
      },
      {
        "Name": "Chapter 11"
      },
      {
        "Name": "Chapter 12"
      },
      {
        "Name": "Chapter 13"
      },
      {
        "Name": "Chapter 14"
      },
      {
        "Name": "Chapter 15"
      },
      {
        "Name": "Chapter 16"
      },
      {
        "Name": "Chapter 17"
      },
      {
        "Name": "Chapter 18"
      },
      {
        "Name": "Chapter 19"
      },
      {
        "Name": "Chapter 20"
      },
      {
        "Name": "Chapter 21"
      }
    ],
    "ChapterMarkers": true,
    "AlignAVStart": false,
    "File": "C:\\Users\\user1\\Videos\\Before I Fall-21 software 10 bit base slow.mkv",
    "Mp4Options": {
      "IpodAtom": false,
      "Mp4Optimize": false
    },
    "Mux": "mkv"
  },
  "Filters": {
    "FilterList": [
      {
        "ID": 12,
        "Settings": {
          "crop-bottom": "140",
          "crop-left": "0",
          "crop-right": "0",
          "crop-top": "140",
          "height": "800",
          "width": "1920"
        }
      },
      {
        "ID": 6,
        "Settings": {
          "mode": "0"
        }
      }
    ]
  },
  "PAR": {
    "Num": 1,
    "Den": 1
  },
  "Metadata": {},
  "SequenceID": 0,
  "Source": {
    "Angle": 1,
    "Range": {
      "Type": "chapter",
      "Start": 1,
      "End": 21
    },
    "Title": 26,
    "Path": "\\\\server\\share\\BEFORE_I_FALL.iso"
  },
  "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_10bit",
    "Level": "auto",
    "TwoPass": false,
    "Turbo": false,
    "ColorMatrixCode": 0,
    "Options": "",
    "Preset": "slow",
    "Profile": "auto",
    "Quality": 21.0,
    "QSV": {
      "Decode": false,
      "AsyncDepth": 0
    }
  }
}
[01:28:57] CPU: Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz
[01:28:57]  - Intel microarchitecture Kaby Lake
[01:28:57]  - logical processor count: 8
[01:28:57] Intel Quick Sync Video support: no
[01:28:57] hb_scan: path=\\server\share\BEFORE_I_FALL.iso, title_index=26
src/libbluray/bdj/bdj.c:133: Error opening registry key SOFTWARE\JavaSoft\Java Runtime Environment\
src/libbluray/bdj/bdj.c:746: BD-J check: Failed to load JVM library
src/libbluray/bdj/bdj.c:133: Error opening registry key SOFTWARE\JavaSoft\Java Runtime Environment\
src/libbluray/bdj/bdj.c:746: BD-J check: Failed to load JVM library
[01:28:57] scan: BD has 27 title(s)
[01:28:57] bd: scanning title 26
[01:28:57] bd: playlist 00800.MPLS
[01:28:57] bd: duration is 01:38:47 (5927963 ms)
[01:28:57] bd: video id=0x1011, stream type=H.264, format 1080p
[01:28:57] bd: aspect = 16:9
[01:28:57] bd: audio id=0x711100, lang=English (DTS), 3cc=eng
[01:28:57] bd: audio id=0x1100, lang=English (DTS-HD MA), 3cc=eng
[01:28:57] bd: subtitle id=0x1200, lang=English [PGS], 3cc=eng
[01:28:57] bd: subtitle id=0x1201, lang=español [PGS], 3cc=spa
[01:28:57] bd: chap 1, 323448 ms
[01:28:57] bd: chap 2, 289872 ms
[01:28:57] bd: chap 3, 241199 ms
[01:28:57] bd: chap 4, 489155 ms
[01:28:57] bd: chap 5, 298256 ms
[01:28:57] bd: chap 6, 379420 ms
[01:28:57] bd: chap 7, 240031 ms
[01:28:57] bd: chap 8, 219761 ms
[01:28:57] bd: chap 9, 316649 ms
[01:28:57] bd: chap 10, 285076 ms
[01:28:57] bd: chap 11, 325366 ms
[01:28:57] bd: chap 12, 165582 ms
[01:28:57] bd: chap 13, 273815 ms
[01:28:57] bd: chap 14, 263930 ms
[01:28:57] bd: chap 15, 278361 ms
[01:28:57] bd: chap 16, 280363 ms
[01:28:57] bd: chap 17, 199240 ms
[01:28:57] bd: chap 18, 274649 ms
[01:28:57] bd: chap 19, 455413 ms
[01:28:57] bd: chap 20, 328119 ms
[01:28:57] bd: chap 21, 250 ms
[01:28:57] bd: title 26 has 21 chapters
[01:28:57] scan: decoding previews for title 26
[01:28:57] scan: title angle(s) 1
[01:28:57] scan: audio 0x711100: dca, rate=48000Hz, bitrate=1536000 English (DTS) (5.1 ch) (1536 kbps)
[01:28:57] scan: audio 0x1100: dca, rate=48000Hz, bitrate=1 English (DTS-HD MA) (5.1 ch)
[01:28:59] scan: 10 previews, 1920x1080, 23.976 fps, autocrop = 140/140/0/10, aspect 16:9, PAR 1:1
[01:28:59] scan: supported video decoders: avcodec qsv
[01:28:59] stream: 10 good frames, 0 errors (0%)
[01:28:59] libhb: scan thread found 1 valid title(s)
[01:28:59] Starting Task: Encoding Pass
[01:28:59] Skipping vfr filter
[01:28:59] Auto Passthru: allowed codecs are AAC, AC3, E-AC3, TrueHD, DTS, DTS-HD, MP3, FLAC
[01:28:59] Auto Passthru: fallback is None
[01:28:59] Auto Passthru: using DTS Passthru for track 1
[01:28:59] job configuration:
[01:28:59]  * source
[01:28:59]    + \\server\share\BEFORE_I_FALL.iso
[01:28:59]    + title 26, chapter(s) 1 to 21
[01:28:59]  * destination
[01:28:59]    + C:\Users\user1\Videos\Before I Fall-21 software 10 bit base slow.mkv
[01:28:59]    + container: Matroska (libavformat)
[01:28:59]      + chapter markers
[01:28:59]  * video track
[01:28:59]    + decoder: h264
[01:28:59]      + bitrate 200 kbps
[01:28:59]    + filters
[01:28:59]      + Crop and Scale (width=1920:height=800:crop-top=140:crop-bottom=140:crop-left=0:crop-right=0)
[01:28:59]        + source: 1920 * 1080, crop (140/140/0/0): 1920 * 800, scale: 1920 * 800
[01:28:59]    + Output geometry
[01:28:59]      + storage dimensions: 1920 x 800
[01:28:59]      + pixel aspect ratio: 1 : 1
[01:28:59]      + display dimensions: 1920 x 800
[01:28:59]    + encoder: H.265 10-bit (libx265)
[01:28:59]      + preset:  slow
[01:28:59]      + profile: auto
[01:28:59]      + level:   auto
[01:28:59]      + quality: 21.00 (RF)
[01:28:59]      + color profile: 1-1-1
[01:28:59]  * subtitle track 1, English [PGS] (track 0, id 0x1200, Picture) -> Passthrough
[01:28:59]  * audio track 1
[01:28:59]    + decoder: English (DTS) (5.1 ch) (1536 kbps) (track 1, id 0x711100)
[01:28:59]      + bitrate: 1536 kbps, samplerate: 48000 Hz
[01:28:59]    + DTS Passthru
src/libbluray/bdj/bdj.c:133: Error opening registry key SOFTWARE\JavaSoft\Java Runtime Environment\
src/libbluray/bdj/bdj.c:746: BD-J check: Failed to load JVM library
src/libbluray/bdj/bdj.c:133: Error opening registry key SOFTWARE\JavaSoft\Java Runtime Environment\
src/libbluray/bdj/bdj.c:746: BD-J check: Failed to load JVM library
[01:28:59] sync: expecting 142128 video frames
x265 [info]: HEVC encoder version 3.2.1+1-b5c86a64bbbe
x265 [info]: build info [Windows][GCC 8.3.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 (Main tier)
x265 [info]: Thread pool created using 8 threads
x265 [info]: Slices                              : 1
x265 [info]: frame threads / pool features       : 3 / wpp(13 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         : star / 57 / 3 / 3
x265 [info]: Keyframe min / max / scenecut / bias: 24 / 240 / 40 / 5.00
x265 [info]: Lookahead / bframes / badapt        : 25 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
x265 [info]: References / ref-limit  cu / depth  : 4 / on / on
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 2 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : CRF-21.0 / 0.60
x265 [info]: tools: rect limit-modes rd=4 psy-rd=2.00 rdoq=2 psy-rdoq=1.00
x265 [info]: tools: rskip signhide tmvp strong-intra-smoothing lslices=4
x265 [info]: tools: deblock sao
[01:28:59] sync: first pts video is 0
[01:28:59] sync: "Chapter 1" (1) at frame 1 time 0
[01:28:59] sync: first pts audio 0x711100 is 0
[01:30:19] sync: first pts subtitle 0x1200 is 5758252
[01:36:11] sync: "Chapter 2" (2) at frame 7756 time 29110331
[01:45:10] sync: "Chapter 3" (3) at frame 14706 time 55198893
[01:51:19] sync: "Chapter 4" (4) at frame 20489 time 76906830
[02:05:05] sync: "Chapter 5" (5) at frame 32217 time 120930810
[02:11:52] sync: "Chapter 6" (6) at frame 39368 time 147773876
[02:21:26] sync: "Chapter 7" (7) at frame 48465 time 181921740
[02:26:08] sync: "Chapter 8" (8) at frame 54220 time 203524571
[02:31:53] sync: "Chapter 9" (9) at frame 59489 time 223303080
[02:36:49] sync: "Chapter 10" (10) at frame 67067 time 251748997
[02:42:53] sync: "Chapter 11" (11) at frame 73916 time 277458431
[02:49:39] sync: "Chapter 12" (12) at frame 81717 time 306741435
[02:53:34] sync: "Chapter 13" (13) at frame 85687 time 321643822
[02:57:51] sync: "Chapter 14" (14) at frame 92252 time 346287191
[03:03:34] sync: "Chapter 15" (15) at frame 98580 time 370040921
[03:08:14] sync: "Chapter 16" (16) at frame 105237 time 395029635
[03:13:51] sync: "Chapter 17" (17) at frame 111967 time 420292372
[03:17:41] sync: "Chapter 18" (18) at frame 116753 time 438257820
[03:24:26] sync: "Chapter 19" (19) at frame 123338 time 462976263
[03:35:19] sync: "Chapter 20" (20) at frame 134234 time 503877123
[03:38:12] bd: End of title
[03:38:12] reader: done. 1 scr changes
[03:38:14] work: average encoding speed for job is 18.323442 fps
[03:38:14] stream: 142129 good frames, 0 errors (0%)
[03:38:14] dca-decoder done: 555747 frames, 0 decoder errors
[03:38:14] h264-decoder done: 142129 frames, 0 decoder errors
[03:38:14] sync: got 142129 frames, 142128 expected
[03:38:14] sync: framerate min 23.976 fps, max 23.976 fps, avg 23.976 fps
x265 [info]: frame I:   1152, Avg QP:19.80  kb/s: 8001.75
x265 [info]: frame P:  31440, Avg QP:21.36  kb/s: 2584.82
x265 [info]: frame B: 109537, Avg QP:26.60  kb/s: 409.30
x265 [info]: Weighted P-Frames: Y:4.7% UV:3.1%
x265 [info]: consecutive B-frames: 5.9% 2.5% 6.5% 19.6% 65.4%
encoded 142129 frames in 7755.40s (18.33 fps), 952.08 kb/s, Avg QP:25.38
[03:38:14] mux: track 0, 142129 frames, 706059039 bytes, 952.85 kbps, fifo 2048
[03:38:14] mux: track 1, 555747 frames, 1118162964 bytes, 1508.99 kbps, fifo 8192
[03:38:14] mux: track 2, 2793 frames, 28443639 bytes, 38.39 kbps, fifo 64
[03:38:14] Finished work at: Fri Dec 20 03:38:14 2019
[03:38:14] libhb: work result = 0

# Encode Completed ...

# Performing 'When Done' Action: 2



User avatar
s55
HandBrake Team
Posts: 10357
Joined: Sun Dec 24, 2006 1:05 pm

Re: h265 encoder questions - am I doing it right?

Post by s55 »

ie would CQ of 21 on NVEnc h265 produce the same output quality as CQ 21 using software h.265?
Nope, it's not the same. Even for a given encoder, if you change the parameters of that encoder, it affects the quality scale somewhat.
For example, x264 Preset: Slow at RF22 will give a fairly different filesize than Preset: Ultrafast at RF22
(This happens due to the faster settings, turning off features that affect compression and quality.)


For each setup you create, you want to adjust the quality to meet your needs / filesize goals and don't get caught out with a placebo effect that tricks you into thinking something is worse because of a +/- X point difference.

Also note, hardware encoders are optimised for speed and thus, still can't match software encoders for optimal quality/filesize. While they are not bad for many common use-cases, don't expect the levels of output from a mature encoder, say x264
basementjack
Posts: 9
Joined: Fri Dec 20, 2019 3:19 pm

Re: h265 encoder questions - am I doing it right?

Post by basementjack »

Thanks s55!

This is good info to know!

I agree with statements I've read that encourage people not to compare two stills side by side trying to fault find.

Right now my measure of quality is the opening scene of "before I fall" at about the 52 second mark Zoey Deutch is darkly lit in front of a dark blue curtain. With all the NVENC settings I've tried, there is noticeable banding in the curtains and also something distracting with her forehead. (I've tried all the way down/up to CQ1 with HQ for NVENC)

Now I'm working through the software encoder options - Slow CQ21 was pretty bad but the other end of the spectrum around CQ2 shows some promise, so now I just need to tinker with settings a bit and figure out where the sweet spot is.
Deleted User 13735

Re: h265 encoder questions - am I doing it right?

Post by Deleted User 13735 »

There is no correlation.
A really rough estimate is to start with your hardware CQ five points lower than x264 software CRF. In other words, CRF 21 ~= CQ 16.

That's a "kinda-maybe" guess based on experience, not quantified testing.
Your mileage will vary.
Post Reply