This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

[BUG] NVEnc h.265 - adaptive quantization scheint nicht zu funktionieren
#1
Hi,

egal welchen Wert ich in Hybrid bei NVEnc bei adaptive quantization --aq-strength einstelle, ob ich zusätzlich --aq-temporal verwende oder nur --aq-temporal verwende, es wird immer ein aufs Byte gleich großes file erzeugt. CRC32 ist allerdings unterschiedlich, aber das dürfte keine Bedeutung haben.
Das lässt vermuten, dass adaptive quantization überhaupt nicht funktioniert. Lasse ich aq nämlich ganz weg ist das file ebenfalls exakt gleich groß.
Jedenfalls nicht mit meiner Konfiguration. Keine Ahnung was da falsch läuft, ich kann's jedenfalls so einstellen.
Grafikkarte ist NVidia RTX A2000 6GB. Nvidia Treiber der neueste, Windows 10.

Anbei ein paar report files. Aus irgendwelchen Gründen wird kein Debug file erzeugt, obwohl unter "Internals" angehakt...

Ist mit verschiedenen Quellen passiert.

EDIT: Gerade den Grund gefunden, warum keine Debugs erzeugt werden.Jetzt sind auch debug files angehangen.


Gruß, mogobime


Attached Files
.7z   NVEnc_aq_problem.7z (Size: 2,26 KB / Downloads: 7)
.7z   NVENC AQ PROBLEM DEBUG.7z (Size: 33,99 KB / Downloads: 5)
Reply
#2
NVEncC meldet:
OS Version Windows 10 x64 (19043) [UTF-8] CPU AMD FX(tm)-8350 Eight-Core Processor [4.53GHz] (4C/8T) GPU #0: NVIDIA RTX A2000 (3328 cores, 1200 MHz)[PCIe2x16][596.59] NVENC / CUDA NVENC API 13.0, CUDA 13.2, schedule mode: sync Input Buffers CUDA, 38 frames Input Info y4m(yv12(10bit))->p010 [SSE2], 3840x1608, 24/1 fps Vpp Filters copyDtoD Output Info H.265/HEVC main10 @ Level auto 3840x1608p 1:1 24.000fps (24/1fps) Encoder Preset default Rate Control VBR Multipass none Bitrate 0 kbps (Max: 96000 kbps) Target Quality 27.00 QP range I:0-63 P:0-63 B:0-63 QP Offset cb:0 cr:0 VBV buf size auto Split Enc Mode auto Tuning Info hq Lookahead on, 24 frames, Level 2, Adaptive I, B Insert GOP length 1200 frames B frames 5 frames [ref mode: middle] Ref frames 6 frames, MultiRef L0:6 L1:2 AQ on (spatial, temporal, strength 1) CU max / min 32 / auto VUI matrix:bt2020nc,range:limited Others mv:Q-pel tf4
und mit:
NVEnc --y4m -i - --fps 24.000 --codec h265 --profile main10 --level auto --tier high --sar 1:1 --lookahead 24 --output-depth 10 --vbr 0 --vbr-quality 27.00 --aq --aq-strength 9 --aq-temporal --gop-len 1200 --ref 6 --multiref-l0 6 --multiref-l1 6 --bframes 5 --bref-mode auto --lookahead 24 --mv-precision Q-pel --tf-level 4 --lookahead-level 2 --preset default --colorrange limited --colormatrix bt2020nc --colorrange limited --cuda-schedule sync
NVEncC (x64) 9.10 (r3505) by rigaya, Jan 15 2026 11:50:03 (VC 1944/Win) OS Version Windows 10 x64 (19043) [UTF-8] CPU AMD FX(tm)-8350 Eight-Core Processor [4.49GHz] (4C/8T) GPU #0: NVIDIA RTX A2000 (3328 cores, 1200 MHz)[PCIe2x16][596.59] NVENC / CUDA NVENC API 13.0, CUDA 13.2, schedule mode: sync Input Buffers CUDA, 38 frames Input Info y4m(yv12(10bit))->p010 [SSE2], 3840x1608, 24/1 fps Vpp Filters copyDtoD Output Info H.265/HEVC main10 @ Level auto 3840x1608p 1:1 24.000fps (24/1fps) Encoder Preset default Rate Control VBR Multipass none Bitrate 0 kbps (Max: 96000 kbps) Target Quality 27.00 QP range I:0-63 P:0-63 B:0-63 QP Offset cb:0 cr:0 VBV buf size auto Split Enc Mode auto Tuning Info hq Lookahead on, 24 frames, Level 2, Adaptive I, B Insert GOP length 1200 frames B frames 5 frames [ref mode: middle] Ref frames 6 frames, MultiRef L0:6 L1:2 AQ on (spatial, temporal, strength 9) CU max / min 32 / auto VUI matrix:bt2020nc,range:limited Others mv:Q-pel tf4
Sieht nicht nach einem Bug in Hybrid aus oder wie NVEncC aufgerufen wird.

Wenn ich hier unterschiedliche Werte verwende (Geforce RTX4080), become ich folggendes:
  • --aq --aq-strength 5: 1342
  • --aq --aq-strength 15: 1726
  • withhout: 1201
mein Aufruf sah wie folgt aus (mit angepassten strength Werten):
NVEnc --y4m -i - --fps 25.000 --codec h265 --profile main --level auto --tier high --sar 1:1 --lookahead 32 --output-depth 10 --vbr 0 --vbr-quality 23.00 --gop-len 0 --ref 6 --multiref-l0 3 --multiref-l1 3 --bframes 3 --bref-mode auto --no-b-adapt --lookahead 32 --mv-precision Q-pel --lookahead-level 0 --preset quality --colorrange limited --colormatrix smpte170m --colorrange limited --cuda-schedule sync --keyfile GENERATED_KEY_FILE --output "J:\tmp\without.265"
Ich vermute, dass es kein generelles Problem in NVEncC, sondern eher ein Treiberproblem. (ich verwende aktuell v6.10.47 studio drivers)

Eventuell meldet NVEncC auch, dass AQ nicht unterstützt wird und Hybrid macht den Fehler es zu melden, wenn es nicht der Fall ist:
Was meldet
NVEncC --check-features
bei Dir?
Ich erhalte, z.B.:
NVEncC (x64) 9.17 (r3600) by rigaya, Jun 7 2026 02:14:21 (VC 1944/Win) [NVENC API v13.0, CUDA 11.8] reader: raw, y4m, avi, avs, vpy, avsw, avhw [H.264/AVC, H.265/HEVC, MPEG2, VP8, VP9, VC-1, MPEG1, MPEG4, AV1] others nvml : yes nvrtc : yes nvvfx : yes ngx : yes nvof fruc : yes libass : yes libdovi : yes d3d11 : yes libplacebo : yes vmaf : yes Environment Info OS : Windows 11 x64 (26200) [UTF-8] CPU: AMD Ryzen 9 7950X 16-Core Processor [5.51GHz] (16C/32T) RAM: Used 12639 MB, Total 64599 MB #0: NVIDIA GeForce RTX 4080 (9728 cores, 2505 MHz)[PCIe4x16][610.47] NVEnc features Codec: H.264/AVC Encoder Engines 2 Max Bframes 7 B Ref Mode 3 (each + only middle) RC Modes 3 (CQP, CBR, VBR) Field Encoding 0 (no) MonoChrome no Alpha Channel no FMO no Quater-Pel MV yes B Direct Mode yes CABAC yes Adaptive Transform yes Max Temporal Layers 4 Hierarchial P Frames yes Hierarchial B Frames yes Max Level 62 (6.2) Min Level 10 (1) 4:4:4 yes 4:2:2 no Min Width 145 Max Width 4096 Min Height 49 Max Height 4096 Multiple Refs yes Max LTR Frames 8 Dynamic Resolution Change yes Dynamic Bitrate Change yes Forced constant QP yes Dynamic RC Mode Change no Subframe Readback yes Constrained Encoding yes Intra Refresh yes Custom VBV Bufsize yes Dynamic Slice Mode yes Ref Pic Invalidiation yes PreProcess no Async Encoding yes Max MBs 65536 Lossless yes SAO no Me Only Mode 1 (I,P frames) Lookahead yes AQ (temporal) yes Weighted Prediction yes Temporal Filter yes Lookahead Level no Undirectional B no Temporal SVC yes MV-HEVC no 10bit depth no Codec: H.265/HEVC Encoder Engines 2 Max Bframes 5 B Ref Mode 3 (each + only middle) RC Modes 3 (CQP, CBR, VBR) Field Encoding 0 (no) MonoChrome no Alpha Channel yes Quater-Pel MV yes B Direct Mode no Max Temporal Layers 4 Hierarchial P Frames no Hierarchial B Frames no Max Level 186 (6.2) Min Level 30 (1) 4:4:4 yes 4:2:2 no Min Width 129 Max Width 8192 Min Height 33 Max Height 8192 Multiple Refs yes Max LTR Frames 7 Dynamic Resolution Change yes Dynamic Bitrate Change yes Forced constant QP yes Dynamic RC Mode Change no Subframe Readback yes Constrained Encoding yes Intra Refresh yes Custom VBV Bufsize yes Dynamic Slice Mode yes Ref Pic Invalidiation yes PreProcess no Async Encoding yes Max MBs 262144 Lossless yes SAO yes Me Only Mode 1 (I,P frames) Lookahead yes AQ (temporal) yes Weighted Prediction yes Temporal Filter yes Lookahead Level yes Undirectional B yes Temporal SVC yes MV-HEVC yes 10bit depth yes Codec: AV1 Encoder Engines 2 Max Bframes 31 B Ref Mode 7 ((null)) RC Modes 3 (CQP, CBR, VBR) Field Encoding 0 (no) MonoChrome no Alpha Channel no Quater-Pel MV yes B Direct Mode no Max Temporal Layers 3 Hierarchial P Frames no Hierarchial B Frames no Max Level 23 ((null)) Min Level 0 (2) 4:4:4 no 4:2:2 no Min Width 192 Max Width 8192 Min Height 128 Max Height 8192 Multiple Refs yes Max LTR Frames 6 Dynamic Resolution Change yes Dynamic Bitrate Change yes Forced constant QP yes Dynamic RC Mode Change no Subframe Readback yes Constrained Encoding no Intra Refresh yes Custom VBV Bufsize yes Dynamic Slice Mode no Ref Pic Invalidiation yes PreProcess no Async Encoding yes Max MBs 262144 Lossless no SAO no Me Only Mode 0 (no) Lookahead yes AQ (temporal) yes Weighted Prediction no Temporal Filter yes Lookahead Level yes Undirectional B no Temporal SVC yes MV-HEVC no 10bit depth yes
Ich lade eine neue dev Version hoch (sollte so in ner Stunde oben sein), welche mit der neusten NVEncC Version kommt.
Versuch bitte, ob die eventuell das Problem schon behebt.
(Deinstalliere die normale Version bevor Du die Dev Verison installierst.)

Wenn es kein Fehler in Hybrid ist, werde ich einen issue tracker Eintrag bei github machen. Vielleicht kann der Author (rigaya) von NVEncC mehr dazu sagen.

Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Offline between (including) 29th of June and 5th of July => RochHarz Festival
Reply
#3
Was mir auf die schnelle in report files auch noch aufgefallen ist, und mit der Hybrid Oberfläche zu tun haben sollte:

multiref(L1) is lowered 6 -> 2 due to HEVC spec.

Hier scheint Hybrid einen Werte einstellen zu lassen, die nicht mit den specs konform sind. Lässt sich wohl am leichtesten fixen, vorausgesetzt man findet/kennt die specs dazu...

Was ich zweitens auch noch auf die schnelle als äußern kann:
Bin neuerdings dazu übergegangen
--tf-level 4
--lookahead-level 2
zu nutzen, da ich den Eindruck habe, dass es ordentlich was bei der bitrate bei passablem Geschwindigkeitseinbruch bringt.
Vorausgesetzt ich passe auch
--lookahead 24
an. Etwas weniger oder gar Standard 16 oder ein Erhöhen auf 32 führen zu krassen Geschwindigkeitseinbrüchen.
--lookahead-level und --lookahead scheinen so stark voneinander abzuhängen, dass man fast --lookahead-level 2 und --lookahead 24 als Standard empfehlen könnte,...
Macht kaum einen Unterschied zum Standard
--lookahead-level 0 
--lookahead 16
komprimiert aber deutlich besser. Und das selbst auf meiner in die Jahre gekommenen RTX A2000... Es sei denn, das geht alles darauf zurück, dass AQ nur beim lookahead-level 2 nicht funktioniert. Aber dass durch Nichtnutzung von AQ die Dateigröße bei identischer vbr-quality schrumpft?!? Hört sich erstmal komisch an.

--tf-level 4 und --lookahead-level 2 habe ich jedenfalls in der Vergangenheit ignoriert, und da habe ich es schon so in Erinnerung, dass schrauben an AQ Parametern deutlich das Ergebnis/die Dateigröße beeinflusst hat.

NVEncC --check-features NVEncC (x64) 9.10 (r3505) by rigaya, Jan 15 2026 11:50:03 (VC 1944/Win)   [NVENC API v13.0, CUDA 11.8] reader: raw, y4m, avi, avs, vpy, avsw, avhw [H.264/AVC, H.265/HEVC, MPEG2, VP8, VP9, VC-1, MPEG1, MPEG4, AV1] others   nvml      : yes   nvrtc      : yes   nvvfx      : yes   ngx        : yes   nvof fruc  : yes   libass    : yes   libdovi    : yes   d3d11      : yes   libplacebo : yes   vmaf      : yes Environment Info OS : Windows 10 x64 (19043) [UTF-8] CPU: AMD FX(tm)-8350 Eight-Core Processor [4.53GHz] (4C/8T) RAM: Used 8590 MB, Total 32660 MB #0: NVIDIA RTX A2000 (3328 cores, 1200 MHz)[PCIe2x16][596.59] NVEnc features Codec: H.264/AVC Encoder Engines          1 Max Bframes              4 B Ref Mode                3 (each + only middle) RC Modes                  3 (CQP, CBR, VBR) Field Encoding            0 (no) MonoChrome                no Alpha Channel            no FMO                      no Quater-Pel MV            yes B Direct Mode            yes CABAC                    yes Adaptive Transform        yes Max Temporal Layers      4 Hierarchial P Frames      yes Hierarchial B Frames      yes Max Level                62 (6.2) Min Level                10 (1) 4:4:4                    yes 4:2:2                    no Min Width                145 Max Width                4096 Min Height                49 Max Height                4096 Multiple Refs            yes Max LTR Frames            8 Dynamic Resolution Change yes Dynamic Bitrate Change    yes Forced constant QP        yes Dynamic RC Mode Change    no Subframe Readback        yes Constrained Encoding      yes Intra Refresh            yes Custom VBV Bufsize        yes Dynamic Slice Mode        yes Ref Pic Invalidiation    yes PreProcess                no Async Encoding            yes Max MBs                  65536 Lossless                  yes SAO                      no Me Only Mode              1 (I,P frames) Lookahead                yes AQ (temporal)            yes Weighted Prediction      yes Temporal Filter          yes Lookahead Level          no Undirectional B          no Temporal SVC              yes MV-HEVC                  no 10bit depth              no Codec: H.265/HEVC Encoder Engines          1 Max Bframes              5 B Ref Mode                3 (each + only middle) RC Modes                  3 (CQP, CBR, VBR) Field Encoding            0 (no) MonoChrome                no Alpha Channel            yes Quater-Pel MV            yes B Direct Mode            no Max Temporal Layers      4 Hierarchial P Frames      no Hierarchial B Frames      no Max Level                186 (6.2) Min Level                30 (1) 4:4:4                    yes 4:2:2                    no Min Width                129 Max Width                8192 Min Height                33 Max Height                8192 Multiple Refs            yes Max LTR Frames            7 Dynamic Resolution Change yes Dynamic Bitrate Change    yes Forced constant QP        yes Dynamic RC Mode Change    no Subframe Readback        yes Constrained Encoding      yes Intra Refresh            yes Custom VBV Bufsize        yes Dynamic Slice Mode        yes Ref Pic Invalidiation    yes PreProcess                no Async Encoding            yes Max MBs                  262144 Lossless                  yes SAO                      yes Me Only Mode              1 (I,P frames) Lookahead                yes AQ (temporal)            yes Weighted Prediction      yes Temporal Filter          yes Lookahead Level          yes Undirectional B          yes Temporal SVC              yes MV-HEVC                  yes 10bit depth              yes NVDec features   H.264/AVC:  nv12, yv12   H.265/HEVC: nv12, yv12, yv12(10bit), yv12(12bit), yuv444, yuv444(10bit), yuv444(12bit)   MPEG1:      nv12, yv12   MPEG2:      nv12, yv12   MPEG4:      nv12, yv12   VP8:        nv12, yv12   VP9:        nv12, yv12, yv12(10bit), yv12(12bit)   VC-1:      nv12, yv12   AV1:        nv12, yv12, yv12(10bit)

Ich muss übrigens in Hybrid mindestens 5 bframes einstellen, um
--tf-level 4
nutzen zu können, obwohl die Doku sagt, dass man nur >= 4 bframes braucht.
Meine Karte unterstützt wohl ohnehin nur 4, aber die Funktion scheint ihren Dienst zu verrichten und Bitrate zu sparen.
Also bitte nicht beim auswerten von NVEncC --check-features mir im nächsten Schritt diese Funktion zerschiessen, weil ich auf einmal nur noch 4 bframes einstellen kann  Big Grin
Reply
#4
Quote:Ich muss übrigens in Hybrid mindestens 5 bframes einstellen,
Wegen tflevel werde ich auf > 3 ändern.
siehe: https://github.com/rigaya/NVEnc/blob/mas...ions.en.md

Quote:Aber dass durch Nichtnutzung von AQ die Dateigröße bei identischer vbr-quality schrumpft?!? Hört sich erstmal komisch an.
Denke das war mein Fehler,.... (1 (weak) - 15 (strong), 0 = auto)  denke ich hatte da auto verwendet. Smile

Quote:multiref(L1) is lowered 6 -> 2 due to HEVC spec.
Ohne genaue Regeln lasse ich es wie es aktuell ist. Smile

-----
Laut check-features (da wird gesagt aq sollte gehen) ist es kein Hybrid Problem, sondern eher Treiber oder NVEncC Problem.

Cu Selur

Ps.: neue dev hochgeladen, die sollte tf-level ab bframes > 3 unterstützen; Wie gesagt versuch mal mit der dev Version, da dort eine neuere NVEncC verwendet wird.
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Offline between (including) 29th of June and 5th of July => RochHarz Festival
Reply
#5
(Yesterday, 19:48)Selur Wrote:
Quote:Aber dass durch Nichtnutzung von AQ die Dateigröße bei identischer vbr-quality schrumpft?!? Hört sich erstmal komisch an.
Denke das war mein Fehler,.... (1 (weak) - 15 (strong), 0 = auto)  denke ich hatte da auto verwendet. Smile

-----
Laut check-features (da wird gesagt aq sollte gehen) ist es kein Hybrid Problem, sondern eher Treiber oder NVEncC Problem.

Chat-GPT 5 behauptet, dass --aq-strength 0 bei NVEnc h.265 die adaptive quantization komplett abschaltet.
Wie immer weiß ich aber leider nicht, ob der Sachverhalt richtig interpretiert wurde und ich mich auf diese Antwort verlassen kann...

Bei check-features steht bei uns beiden lediglich
AQ (temporal)            yes
und zur spatial AQ wird keine Aussage getroffen...


So wie es aussieht kommt man wohl um weiteres gründliches probieren und vergleichen bei dem Thema erstmal nicht rum...
Reply
#6
Quote:Chat-GPT 5 behauptet, dass --aq-strength 0 bei NVEnc h.265 die adaptive quantization komplett abschaltet.
Würde da eher dem Autor glauben:
https://github.com/rigaya/NVEnc/blob/mas...rength-int
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Offline between (including) 29th of June and 5th of July => RochHarz Festival
Reply
#7
Quote:--aq-strength <int>

Specify the AQ strength. (1 (weak) - 15 (strong), 0 = auto) Default depends on --preset and --tune.
--tune wird nicht verwendet und ich habe gerade gemerkt, dass --preset irgendwann auf default zurückgesprungen ist, statt auf quality zu stehen  Dodgy

Somit sind meine Vergleiche mit aq-strength 0 möglicherweise Schrott.

Trotzdem sollte ja eigentlich ein fest gesetzter Wert bei aq-strength auch bei --preset default die adaptive quantization aktivieren?!? Sollte man meinen...
Wenn dem nicht so ist, wäre es wohl zur Entwirrung beim user sinnvoll adaptive quantization in Hybrid beim falschen Preset auszugrauen.
Vorausgesetzt das ist von Rigaya überhaupt beabsichtigt und kein Bug...

Wäre ja schon ein bißchen dämlich, wenn so ein entscheidendes feature gar nicht funktioniert und man da munter dran rumschraubt, im Glauben daran die Art und Weise wie detaillierte und weniger detaillierte Flächen komprimiert werden, zu beeinflussen und man exakt gar nichts bewirkt...
Kommt ja schonmal vor, dass z.B. bei bestimmtem Bildmaterial Hintergründe / detailarme Flächen hässlich zermatscht werden oder baning Auftritt und man hier gerne durch Absenkung der aq-strength mehr Bits zuweisen möchte, ohne gleich die Gesamtbitrate ansteigen zu lassen.
Oder dass einem detailreiche Bereiche zu unscharf vorkommen und man diesen durch Erhöhung mehr Bits spendieren möchte.

Muss das alles nochmal in Ruhe gründlich angucken...
Reply
#8
"--check-preset-param" schlägt bei mir fehl, hab mal nen Eintrag bei Github angelegt. Angel

Anmerkung:
Mit adaptive quantisation, ist allgemein nicht wirklich vorhersehbar, ob die Nutzung die Datenrate steigert oder nicht.
Ist halt immer die Frage, ob die potenzielle Bitrateneinsparung in einem Bereich, die potenziell höheren Bitrateneinsparung in anderen Bereichen ausgleicht. Smile
Sprich geht da weniger um Einsparungen und mehr um hoffentlich sinnigere Verteilung der Quantisierung im Vergleich zur Verwendung von konstanter Quantisierung. Die Stärke gibt quasi an, wie groß der Spielraum ist bzw. die schnell Anpassungen vorgenommen werden. Problem ist das soweit mir bekannt, da NVIDIA nicht wirklich sagt was sie machen, sondern nur allgemeine Aussagen treffen wie:
Quote:Adaptive Quantization (AQ) helps improve visual quality.

Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Offline between (including) 29th of June and 5th of July => RochHarz Festival
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)