Log in

View Full Version : 2-pass HEVC NVENC - Is it possible?


Neillithan
6th December 2017, 09:22
Title pretty much sums it up. I'm wondering if it's possible to do a 2-pass encoding with NVENC.

It would provide a super fast encoding, but with the benefits of better bitrate distribution for those really pesky parts of videos that end up being way lower bitrate than is acceptable.

JohnLai
6th December 2017, 13:13
Not possible.
Previously, nvenc has option called VBR2Pass. It was renamed to VBRHQ in SDK7.19
It is not exactly the two pass you are looking for.
http://forum.doom9.net/showthread.php?p=1792801#post1792801
Think of it as single frame two pass where only data from previous frame is used for determining the next frame bit distribution.


X264 and X265 two pass work differently where all frames from beginning till the end is analysed, then the data is used to do the actual encoding process in second pass.


On your other thread, of course x265 gonna win in term of quality per file size.
x265 makes use of B-Frame.
NVENC HEVC doesn't have B-frame support.
http://forum.doom9.net/showthread.php?p=1780493#post1780493

Neillithan
6th December 2017, 21:58
I see, interesting. Do you think this will ever become possible in the future, or is this forever impossible due to the way NVENC is designed?

Regarding x265 vs NVENC HEVC.... for some reason, the x265 wins for 23.976fps footage is when I do a Medium preset (or slower), 2-pass conversion. I have tested Faster, Very Fast, Single Pass, Constant Quality, etc etc. In each of these cases, NVENC wins most of the time (again, it depends on what the input footage is). I do not know why.

x265 always wins for 60fps footage, even with the faster preset.

I keep taking screenshots to compare NVENC and x265 and (just to reiterate) nvenc seems to win unless I perform a 2-pass medium preset encode with x265. But this is way off topic. :P

Selur
7th December 2017, 20:22
NVEnC uses the VPU chip on your NVIDIA card so unless a new chip comes out I doubt that there is some undocumented api version which would allow to do something like x264/x265/Xvid/... do with two pass encoding.
+ I doubt it will happen that NVIDIA/Intel/AMD will support 2pass encoding like we know it from software encoders, since their main goal is to provide a fast way to do decent life stream video encoding and 2pass encoding the way software encoders to it can't be live. ;)

Tazlord
18th December 2020, 04:42
Old thread but to answer your question, VBRHQ IS 2-pass.

Previously, nvenc has option called VBR2Pass. It was renamed to VBRHQ in SDK7.19
It is not exactly the two pass you are looking for.
http://forum.doom9.net/showthread.ph...01#post1792801

The description in that link describes exactly how 2-pass works. It isn't limited to frames within the same pass. It actually stores frame information for use in a 2nd pass, the compression pass. Considering what year it is now, both Turing and Ampere have vastly improved on the features available in the API. I use a command-line app called NVEncC64 to access the nvenc API. It's easy to use and pretty fool-proof.

https://github.com/rigaya/NVEnc

Selur
19th December 2020, 14:22
VBRHQ IS 2-pass.
Like before what happens 1st a frame is encoded once and then the same frame is encoded a second time while applying some information gathered during the first compression.
So it is still no real 2pass encoding the way folks know it from most modern software encoders, which allows to hit a specific file size.
Only new thing is that you can use a faster 2pass approach by doing the 1st pass on a scaled down version.

Sharc
19th December 2020, 14:47
NVIDIA's 2-pass principle is described here:
https://docs.nvidia.com/video-technologies/video-codec-sdk/nvenc-video-encoder-api-prog-guide/index.html#multi-pass-frame-phencoding