rigaya / NVEnc

NVENCによる高速エンコードの性能実験
https://rigaya34589.blog.fc2.com/blog-category-17.html
Other
1.07k stars 112 forks source link

Versions 7.49 and 7.50 are much slower than 7.48 #580

Closed rainman74 closed 5 months ago

rainman74 commented 5 months ago

Version 7.49 and 7.50 are much slower than 7.48.

Update: Performance drop with --tune hd --tf-level 0 --lookahead 32 --lookahead-level auto ~ 50% !

I'm back to 7.48.

Jigsawbg commented 5 months ago

As of version 7.49, 3 new encoding options have been implemented. The options give an excellent result in terms of encoding quality at HEVC/h265. The options are:

--tune
--tf-level
--lookahead-level

If you want the performance before 7.49, use them like this:

--tune lowlatency or ultralowlatency
--tf-level 0
--lookahead-level 0

Lower performance is primarily due to --tf-level and --tune uhq. As of version 7.50, the default value of --lookahead-level is 0 and you don't have to explicitly set it. If you want maximum quality, then use:

--tune uhq --> only supported by Turing+ architecture.
--tf-level 4
--lookahead-level auto

But the performance is greatly reduced... No complete happiness :)

IMHO that since I've been using nvencc64(7.41) this change is the best!

I've already re-encoded several Blu-Ray discs and I'm impressed with the effect of the three options. For video material that has noise and small artifacts, the effect is strongest. Noise and artifacts disappear. If the video material is of a higher quality, the effect is less noticeable, but nevertheless the visible perception is for a cleaner and better picture. I am using Ampere(RTX 3060Ti FE).

quamt commented 5 months ago

Screenshot

image

There is no auto for the lookaheadlevel.

--lookahead-level <int> [HEVC]
Set level of lookahead, higher level may improve quality at the expense of performance. (0 - 3, default = 0)
Jigsawbg commented 5 months ago

Interesting... There is probably some confusion because 7.50 works with auto. Initially in version 7.49 the default value was auto and I personally still use it that way. I read it from Rigaya's post #577(clossed issue).

The performance drop was due to the new --lookahead-level option added in NVEnc 7.49, defaulted to auto.

I've changed the default to 0 in Nvencc 7.50, and will remove the performance drop.

As we can see from the same post, in version 7.50 it changes the default value to 0, but this does not mean that auto is removed, just that the value is changed. And yes, you are right that there is no auto value in the description. But I think it's a mistake in description, I hope it's a mistake and the value hasn't been removed. The fact that it still works like this makes me think it's relevant. Actually, I just checked in the original version of the document and it says: Set level of lookahead, higher level may improve quality at the expense of performance. (0 - 3, default = auto) . Rigaya later changed it to its present form.

From NVIDIA SDK:

Enum for Lookahead level.
    Line 1315: typedef enum _NV_ENC_LOOKAHEAD_LEVEL
    Line 1317:     NV_ENC_LOOKAHEAD_LEVEL_0             = 0,
    Line 1318:     NV_ENC_LOOKAHEAD_LEVEL_1             = 1,
    Line 1319:     NV_ENC_LOOKAHEAD_LEVEL_2             = 2,
    Line 1320:     NV_ENC_LOOKAHEAD_LEVEL_3             = 3,
    Line 1321:     NV_ENC_LOOKAHEAD_LEVEL_AUTOSELECT    = 15,
quamt commented 5 months ago

I tested it with a few files on auto, and it always shows as follows: Lookahead on, 32 frames, Adaptive I, B Insert

Setting 1, 2 or 3 shows as follows:

Lookahead      on, 32 frames, Level 1, Adaptive I, B Insert
Lookahead      on, 32 frames, Level 2, Adaptive I, B Insert
Lookahead      on, 32 frames, Level 3, Adaptive I, B Insert

Setting 0 shows as follows: Lookahead on, 32 frames, Level 0, Adaptive I, B Insert

Auto doesn't show anything in the info line of Lookahead during the encoding. It could be just a "cosmetic" thing.

Jigsawbg commented 5 months ago
Tuning Info    uhq
Lookahead      on, 32 frames, Adaptive I, B Insert

Yes, there are no visible signs of auto being used at all.

But just because nvencc64 didn't return any error, I thought it was working. I really hope Rigaya didn't remove this option because I don't see any logical reason for it. Changing the default value does not conflict with the other possible options that NVIDIA has provided. I hope Rigaya will clarify the exact lookahead-level options. If he did remove the auto option, I hope he will bring it back.

Update: If we try using --lookahead-level but without setting value, then nvencc64 return this error:

Error: "--lookahead-level" requires value.

  Option value should be one of below...
    auto, 0, 1, 2, 3

Hm...

rigaya commented 5 months ago

--lookahead-level accepts "auto" and level will not be shown in the log, but it seems to be the same as "3" at this time.

rainman74 commented 5 months ago

--lookahead-level accepts "auto" and level will not be shown in the log, but it seems to be the same as "3" at this time.

Wouldn't it be better to leave the parameters in the default settings so that performance is not immediately reduced by 50%? If you then want higher quality, you can tune it.

My suggestion for default values based on Jigsawbg: --tune lowlatency or no specification (I have seen that hq is set by default) --tf-level 0 --lookahead-level 0

rigaya commented 5 months ago

Wouldn't it be better to leave the parameters in the default settings so that performance is not immediately reduced by 50%? If you then want higher quality, you can tune it.

Yes, so NVEnc 7.50 has changed default of --lookahead-level from "auto" to "0", which will result the same performance of NVEnc 7.48 and before.