Streaming h264 video using Ogre 2.1 and Nvidia Codec Sdk
Posted: Mon Apr 08, 2019 1:12 pm
Hi,
I’m currently working on a project where the goal is to make an application capable of streaming a rendered texture(direct3d11) from Ogre (v.2.1) as a h264 video stream out on a local network using rtsp and still maintain a reasonable resolution and framerate.
So far, I have been able to build an application that works, but the performance is very low. To stream a video that doesn’t look like still pictures, I must render the at very low resolutions (currently I’m at 704x480 pixels).
The main bottleneck of my application seems to be when I copy the rendered ogre texture back to memory (using BlitToMemory) and encode it to a h264 stream using the GStreamer library.
Is there a faster way to copy the texture back to memory than the BlitToMemory function?
In an attempt to make this operation faster I have tried to implement the Nvidia Codec library so that I can encode the textures on the graphics card before I send them back up to the computer memory to stream out on the network. So far, I have been unsuccessful at this. My main problem is that I can’t figure out how to access the rendered texture on the graphics card. The sample code I have been using from the Nvidia Encode Sdk works by copying content to a buffer on the graphics card that later gets encoded to h264 using the NVENC encoder.
Do you have any experience with the Nvidia Codec Sdk and how to pass an ogre texture into the encoder after rendering? Do I have to use Cuda to share the direct3d11 texture?
I’m currently working on a project where the goal is to make an application capable of streaming a rendered texture(direct3d11) from Ogre (v.2.1) as a h264 video stream out on a local network using rtsp and still maintain a reasonable resolution and framerate.
So far, I have been able to build an application that works, but the performance is very low. To stream a video that doesn’t look like still pictures, I must render the at very low resolutions (currently I’m at 704x480 pixels).
The main bottleneck of my application seems to be when I copy the rendered ogre texture back to memory (using BlitToMemory) and encode it to a h264 stream using the GStreamer library.
Is there a faster way to copy the texture back to memory than the BlitToMemory function?
In an attempt to make this operation faster I have tried to implement the Nvidia Codec library so that I can encode the textures on the graphics card before I send them back up to the computer memory to stream out on the network. So far, I have been unsuccessful at this. My main problem is that I can’t figure out how to access the rendered texture on the graphics card. The sample code I have been using from the Nvidia Encode Sdk works by copying content to a buffer on the graphics card that later gets encoded to h264 using the NVENC encoder.
Do you have any experience with the Nvidia Codec Sdk and how to pass an ogre texture into the encoder after rendering? Do I have to use Cuda to share the direct3d11 texture?