[Guide] Two PC configuration without Capturecard

franktitude

New Member
For those who have no luck getting the FFMpeg (Compilation) working with Trans-coding. You have to execute the following code before starting nginx (~/bin is where FFMpeg is located)

cd ~/bin

sudo /usr/local/nginx/sbin/nginx
 

franktitude

New Member
So I tried this setup, streaming from Gaming PC to Streaming PC, but it still does not improve my FPS when gaming. The gaming experience I had with this setup is about the same as a one PC gaming/streaming setup.

To achieve the best gaming experience and steaming quality setup, it is best to have a Capture Card, HDMI Splitter + Audio Mixer setup?
 

Bamse

Member
I just got this setup at home, running the following;

PC1, Gaming PC:
CPU: i7 860 @ 3.6GHz
8GB RAM
GTX780

PC2, stream laptop:
CPU: i7-2630QM @ 2GHz
16GB RAM
Quadro 2000M

PC1 is streaming with NVENC, 1200p@60fps with a bitrate of 50000Kb/s to PC2 where I'm currently in this testing phase is running nginx on windows with latest static ffmpeg, transcoding the stream to 800p@60 4000Kb/s and pushing it to twitch.
I will prolly lower the NVENC bitrate down to 30k for the sole purpose of not over-doing it.
On PC1 I'm down from ~30% CPU usage, using the standard x264enc when running downscaled 1200p30->800p30 with otherwise identical settings as I do now, to about 6% using NVENC.

I do notice FPS improvements ingame on PC1, but I've forgotten to start dxtory to actually measure it, so I'm not sure it's a feeling or fact. Will measure soon tho :)
What I do know is that Arma3 is ALOT happier with all the freed up CPU making AI and scripts act better and faster, which is one helluva win in itself for me.

I'll keep streaming this way for a bit to try things out and when I'm happy with my settings I'll prolly install some ubuntu flavored server (yes, GUI-less :P) and dualboot my laptop so I don't need Windows running.
 

Bamse

Member
nvm, I've gotten some issues lately where it's very hard to balance GPU load so stream doesn't stutter. If I stream with a really GPU-intensive game I either get stutter or driver crash so I've actually gone back to doing regular CPU-based encoding on my gaming PC for now.

General question tho; Is a high bitrate NVENC-encode more GPU intensive than a lower bitrate one? for instance; 50000kb/s versus 25000kb/s.
 

Boildown

Active Member
General question tho; Is a high bitrate NVENC-encode more GPU intensive than a lower bitrate one? for instance; 50000kb/s versus 25000kb/s.

Shouldn't be, not on the GPU anyways. Maybe more intensive on your hard drive, but since people don't come here complaining about high hard drive utilization in general, I think its a non-factor as well.
 

Bamse

Member
Roger that, thx for the answer. I get to the same conclusion when testing.
Oh well, I might just go grab me a Extremecap U3 or something instead :D
 
Hi All,

I'm hoping someone can help, I've tired setting up a NGINX server on both Ubuntu 14 & Windows 7 with the same results. I've my gaming PC with OBS on it setup to steam to my second PC via the LAN.

I can get the stream to work over twitch by using a direct RTMP push feed and that works perfectly, the issue i'm having is when i want to stream from my OBS PC at a higher bitrate to my second PC which i then want to transcode into a lower format before uploading it to twitch.

The reason for this is that I want to record my OBS stream at a higher rate than I want to stream it at. The connection code i'm using is the following

rtmp {
server {
listen 1935;
chunk_size 4000;

application transcode {
live on;
record off;
exec ffmpeg -re -i rtmp://192.168.0.9:1935/trans/$name -vcodec libx264 -preset medium -x264opts nal-hrd=cbr:force-cfr=1:keyint=60 -r 30 -b:v 2000k -maxrate 2000k -bufsize 2000k -threads 12 -s hd720 -sws_flags spline -acodec copy -f flv rtmp://localhost:1935/live/${name};
}
application live {
live on;
record off;
push rtmp://live-lhr.twitch.tv/app/twitch_key;
}
}

but it doesn't stream to twitch. I've also tried removing the second stage out (app Live) and replacing the RTMP details in transcode section with the twitch appkey and this won't work either.

I know the server is correct as it works if I set OBS to go directly to live but its something in the transcode or ffmpeg. I've also got ffmpeg up and running with no errors so i'm a little lost and hope someone can help.

Here is my error log from my win7 server when in the two stage config above.

when its up and trying to work using both app code

2014/12/12 15:28:03 [notice] 2636#2628: using the "select" event method
2014/12/12 15:28:03 [notice] 2636#2628: using the "select" event method
2014/12/12 15:28:03 [notice] 2636#2628: nginx/1.7.4
2014/12/12 15:28:03 [notice] 2636#2628: nginx/1.7.4
2014/12/12 15:28:03 [info] 2636#2628: OS: 260100 build:7600, "", suite:100, type:1
2014/12/12 15:28:03 [notice] 2636#2628: start worker processes
2014/12/12 15:28:03 [notice] 2636#2628: start worker processes
2014/12/12 15:28:03 [notice] 2636#2628: start worker process 2608
2014/12/12 15:28:03 [notice] 2636#2628: start worker process 2608
2014/12/12 15:28:03 [notice] 2608#2624: nginx/1.7.4
2014/12/12 15:28:03 [notice] 2608#2624: nginx/1.7.4
2014/12/12 15:28:03 [info] 2608#2624: OS: 260100 build:7600, "", suite:100, type:1
2014/12/12 15:28:03 [notice] 2608#2624: create thread 2540
2014/12/12 15:28:03 [notice] 2608#2624: create thread 2540
2014/12/12 15:28:03 [notice] 2608#2624: create thread 2640
2014/12/12 15:28:03 [notice] 2608#2624: create thread 2640
2014/12/12 15:28:03 [notice] 2608#2624: create thread 1900
2014/12/12 15:28:03 [notice] 2608#2624: create thread 1900
2014/12/12 15:28:17 [info] 2608#2540: *1 client connected '192.168.0.9'
2014/12/12 15:28:17 [info] 2608#2540: *1 connect: app='transcode' args='' flashver='FMLE/3.0 (compatible; FMSc/1.0)' swf_url='rtmp://192.168.0.18/transcode' tc_url='rtmp://192.168.0.18/transcode' page_url='' acodecs=0 vcodecs=0 object_encoding=0, client: 192.168.0.9, server: 0.0.0.0:1935
2014/12/12 15:28:17 [info] 2608#2540: *1 createStream, client: 192.168.0.9, server: 0.0.0.0:1935
2014/12/12 15:28:17 [info] 2608#2540: *1 publish: name='test' args='' type=live silent=0, client: 192.168.0.9, server: 0.0.0.0:1935
 

0x33

New Member
Jack0r or anyone familiar with this able to help me VIA message / chat system for quick responses? Im just a bit of a newb here. Using a Desktop / Laptop setup with windows on both machines.

I downloaded the precompiled windows NGINX w/ RTMP 1.7.4, have it running and can see it from the gaming PC... where do I go from here again?
 

noext

New Member
Hi here, anyone have i idea for the cpu it would take for encoding 1080p@60fps ? i follow the tutorial its works fine, but when i try streaming 1080p@60fps its laggy ( even on vlc lan network ) in the ffmpeg logs i saw my cpu cannont handle 60fps ( he barrely make ove 30 fps ) but he only run @30% , theire is a way to "optimize" ffmpeg to use 100 % of cpu ?
 

Seanzky

New Member
Is there another guide besides this one? I tried following the OP's guide but every time I go to my Twitch channel to see if it's streaming, it still says OFFLINE. I also tried using VLC and there's an error about "undf" or something. I read the whole thread and saw some have the same problem I have but didn't see a solution to their problem. Any help is greatly appreciated! I'm considering canceling my capture card order and skipping it altogether.

UPDATE: I found another one based on the guide the OP has in this thread. In case anyone also wants it... https://killpond.wordpress.com/2014...ng-using-two-machines-without-a-capture-card/
 
Last edited:

Bamse

Member
A small update from me may be in order since I started using this method a few months ago, again.

I ran into so many performance issue using a single PC setup with my CPU-wise shitty gaming 'puter I went back to using this method again. After some tinkering and it really is working like a charm, most of the time.
I'm using NVEnc on my gaming rig, still streaming at 40kbps (50kbps still gives me GPU overload (warning in OBS and frame drops/skips) in games like Arma3, not sure why :/) and re-encode it for twitch broadcasting on my (quite powerful) i7-based laptop, now properly dualbooted with a linux gui-less installation.
There is a noticeable difference in performance between running it on VMware ESXi 5.5 and a proper dual boot on my laptop, measurable in a full step on x264-preset. On dualboot I'm able to do 720p@60 in fast preset, on VMware I can only go to faster before getting frame skips or artifacts.

I still do run into problems with the GPU being overloaded on my gaming rig when there's too much shit going down from time to time (but not so often it fucks with my streaming mojo :P), but I'm looking to circumvent this by upgrading my CPU from the ancient i7 860 I have now to a i7 5920k and use the QS functionality to offload my GPU.

Quick specs from my twitch-profile:
Gaming computer:
CPU: i7 860 @3.6GHz
MEM: 8GB
GPU: GTX780

Streaming 'puter:
CPU: i7-2630QM
MEM: 12GB
Ubuntu 14 LTS with nginx + rtmp
 
Last edited:

Bamse

Member
Seansky: I got the undf-error when I fucked stuff up in the ffmpeg-exec line when I was trying to get it to work a while back. Go over each and every argument and make sure there's no missing characters.

Some bullet points:
Are OBS able to connect and establish a stream via rtmp? Can you connect to the raw rtmp output made by OBS with VLC?
Go over all streaming applications and check there for errors as well.
Any errors in the nginx/rtmp logs?

Post your nginx.conf so we can help youcheck it mayhaps? Be sure to remove your twitch stream key before you do tho :)
 

Seanzky

New Member
That's the thing, I just copied and pasted what the OP posted with regards to the .conf file. I changed the $name to the stream key in OBS, and the ${name} to whatever. That's what I understood from the other posts at least. Maybe I understood wrong and that's where the problem is?

To answer your questions, I was able to connect OBS via RTMP to the Linux box. I couldn't check the output using VLC due to the error.
 
Last edited:

Bamse

Member
roger that.
Well, here's my config if you want for comparison :)
There's still a lot of text profiles in there, but as per usual it's the uncommented exec line that's in use.
Not sure shy it inserts alot of line breaks tho when I paste it here, but ohwell :)

Code:
#user  nobody;
#worker_processes  1;
worker_processes 8;

error_log  logs/rtmp_error.log debug;
pid        logs/nginx.pid;

events {
    worker_connections  1024;
}

http {
    allow all;
    deny all;

    access_log         logs/rtmp_access.log;
        include        mime.types;
    default_type      application/octet-stream;
    sendfile            on;
    keepalive_timeout      65;
       
    server {
        listen        80;
        server_name    localhost;
       
        # rtmp stat
        location /stat {
            rtmp_stat all;
            rtmp_stat_stylesheet stat.xsl;
        }
       
        location /stat.xsl {
            # you can move stat.xsl to a different location
            root html;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}

rtmp {
    server {
        listen 1935;
        chunk_size 8192;
#                chunk_size 4096;
        #publish_time_fix on;
        #publish_time_fix2 on;
#        max_streams 512;
       
# Transcoding (ffmpeg needed)
        application big {
                 live on;
            record off;
           
            # On every pusblished stream run this command (ffmpeg)
            # with substitutions: $app/${app}, $name/${name} for application & stream name.
            #
            # This ffmpeg call receives stream from this application &
            # reduces the resolution down to 32x32. The stream is the published to
            # 'small' application (see below) under the same name.
            #
            # ffmpeg can do anything with the stream like video/audio
            # transcoding, resizing, altering container/codec params etc
            #
            # Multiple exec lines can be specified.

#            exec ffmpeg -re -i rtmp://localhost:1935/$app/$name -vcodec flv -acodec copy -s 32x32
#                        -f flv rtmp://localhost:1935/small/${name};
#                      
                exec ffmpeg -i rtmp://localhost/big/720p -vcodec libx264 -preset fast -x264opts nal-hrd=cbr:force-cfr=1:keyint=120 -profile:v main -level 4.1 -b:v 3500k -maxrate 3500k -bufsize 3500k -r 60 -acodec copy -f flv rtmp://localhost/small/720p;
#720p30        exec ffmpeg -i rtmp://localhost/big/1080p -vcodec libx264 -preset fast -x264opts nal-hrd=cbr:force-cfr=1:keyint=30 -b:v 3500k -maxrate 3500k -bufsize 3500k -s 1280x720 -sws_flags lanczos -r 30 -acodec copy -f flv rtmp://localhost/small/720p;
#old            exec ffmpeg -i rtmp://localhost/big/1200p -vcodec libx264 -preset medium -x264opts nal-hrd=cbr:force-cfr=1:keyint=60 -b:v 4000k -maxrate 4000k -bufsize 4000k -s 1280x800 -sws_flags spline -r 30 -acodec copy -f flv rtmp://localhost/small/800p;
#1080p        exec ffmpeg -i rtmp://localhost/big/1080p -vcodec libx264 -preset faster -x264opts nal-hrd=cbr:force-cfr=1:keyint=30 -profile:v main -level 4.1 -b:v 3500k -maxrate 3500k -bufsize 3500k -r 30 -acodec copy -f flv rtmp://localhost/small/1080p;


        }

        application small {
            live on;
            record off;
            interleave on;
            meta copy;
            publish_notify on;
#            wait_key on;
#            wait_video on;
            push rtmp://live-arn.justin.tv/app/PHTEVEN
            }
        }
    }
 

Seanzky

New Member
UPDATE: I found another one based on the guide the OP has in this thread. In case anyone also wants it... https://killpond.wordpress.com/2014...ng-using-two-machines-without-a-capture-card/

So this guide works... somewhat. VLC shows the crisp, beautiful stream from OBS, but Twitch doesn't pick it up. I'm looking at the push line and there is nothing there that could possibly be wrong. I'm a little lost. I mean, that's the only place to look if the stream isn't being pushed to Twitch, right?
 

Bamse

Member
There is where the setting is, yes.

Most rtmp related issues when connecting (no matter if it's obs or the outbound connection to twitch) should be here: /usr/local/nginx/logs/rtmp_error.log (or well, basically your nginx-install-dir/logs/rtmp_error.log) ... take a look in that one for errors.
Can you stream directly to twitch? I'm fishing for possible firewall issues ;)
Sometimes when stream gets disconnected or I do a quick stop stream/start stream in OBS it can take like a minute or three to get the stream back and visible on twitch so try giving it some time aswell. Not sure why this happens, but I'm sure someone else can fill this info in? :)

This is how an excerpt. looks from my rtmp_error.log when everything goes right where the entry "2015/02/01 20:06:34 [info]" is the most interesting one:

Code:
2015/02/01 20:06:32 [info] 1098#0: *1 client connected '192.168.0.10'
2015/02/01 20:06:32 [info] 1098#0: *1 connect: app='big' args='' flashver='FMLE/3.0 (compatible; FMSc/1.0)' swf_url='rtmp://192.168.0.25/big' tc_url='rtmp://192.168.0.25/big' page_url='' acodecs=0 vcodecs=0 object_en$
2015/02/01 20:06:32 [info] 1098#0: *1 createStream, client: 192.168.0.10, server: 0.0.0.0:1935
2015/02/01 20:06:32 [info] 1098#0: *1 publish: name='1080p' args='' type=live silent=0, client: 192.168.0.10, server: 0.0.0.0:1935
2015/02/01 20:06:32 [info] 1098#0: *1 exec: starting managed child 'ffmpeg', client: 192.168.0.10, server: 0.0.0.0:1935
2015/02/01 20:06:32 [info] 1098#0: *2 client connected '127.0.0.1'
2015/02/01 20:06:32 [info] 1098#0: *2 connect: app='big' args='' flashver='' swf_url='' tc_url='rtmp://localhost/big' page_url='' acodecs=3191 vcodecs=252 object_encoding=0, client: 127.0.0.1, server: 0.0.0.0:1935
2015/02/01 20:06:32 [info] 1098#0: *2 createStream, client: 127.0.0.1, server: 0.0.0.0:1935
2015/02/01 20:06:32 [info] 1098#0: *2 play: name='1080p' args='' start=0 duration=0 reset=0 silent=0, client: 127.0.0.1, server: 0.0.0.0:1935
2015/02/01 20:06:34 [info] 1098#0: *3 client connected '127.0.0.1'
2015/02/01 20:06:34 [info] 1098#0: *3 connect: app='small' args='' flashver='' swf_url='' tc_url='rtmp://localhost/small' page_url='' acodecs=0 vcodecs=0 object_encoding=0, client: 127.0.0.1, server: 0.0.0.0:1935
2015/02/01 20:06:34 [info] 1098#0: *3 createStream, client: 127.0.0.1, server: 0.0.0.0:1935
2015/02/01 20:06:34 [info] 1098#0: *3 publish: name='720p' args='' type=live silent=0, client: 127.0.0.1, server: 0.0.0.0:1935
2015/02/01 20:06:34 [info] 1098#0: *3 relay: create push name='720p' app='' playpath='' url='live-arn.justin.tv/app/<PHTEVEN>', client: 127.0.0.1, server: 0.0.0.0:1935
2015/02/01 22:02:00 [info] 1098#0: *1 deleteStream, client: 192.168.0.10, server: 0.0.0.0:1935
2015/02/01 22:02:00 [info] 1098#0: *1 exec: terminating child 1206, client: 192.168.0.10, server: 0.0.0.0:1935
2015/02/01 22:02:00 [info] 1098#0: *1 disconnect, client: 192.168.0.10, server: 0.0.0.0:1935
2015/02/01 22:02:00 [info] 1098#0: *1 deleteStream, client: 192.168.0.10, server: 0.0.0.0:1935
 

Seanzky

New Member
When you say firewall issues, is there somewhere in Ubuntu I can check for that because I don't think my router blocks anything when it's my RTMP server pushing to Twitch, right? I'll take a look at the logs in a bit. My other suspicion is that it never sends to the "live" application from "transcoding". Maybe the exec line has something going on there.

UPDATE: I opened up 1935 in my router for my streaming PC and still nothing. I don't know what it is, but it has to be in these lines...

Code:
        application transcode {
            live on;
            record off;
            exec avconv -i rtmp://localhost:1935/transcode/ice -c:v libx264 -profile:v main -preset medium -cbr_quality 10 -re -crf 23 -r 30 -g 60 -b:v 3500k -maxrate 3500k -minrate 3500k -bufsize 7000k -acodec copy -s 1280x720 -f flv rtmp://localhost:1935/live/ice;
        }
        application live {
            live on;
            record off;
            push rtmp://live-jfk.twitch.tv/app/xxxxxxxxxxxxxxxxxxxxxx;
        }

The transcode block definitely works since it works on VLC. But from that part to the hand-off in the live part, something went wrong. Can someone tell me where I went wrong???

UPDATE #2: Everything works flawlessly!!! No stutters, hiccups, etc. It was the 'exec' line. If anyone has questions, just ask and I'll post my config.
 
Last edited:

makkaan

Member
When you say firewall issues, is there somewhere in Ubuntu I can check for that because I don't think my router blocks anything when it's my RTMP server pushing to Twitch, right? I'll take a look at the logs in a bit. My other suspicion is that it never sends to the "live" application from "transcoding". Maybe the exec line has something going on there.

UPDATE: I opened up 1935 in my router for my streaming PC and still nothing. I don't know what it is, but it has to be in these lines...

Code:
        application transcode {
            live on;
            record off;
            exec avconv -i rtmp://localhost:1935/transcode/ice -c:v libx264 -profile:v main -preset medium -cbr_quality 10 -re -crf 23 -r 30 -g 60 -b:v 3500k -maxrate 3500k -minrate 3500k -bufsize 7000k -acodec copy -s 1280x720 -f flv rtmp://localhost:1935/live/ice;
        }
        application live {
            live on;
            record off;
            push rtmp://live-jfk.twitch.tv/app/xxxxxxxxxxxxxxxxxxxxxx;
        }

The transcode block definitely works since it works on VLC. But from that part to the hand-off in the live part, something went wrong. Can someone tell me where I went wrong???

UPDATE #2: Everything works flawlessly!!! No stutters, hiccups, etc. It was the 'exec' line. If anyone has questions, just ask and I'll post my config.

Can i have your config? I can start the stream, but it wont push the stream to twitch.
And i dont know how to check the stream if it works in VLC...
 

Seanzky

New Member
Please keep in mind these are my settings and might not work for everyone. I'm just sharing them because someone asked. Also don't forget to sudo apt-get install libav-tools because I use avconv here. If you've read my previous posts, I couldn't figure out why it wouldn't push the stream to Twitch and as it turned out, it was in the exec line AND I didn't have avconv. Good luck!

nginx.conf


Code:
rtmp {
    server {
        listen 1935;
        chunk_size 4096;
        application transcode {
            live on;
            record off;
            exec avconv -re -i rtmp://localhost:1935/transcode/ice -c:v libx264 -profile:v main -preset medium -cbr_quality 10 -crf 23 -r 60 -g 120 -b:v 3500k -maxrate 3500k -minrate 3500k -bufsize 7000k -s 1280x720 -acodec copy -sws_flags spline -f flv rtmp://localhost:1935/live/ice;
        }
        application live {
            live on;
            record off;
            push rtmp://live-jfk.twitch.tv/app/ENTER_YOUR_STREAM_KEY_HERE;
        }
    }
}

OBS settings

Encoding

Quick Sync or Nvidia NVENC
Use CBR
Enable CBR padding
Max Bitrate 20,000
Buffer Size 20,000
AAC
128 bit
44.1kHz
stereo

Broadcast Settings
URL: rtmp://YOUR_RTMP_SERVER_IP:1935/transcode
Stream key: ice

Video
Custom 1920x1080
No downscale
FPS 60
 
Top