Encoding over lan and GPU assisted encoding

DAOWAce

Member
I would like to hear about trials with this kind of setup as well.

I have an older PC (Phenom II 940) and can put together a 2nd newer PC (i5-2500K) with a few more parts. I'm not interested in capture cards because nothing under $1,000 can do 1080p60. Having some sort of dedicated directly connected LAN PC to do encoding would give me the quality I'm looking for at a fraction of the cost.

Hell, I'd even take iGPU encoding support (Lucid Virtu) as that would remove a fair bit of stress from the whole system, resulting in better performance and quality for everyone with Sandy/Ivy bridge CPUs (of which most people have, unless they went the 6 core route).
 

Bensam123

Member
With OpenCL, GPU encoding (such as Quicksync and AMD/Nvidia equivelants) has fixed quality settings for the most part, but I honestly would take either of them over none of them. It would actually be pretty cool to see how all of these when put together would influence streaming. Offloading the little bit of encoding the primary computer would have to do, then shooting it over the network to do the rest of it.

I'm hoping someone would stop in with more experience pertaining to RTMP relays. Perhaps I'll have to make a new topic as this one probably wont garner a lot of new views for this particular issue.

EDIT:
Still working on this... I'm running into a few issues. Does anyone have any experience with Adobe Media Server? Using a bitrate of 900000, 120fps, quality of 10, sound 320, 1680x1050, ultrafast preset, and crf=0 I'm getting about 20% OBS processor usage. I end up with a bitrate around 17-150Mbps, but nothing unreasonable. With crf=0 excluded I get about a 8-20Mbps bandwidth usage. I'm still messing around with things and trying to figure out how to work things, but it seems like processor usage actually goes up with a higher bitrate and cfr=0 for some reason (even though the encoder should be doing less work).

What I do have issues with is adobe media server seems to start dropping connections to it with really high bit rates and I don't know why... It could be possible it's not made for bitrates about 15Mbps, but I sorta doubt that.

EDIT 2:
So an update on this... Adobe Media Server seems to crap out with bit rates higher then 20Mbps and will disconnect clients. You need a media server to serve as a relay for lan encoding, the other option being using Xsplit delay server (which is a premium service for xsplit).

I found that using 60 fps and my native resolution and crf=24 I could produce a picture that was indistinguishable from the source. It ended up with a bit rate of about 8-20Mbps, meaning AMS wouldn't disconnect the client connected to it (I set a bit rate of 20000, buffer 10000, and quality 10). On my server end I tried it with smplayer and capturing to OBS using it, but it didn't work out very well. I ended up using Xsplit to capture the stream from the media server instead.

However, my server did not have enough horsepower to power an encode of similar quality to what I was using for my normal stream. Trying to stream at 720p@30fps wasn't working out. I have a Phenom 2 x3 710 in my server. Using OBS I would suspect lower utilization, but due to the fact that you can't use RTMP streams as a source I had to forgo that option.

On my desktop side of things the biggest change was going from the veryfast preset to the ultrafast preset because of the ample amount of bandwidth available. This reduced utilization of OBS by 50-70% depending on what was going on on the screen. So this indeed does free up quite a bit of resources.

However, it doesn't seem very practical right now as software doesn't seem mature enough in regard to ultra high bit rates. I could have Adobe Media Server configured wrong, but it seems as though it's not capable of handling extremely high bit rates from a single source (20Mbps+). OBS while offering quite a bit of a reduction in processor usage was only because I selected a lighter preset, which was from the encoder preset.

So even though there was copious amounts of bandwidth available for the encoding process, the software couldn't fully take advantage of it. I'd suspect even lower processor usage if this was built into OBS either for receiving a RTMP stream or being able to stream directly from one OBS client to another. Xsplit has this functionality built in, but streaming with the higher bit rate settings yielded the same processor usage as streaming OBS with a normal bit rate. I was unable to test the delay server as I don't have a premium subscription to Xsplit, but I believe it wouldn't be worth it for reducing the workload on the primary computer.

It is still possible though... I partly blame my slow server for not being able to encode a 720p stream with xsplit.

In a nut shell:
-Lan streaming shows a 50-70% processor usage reduction for OBS in its current state
-Streaming software isn't currently optimized for extremely high bit rates (input, output, and transcoding)
-Lan streaming shows a lot of promise even with my duct taped together configuration
-There isn't a easy to use option right now (haven't tried Xsplit premium)
-Sending visually indistinguishable streams from the source doesn't require a lot of bandwidth. Even operating at crf=0 bit rates didn't get higher then 200Mbps.
--Raising the bitrate didn't reduce CPU usage, which in part could be due to streaming software not being able to properly utilize extremely high bandwidth. Changing crf to 0, 18, or 24 only changed the quality of the stream, not processor usage.

I would very much like this to be a easy to use option in OBS and would benefit anyone with a second computer capable of encoding. It would instantly obsolete capture cards used as a means of reducing primary computer streaming workloads. I can't imagine receiving a RTMP stream or sending one to another client on the network to be that much work, either, and that's not even optimizing the client for high bit rates.

Although there are a handful of people who use capture cards as actual input from a console or other outside source, the majority of capture card PCs are used strictly for removing the encoding workload from the primary PC. In that regard I see current work to make every make and model of capture card compatible as a very low priority. Something like this is a universal option open to everyone and would replace all said capture cards in that usage scenario anyway.
 

DAOWAce

Member
Bensam123 said:
It would instantly obsolete capture cards used as a means of reducing primary computer streaming workloads.
It would also allow people using non-mass market standard resolutions (16:9, ugh) to finally have a way to take the strain off their computer as well.

I have looked into capture cards myself, but the most widely used one (Avermedia live gamer HD) only supports up to 1080p30. I use a 1920x1200 display, resulting in the card being unusable for me. Not to mention I can stream 1080p45 on my system anyway, so a step down in quality is stupid. The next 'step up' is a $1,000 card capable of 1920x1200@60. Then there's 4K supported ones..

Nice discoveries though; looking to be more like a reality!
 

Bensam123

Member
LAN RTMP Relay and Transcode

Yup, I also looked into putting together a capture PC when I first started streaming, but for a few reasons I ended up discarding the idea. My main PC uses a 16:10 monitor, a 1080p@60 capture card is relatively expensive, a second entirely new PC of adequate processing power would've had to have been built (I could've upgraded or used my server, but I decided that money for a upgrade was better spent upgrading my main PC which could be used for gaming itself and everyday use), I would've had to have had a PC in the room with my primary PC creating more noise/heat/clutter, and if I ever decided to get a better monitor or change my streaming setup I would need to buy a new card (there is no upgrade path for the capture card).

If I had a faster secondary PC I could've most definitely used it in this setup and possibly even contributed to a more fluid stream, but Xsplit is too heavy for my Phenom 710 to handle. Ideally I was hoping offloading would allow me to stream at 1080p~@60 straight off the bat with a higher encoding preset on my server, but that quickly disolved.

Another thing I forgot to mention is simply playing the stream from my primary computer at the ultra high bit rate and capturing it in SMPlayer or importing it into xsplit, uses quite a bit of CPU in and of itself. Ideally a solution like this would downsample or play a low res version on the computer it's being shipped to. Not actually downsampling the stream itself, but what is playing. That was another unfortunate consequence.... Playing a 1680x1050@60 20Mbps flash stream uses quite a bit of resources. That is also what contributed to my server being unable to handle the transcoding process with Xsplit.

I used three computers in this setup. Gaming computer --> server/transcode ---> laptop to view the end result. If my server wasn't getting maxed out and as such had a choppy stream, the quality of the end product after transcode very much looks like an original encode by the gaming computer.


This is all putting aside Adobe Media Server being annoying and simply dropping clients when the bandwidth got too high. It seemed almost random and whimsical when it would do it. Consistent bit rates above 15Mpbs+ resulted in the viewing client being dropped, but if it spikes to 20Mbps and goes down again, it's fine. It may be related to a buffering issue, I'm unsure as I don't have much experience with AMS. I may need to look into this more because you can do transcoding with AMS if you set it up properly. Ideally AMS isn't a solution for anyone looking to stream though.
 

kaloc

Member
I've also experimented with LAN encoding as well, but I had given up because of the fps hit from sources such as SCFH DSF and Dxtory's directshow output. I believe with the right combination, it can absolutely be done and most of you have already listed the parts necessary for success.

Here is my idea :

Frontend (capture)
Light (cpu) game capture method = OBS game capture + UT Video Codec with 4:2:2 subsampling for 720p or higher and x264 should be fine for lower resolutions. - ( I originally said MJPEG, but I think UT codec might be a better fit )

Now if OBS were to include UT codec in some form, it could be used in place of x264 for "light" encoding and the result is sent over TCP, UDP, or even RTMP to a destination ( second pc ).

Backend (encoding)
Second PC used to do the "heavy" encoding with x264. If OBS uses either TCP or UDP then it could simply pass the data via sockets to an instance running OBS on pc #2. If RTMP is used, then other programs such as rtmpdump + ffmpeg or ffmpeg alone can be used ( in place of OBS ) to receive the data and encode to your final compression specs.
( There are probably many more setups that can handle the incoming data, but I leave that up to advanced users to choose how they want to handle it. )


Finally, I'd like to say you can already ( partially ) test this now if you're familiar with command line programs.
OBS can stream to custom RTMPs ( second pc ), so set OBS to the fastest encoding settings available ( Ultrafast + zerolatency ) and on your second pc have ffmpeg or rtmpdump + ffmpeg waiting to receive from it. You can then capture it to disk, or send it off to your service of choice ( like Twitch ).
 

Bensam123

Member
Acronyms are bad if you don't explain them first.... example SCFH = standard cubic feet per hour

I already tested the configuration mentioned and listed the results above. You can't stream directly from OBS to another OBS client. OBS doesn't accept RTMP connections as of yet. I tried it with Xsplit, with mixed results due to my computer being slow and Xsplit being a turd. You still need to use a media server as a intermediary between two clients, unless you use Xsplit premium (which should allow you to stream directly from one client to another).

Media players can't directly receive streams either, they need to connect to a media server. So you can't directly take a stream from OBS in with SMPlayer or such. I tried using SMplayer and OBS instead of Xsplit, but that ended up resulting in a worse output then simply using a stream as a source in Xsplit. If you actually know how to stream from OBS to xsplit or a media player without a media server AND you've tested it, I'd be happy to hear about it.


I haven't experienced any associated performance hits using DXtory anymore then the usual from streaming. Using the configuration I listed resulted in a 50-70% reduction in processor usage by OBS. You'd still need something to capture the screen even if your original computer doesn't do the encoding... MJPEG is just another codec, current settings in OBS aren't optimized for an essentially limitless connection (Gigabit), as such you can't compare the two in their current state.

Others have also mentioned in this thread the MJPEG has issues dealing with high motion scenes. Adobe Media Server can't receive MJPEG streams either, so OBS would have to be designed to take in and transcode a MJPEG stream by itself. Ideally AMS should be completely removed from the setup, but can't be if you simply want to try this right now.
 

kaloc

Member
Bensam123 said:
Acronyms are bad if you don't explain them first.... example SCFH = standard cubic feet per hour
You might want to google SCFH DSF, its not that. ( Its a directshow source )
I already tested the configuration mentioned and listed the results above. You can't stream directly from OBS to another OBS client. OBS doesn't accept RTMP connections as of yet. I tried it with Xsplit, with mixed results due to my computer being slow and Xsplit being a turd. You still need to use a media server as a intermediary between two clients, unless you use Xsplit premium (which should allow you to stream directly from one client to another).
Correct, thats why its an idea for future development. As for an intermediate server, see my answers below.
Media players can't directly receive streams either, they need to connect to a media server. So you can't directly take a stream from OBS in with SMPlayer or such. I tried using SMplayer and OBS instead of Xsplit, but that ended up resulting in a worse output then simply using a stream as a source in Xsplit. If you actually know how to stream from OBS to xsplit or a media player without a media server AND you've tested it, I'd be happy to hear about it.
FFmpeg isn't a player, its more of a swiss army knife of encoding. I may make a guide if there isn't a descent one already.

I haven't experienced any associated performance hits using DXtory anymore then the usual from streaming. Using the configuration I listed resulted in a 50-70% reduction in processor usage by OBS. You'd still need something to capture the screen even if your original computer doesn't do the encoding... MJPEG is just another codec, current settings in OBS aren't optimized for an essentially limitless connection (Gigabit), as such you can't compare the two in their current state.
If Dxtory's performance is acceptable to you, then use that. I think OBS's game capture is faster though and that is what this test scenario would be using. Also, the codec has a big impact on in-game fps.
Others have also mentioned in this thread the MJPEG has issues dealing with high motion scenes. Adobe Media Server can't receive MJPEG streams either, so OBS would have to be designed to take in and transcode a MJPEG stream by itself. Ideally AMS should be completely removed from the setup, but can't be if you simply want to try this right now.
MJPEG works well if properly implemented, but I change my example to use UT codec suite in the previous post. As for the streaming from PC 1 to PC 2 .. you think I meant relaying the data through a streaming server, such as AMS, you don't need to do that. The video data can be sent as regular binary data from pc1 to pc2, its not that difficult actually and should be one of the easier things to implement.
 

kaloc

Member
Indeed NoSFeRaTU FFmpeg is amazing in what it can do. If OBS were to ( for example ) output the raw video to stdout, then ffmpeg could take it from there to : encode locally, send over LAN, or any other number of things.
 

Bensam123

Member
Have you actually assembled or tested any of what you were mentioning kaloc?

As I said if you know of how to stream directly from OBS to Xsplit or a video player such as SMPlayer, feel free to provide an example of how to do so. Currently I don't know of anyway to do this besides a media server (which was also local on my server) or using Xsplit preimum delay server.

Three posts up I was actually talking about something I implemented and worked with. It seems as though you're just talking about hypotheticals, which I really don't mind I'm just making sure people understand the difference between what you're suggesting and what I've already done and was reporting my findings on. Ideally I'd most definitely like these things to be integrated into OBS, but they aren't right now. If MJPEG is better then very lightly encoding with x264 (which I haven't seen a implementation of) that'd be great too, but currently isn't available. I just worked with the options that were available in OBS and also a few extra parameters in the advanced box, such as crf.

Perhaps I should've split this off and turned it into a guide/report... I'll have to consider doing that if I get more time.
 

mook06

New Member
regarding gpu encoding, i spent the day fiddling with intel quick sync video.
My cpu is i5 3570k with the intel HD Graphics 4000,
Dedicated GPU is Nvidia 460

After doing quite a bit of searching i found "Mirillis Action!" software, it records only to disk, but has the ability to encode with Nvidia CUDA and Intel Quick Sync Video. Now i thought i would need lucid logix virtu mvp to enable use of both gpus, but it actually got in the way, the only thing needed was to follow this tutorial, http://mirillis.com/en/products/tut...-intel-quick-sync-setup_for_desktops.html#top
for bios settings i have Initiate Graphic Adapter set to PEG ((pci express graphics) Nvidia 460), then "IGD Multi-Monitor" set to Enabled

currently with obs i max out around 1080p 30p preset:veryfast @ 10,000kbps - near 100% cpu usage
with Action! using the intel gpu, it can encode the same gameplay @ 1080p 60p, cpu usage is around 5%

the bitrate of the intel encodes peak around 25,000kbps, also the footage looks amazing, true 1080p @ 60fps is unreal
 

paibox

heros in an halfshel
"Your browser is too old to download a file this large, please use Google Chrome"... and then the file is 130MB? What the hell. :P Anyway, yes, I would assume that just about anything encoded at a peak bit rate of 25,000 Kbps to look good, no matter the settings. It seems weird that your CPU usage would be almost 100% when encoding 1920x1080 at 30 frames per second though, especially if the CPU usage was only around 5% when encoding using the Intel GPU. (Since this would indicate that the game was only using 5% CPU to begin with, and OBS was using 95%, which doesn't quite add up considering the performance of your CPU.)

Even on my FX 8120, the CPU usage for recording Dead Space 3 (which always uses 100% on the first core while the game is running), I peaked at 80% or so, and only a total of 30 lagged frames over a period of about 15,000. I'm not saying that QuickSync isn't better than some of the other alternatives, it's most definitely not bad, but... actually, I've forgotten if this topic is about using LAN/GPU for encoding while streaming or doing local recording. But for streaming, the bit rates seen in your sample encode will never be useful.
 

mook06

New Member
ofcourse, im just very interested to see how it would look at correct bitrates

oh and about the cpu usage thing, wow tends to use 20-30% cpu, Action! was another 5% ontop of that, with obs the total usage of wow + obs is around 90%

also, what did you think of the 60 framerate?
 

paibox

heros in an halfshel
It looked smooth enough yeah, pretty sure the quicksync encoder is overcompensating a bit with the bit rate though. I think the reason you felt that it looked a bit choppier than when you played the game is because you didn't have your game limited to 60 frames per second. If a game doesn't run at the same (or a multiple of the) frame rate as you're encoding/streaming at, there will almost always be "hiccups" when the game updates unevenly in between the frames you're capturing.
 

Bensam123

Member
This was supposed to be about GPU asssisted encoding and encoding over the lan, but then someone opened another topic about hardware encoding using Quicksync, so this turned into OpenCL gpu assisted encoding and lan encoding I guess.

Interesting program. I don't think I've seen a version of Quicksync that works for livestreams, it's all for transcoding. That would be the first time I've seen it used for local recording though.
 

Bensam123

Member
Speaking of which, I found a few x264 encoders with OpenCL look ahead, but unfortunately I don't know enough about encoders to turn one into a .dll for use with OBS. If anyone has any knowledge with this sort of thing have a look.

http://astrataro.wordpress.com/2012/09/ ... 6688-tmod/

http://forum.doom9.org/showthread.php?t=165984

I also found this paper with source code that may take into account more then just look ahead, but I don't know how to compile it into a working version.

http://li5.ziti.uni-heidelberg.de/x264gpu/
 

Tritemare

New Member
I'm now heavily invested in getting a box to handle my encoding and ship it off to twitch for me. This is because I purchased a (4U rackmount) server for intended use as a stream box with a capture card. Unfortunately you can not get any kind of graphics capability working properly with this server (Dell made 75watt pcie slots instead of the normal 150watt.) So, the only hope I have of turning this investment into a streaming box is to feed it a partially encoded stream from my gaming rig via OBS stream over Ethernet and have the server encode the rest of it and ship it to Twitch

As @Bensam123 has seen some positive results with Adobe Media Server, that is where I have begun. Unfortunately, since Adobe Media Server 5.0 is so new, there is very little viable documentation available for it. Especially nothing mentioning how to get the stream from AMS 5.0 out to twitch.

I have the server configured as it is out of the box, and my stream is received by the box. But the stream does not stay connected more than 34 seconds. (magic number of some sort?) I'm also getting "Unknown publish command issued for stream 1 "

I've changed my bitrates from high to low and just about every other setting I can think of. I suppose before I worry about moving the stream out from AMS 5.0 out to Twitch, I better hope the stream stays live when going from my gaming rig to AMS.

I also tried to configure RED5 media server but the java portion of it is taking a massive crap.

Have you made any more progress with AMS5 Benson? Or did you find success with another type of media server?

Can you provide me to some good resources for configuring AMS 5.0 to stop choking and dying on my streams from OBS?

My end goal is: MyComputer -> RackmountServer(AMS5.0) -> Twitch.
 
Last edited:

Jack0r

The Helping Squad
I would recommend nginx for this kind of stuff, we have several guides for it available and its easy to set up and configure.
Though I have to say it has no information or mechanism against dropped frames. But before I link you some tutorials, why exactly do you use the server now?
I guess AMS/Red5 were just used to send the stream to Twitch right? Not to encode it further or something. In this case you should think about removing the server from your setup.
Or did you send a high bitrate stream to the server and then re-encoded it to a streaming bitrate?
 

Tritemare

New Member
Wow, thanks for responding, I really appreciate it! I've seen a lot of your youtube videos. You are one of the most helpful members of this community, I have to say.

So, I must be a fool, because I thought AMS/RED5 would help me to encode the stream further. This is not looking like it is the case. I was not able to successfully get either solution working enough to begin testing it with Twitch.

My main goal is to send an 'ultrafast' encoded stream with a higher bitrate from my game machine to the server, where the server will encode the video further and ship it off to Twitch.
 
Last edited:
Top