Feature Request: NVENC

Krazy

Town drunk
If they really don't require a license to be purchased any more...I want to play around with this stuff haha. Having a 670 GPU myself, if you can really get high quality encoding with little to no performance impact...that would be pretty incredible.
 

Faruton

Developer
The windows error you were seeing is probably due to a bug in their CNVEncoderH264

If you look in the constructor you'll find some code like this

Code:
nvStatus = nvEncodeAPICreateInstance(m_pEncodeAPI);

If you add this:

Code:
if (NV_ENC_SUCCESS != nvStatus) {
	PRINTERR("CNvEncoder::CNvEncoder() failed to load specific version of interface");
	m_bEncodeAPIFound = false;
	checkNVENCErrors(nvStatus);
}

You'll get a better idea of what the problem is. Likely you are getting a 'your driver does not support this version' or something like that. NV_ENCODE_API_FUNCTION_LIST_VER is the macro that gets the version.
 

freehuhn

Member
i build it with the test version von vs 2012 with "only" 132 warnings after updating it's not working.

now i try to get my hand on a test version of 2010...

edit: get the license error with the 320.79
 

Geoning

Member
Who wrote program to check support?
I have got GTX 660M (this same like GT 650M) and I want to check that the libs will say "yes" for the mobile kepler GPUs.
 

gdlk

Member
Geoning said:
Who wrote program to check support?
I have got GTX 660M (this same like GT 650M) and I want to check that the libs will say "yes" for the mobile kepler GPUs.
I tried build it from sample with August release and launch on my gtx 670 and now with latest drivers i have same GUID error:

Code:
D:\nvenc_3.0_sdk_windows\Samples\nvEncodeApp>nvEncoder -configFile=HeavyHand_1080p.txt -outfile=HeavyHandIdiot.3sec.264

>> GetNumberEncoders() has detected 1 CUDA capable GPU device(s) <<
  [ GPU #0 - < GeForce GTX 670 > has Compute SM 3.0, NVENC Available ]

>> InitCUDA() has detected 1 CUDA capable GPU device(s)<<
  [ GPU #0 - < GeForce GTX 670 > has Compute SM 3.0, Available NVENC ]

>> Select GPU #0 - < GeForce GTX 670 > supports SM 3.0 and NVENC
File: src\CNVEncoder.cpp, Line: 1750, nvEncOpenEncodeSessionEx() returned with error 21 
Note: GUID key may be invalid or incorrect.  Recommend to upgrade your drivers and obtain a new key NVENC error at src\CNVEncoder.cpp:1752 code=21(NVENC Feature not available for current license key type) "nvStatus"

You can try it by your own, just download nvenc sdk from nvidia site, you can simple google it, but it seems we have to wait further updates...
 

Geoning

Member
gdlk said:
Geoning said:
Who wrote program to check support?
I have got GTX 660M (this same like GT 650M) and I want to check that the libs will say "yes" for the mobile kepler GPUs.
I tried build it from sample with August release and launch on my gtx 670 and now with latest drivers i have same GUID error:

Code:
D:\nvenc_3.0_sdk_windows\Samples\nvEncodeApp>nvEncoder -configFile=HeavyHand_1080p.txt -outfile=HeavyHandIdiot.3sec.264

>> GetNumberEncoders() has detected 1 CUDA capable GPU device(s) <<
  [ GPU #0 - < GeForce GTX 670 > has Compute SM 3.0, NVENC Available ]

>> InitCUDA() has detected 1 CUDA capable GPU device(s)<<
  [ GPU #0 - < GeForce GTX 670 > has Compute SM 3.0, Available NVENC ]

>> Select GPU #0 - < GeForce GTX 670 > supports SM 3.0 and NVENC
File: src\CNVEncoder.cpp, Line: 1750, nvEncOpenEncodeSessionEx() returned with error 21 
Note: GUID key may be invalid or incorrect.  Recommend to upgrade your drivers and obtain a new key NVENC error at src\CNVEncoder.cpp:1752 code=21(NVENC Feature not available for current license key type) "nvStatus"

You can try it by your own, just download nvenc sdk from nvidia site, you can simple google it, but it seems we have to wait further updates...

I am so blind... I didnt see "Samples".

I got this same error, but yes.
>> Select GPU #0 - < GeForce GTX 660M > supports SM 3.0 and NVENC

I still do not understand why ShadowPlay dont support mobile kepler o,O


Good news is that, if Jim or other coder will add nvenc to OBS, mobile GPUs will use it.


Anyway, I streamed LoL with QuickSync + GameCapture Yes! It have been fixed, and we can use GameCapture (game on nvidia) + Intel QuickSync
http://www.twitch.tv/geoning/c/3156596
Quality is really good.
720p 60fps

i5-3210m + Intel 4000 + GTX 660m

60% (50% for game) cpu or less
 

Kootal

New Member
There was a great post at guru3d forum by the RivaTuner developer Unwinder:

http://forums.guru3d.com/showpost.php?p ... stcount=61
Unwinder said:
I’ve read a lot of reviews related to NVIDIA ShadowPlay during the last couple days and there are typical misunderstanding patterns in many of them, so I decided to write this short summary to give you better understanding, guys.
Most of users (and surprisingly reviewers) assume that the main performance hit for any videocapture oriented software comes from realtime video encoding. That is quite typical and mostly wrong assumption. Modern videocapture applications are multithreaded and modern CPUs have multiple cores able to process multiple tasks in parallel, so realtime video encoding is normally performed in background thread(s) and often with lower priority. That is why when you’re capturing video in the game which is not using close to 100% of CPU time on all CPU cores, background video encoding have enough system resources to run in parallel and hardly affects game performance. In other words, having fast hardware encoder like NVENC or Intel QuickSync simply allows you to encode better quality video with higher encoding framerate or more efficient compression ratio in realtime, but it doesn’t seriously minimize videocapture related performance hit like many reviewers say.

The main and the real performance penalty for videocapture application is … a simple process of capturing frames from DirectX application. DirectX rendering pipeline is asynchronous, so multiple frames are being processed in parallel by different stages of the pipeline. And that’s where our performance penalty come from – DirectX architecture is simply not built with idea of effective frame readback from the very end of rendering pipeline. So each frame capture via DirectX causes DirectX rendering pipeline to be flushed, CPU may stall until GPU finish flushing the pipeline and provide captured frame back to CPU, etc, etc. This means that each simple frame capture iteration hurt the efficiency of prerendering, may seriously reduce the performance of multi-GPU systems and so on.
And that’s where NVIDIA ShadowPlay magic begins. I’m very supersized to see that all reviewers focus on Kepler’s NVENC hardware H.264 encoder only without even mentioning Kepler’s innovative and unique NVFBC (Frame Buffer Capture) and NVIFR (Inband Frame Readback), which also help NVIDIA ShadowPlay a LOT. Those two are probably even more important videocapture oriented hardware technologies introduced in Kepler GPUs. Both are promoted by NVIDIA as ultra fast low-latency GPU/DMA accelerated framebuffer capture techniques, both are targeted at cloud gaming / GRID systems (you can read more in this presentation). It is some very very “light” kind of NVIDIA’s “Mantle” in frame capture functionality area – NVFBC and NVIFR are available via NVAPI and provide developers very effective way of frame capture via direct access to hardware bypassing the limitations of DirectX API.
So ShadowPlay’s success is built on two key hardware technologies: NVFBC for very effective frame capture and NVENC for very effective frame compression. BTW, NVFBC is a direct reason why ShadowPlay is not capturing video in windowed mode, if you follow the link above, you’ll see that NVFBC is able to grab whole frame buffer only.
And now some really good news: using NVENC is third party video capture applications is currently troublesome due to some strange licensing scheme applied to it by NVIDIA. Hope it will change in future, because competing Intel QuickSync H.264 encoding is freely available to any developer and it does great job. But NVFBC and NVIFR interfaces are available to any NVAPI developer, which means that very effective frame capture can be easily added to ANY existing third party videocapture application right now with minimum development cost. So at least frame capture related bottleneck can be taken out of context on NVIDIA Kepler hardware. Personally I’ve chosen to power videocapture engine of RivaTunerStatisticsServer v5.5.0 by NVIFR, even considering that NVFBC provides a bit faster capture, I won’t like to sacrify windowed videocapture support. And I’m pretty sure that other video capture tools will also get support for those new NVIDIA technologies soon.

Maybe this could be used on OBS too?
 

Tak0r

Member
So the most interesting part should be NVIFR when you wan't to have windowed ability if I understood the text correctly.
 

fredkruge

Member
Just curious for some sort of update from the devs. Are you guys looking into possibly working with it, working with it currently or are passing it aside to work on other things? I just read an article about nvidia and the encoder they have and thought of OBS so I decided to swing by to see.
 

LeperMessiah

New Member
Ok well shadowplay quality is awesome. The cpu usage is awesome. The hit to my framerate in game is so low its awesome as well.

I hate to sound like a prick but I find it hard to believe no one has gotten it to work yet. The guys at bandicam figured out how to implement cuda encoding before shadowplay was even released.

So when is this going to be implemented into OBS?
 

paibox

heros in an halfshel
Cuda has nothing to do with ShadowPlay. Also, ShadowPlay is the name of an application, not any sort of technology. NVENC is what ShadowPlay uses. No support is planned for it at present.
 

dodgepong

Administrator
Community Helper
That's not to say it will never be added. OBS Studio will have the ability to support different encoders, and if NVENC comes around to being more open and easier to use, then anybody could add it, really. It's something we're keeping our eye on but as far as I know, no one has stepped up to work on it.
 

LeperMessiah

New Member
WIsh I had the programming knowledge to do it lol.

The quality is incredibly good. I dont know what the percentage of users that have 600 series or higher nvidia cards is but we all have a hardware encoder sitting on our video card capable of offloading all the work to, its a shame not to use it.

Also, i thought the licensing restriction was lifted. I remember reading about that somewhere.
 

dodgepong

Administrator
Community Helper
The recording quality is good because it's recording at a super-high bit rate (I've heard of it reaching 55Mbps). Streaming typically maxes out around 3.5Mbps. So the quality comparison isn't really relevant.
 

ejiwarp

New Member
hello.

here is a post from Unwinder, the RivaTuner's creater.
http://forums.guru3d.com/showpost.php?p ... stcount=61

It said that the main reason for ShadowPlay's low cpu usage is not the NVENC's encoder but NvFBC frame buffer capture.
It can skip the very costly DirectX frame grabber process that cost more CPU than encoder itself.

「So ShadowPlay’s success is built on two key hardware technologies: NVFBC for very effective frame capture and NVENC for very effective frame compression. BTW, NVFBC is a direct reason why ShadowPlay is not capturing video in windowed mode, if you follow the link above, you’ll see that NVFBC is able to grab whole frame buffer only.」

And NvFBC itself is free to use, so OBS can use it for another video source for free, OBS should support NvFBC at first, NVENC is only for resolution, and it is not so important for online video broadcast.

NvFBC has one main drawback that it must be used on full screen gaming, if we need windows mode grab, It well need NVIFR.

Those are only for NVIDIA's GPU.
 

dodgepong

Administrator
Community Helper
Someone posted that exact same thing on page 3 of this same thread. He didn't say NVENC not what causes the low CPU usage, he said that NVFBC is being underappreciated as a part of the process that reduces load. But with OBS, the big CPU hog is still the encoder...OBS's game capture is really good already (maybe not as good as NVFBC but still really great) and it can capture windowed games, so the OBS load is still on the encoder.

Presumably people want to encode their whole stream with NVENC, not just their fullscreen game, so NVENC is still the thing that would be useful to add. NVFBC could be cool as a capture source, though, I suppose.
 
Top