Streaming h264 video using Ogre 2.1 and Nvidia Codec Sdk

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
Post Reply
Smooth
Gnoblar
Posts: 8
Joined: Mon Oct 01, 2018 2:04 pm

Streaming h264 video using Ogre 2.1 and Nvidia Codec Sdk

Post by Smooth »

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?
xrgo
OGRE Expert User
OGRE Expert User
Posts: 1148
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 168

Re: Streaming h264 video using Ogre 2.1 and Nvidia Codec Sdk

Post by xrgo »

Not really an answer to your question...
I had to do something similar while ago, I tried blitToMemory and have the same results, I also had the idea to use the nvidia codec sdk but I didn't even knew how to start... so I ended up just using the integrated streamer in geforce experience (that means doing nothing in my ogre app, just show it on the screen) and I use a modified (to my needs) version of moonlight on the other extreme, latency and video quality was very very good.
Post Reply