NvEnc on AWS Linux

I’ve been trying to get NVidia’s hardware encoding on linux to work (In order to capture application displays and stream them, encoding them using the HW encoder on NVidia cards). We have a similar streaming setup working on windows (which uses DirectX things, so not really applicable to Linux except for reusing some code fragments) but capturing the whole screen.

To do that; I was planning to capture window display from X11 (Using XComposite and glXBind extensions) to an OpenGL texture, feed the texture to NvEnc to get a video stream

I’ve had trouble getting the examples to work for NvCodec API

  • First of all, I’m running the “Amazon Linux 2 with .Net Core, PowerShell, Mono, and MATE Desktop Environment” AMI on a g4dn.xlarge instance on Amazon EC2.
  • I try and build the samples (It took some effort to get them to compile).
  • When I try to run this, I get an error about the libraries not being loaded. When I search for this string in the samples source, I discover it is printing that if glGetString(GL_VENDOR) returns something other than “NVIDIA Corporation”. It returns “VMWare, Inc.” on the instance I’m using. I’m not sure if this is due to the drivers not being installed correctly (nvidia-smi returns the correct driver info, by the wasy) or due to the virtualized nvidia GPUs on Amazon EC2 returning VMWare
  • If I disable that check in the sample source, the call to nvEncOpenEncodeSessionEx returns 2, which is NV_ENC_ERR_UNSUPPORTED_DEVICE. I believe this error stems from the same reason I get a wrong vendor from OpenGL.

Dear @hasancanyasar ,

We had forwarded your query to the concerned technical team within NVIDIA and here’s the analysis from their side. It suggests that the problem is beyond NVDIAI’s scope.

For NvEnc to work properly, the GL_VENDOR should be NVIDIA.
This should be the case if the rendering is happening on the NV adapter.
If the GL_VENDOR is showing up as “VMWare, Inc.”, this is mostly because the X screen is using the default emulated display adapter on the AWS VM.
This is a setup issue, and AWS support should be able to guide the user to correctly configure the adapter settings on their instance.

Please let us know if we can close this query from our side.

NVAPI Forum moderator