[Guide] Two PC configuration without Capturecard

Bamse

Member
Hol-ee-shit.
I got a new 'puter, finally making the switch from my old i7 860 to a 4790K (but keeping the GTX780, that one actually performs like a beast in all modern titles still :D) and boy-oh-boy do everything run sweet.

This has happened stream-wise;
NVenc is no more, I'm using QS instead with best quality settings and default (unticked) under the advanced settings, 50000kb/s, 7000kb/s buffer. No more NVenc/GPU encoding overload, resulting in stream-sub-60fps, in certain heavy situations *cough*Arma 3*cough*

CPU usage is negligible and everything runs smooths as butter on a cows butt.
I'll prolly do some overclocking (jus' bcuz') and possible even tweak QS for the sake of performance, but that will come at a later stage since everything is working great as-is.

For everyone that is just a slightly tech-savvy and don't want to run into problems with capture cards and monitor refresh rates I couldn't recommend this more. This thread rocks :D
 

BlackDwarf

New Member
Hi guys.

I've got a stream VM set up and everything is working great with nginx and transcoding up to Twitch. Sending a 50000 QuickSync stream to the streambox. The problem I'm having is that I don't seem to have the seek bar on twitch archive videos. Bamse, I saw in another thread that you had a similar problem but I couldn't find the resolution to it, but it was something to do with the transcoding process?
Below is the transcode line in my nginx.conf

Code:
exec avconv -i rtmp://localhost:1935/transcode/stream -c:v libx264 -profile:v main -preset veryfast -cbr_quality 10 -re -crf 23 -r 30 -g 60 -b:v 3000k -maxrate 3000k -minrate 3000k -bufsize 1500k -acodec copy -f flv rtmp://localhost:1935/live/${name};

Would love to get this resolved.

Cheers
 

Bamse

Member
I was convinced that it had to do with the transcode, but I'm not 100% anymore. Like you mention I had issues and I did change some parameters (encoding profile from high to main for instance) and suddenly the seek bar re-appeared.
Now without even changing a single thing (well, apart from upgrading OBS to 0.65, but I cant see how that should matter since I do transcode everything except audio) my seek bar is gone again.
Often when I try to stream to a second test-account and lower the FPS to 30 it seems to work most of the time and it doesn't seem to matter what I do, but changing fps to 60 and keyint to 120 it randomly breaks the seek bar. Some streams are seekable, some not and that annoys the crap outta me :/

As a direct response to your command line:
I've never used avconv myself so I can't vouch for that and I've _never_ used the -cbr_quality, -g and -crf switches.
But, looking at the GOP options settings, is there a benefit of defining it that way instead of using the keyint found in x264opts? Same goes for explicitly changing crf when there's already a defined preset (veryfast in this case). Ofc, I might be wrong on this one tho but isn't the crf defined by the preset also?

I've read both good and bad things about the -re flag, but mainly it should't be used when using avconv/ffmpeg as a live video grabber. Its main use is when encoding or transcoding set files. In the past decided not to use it since everything was working like a charm, but now since the seekbar is gone I might try it out just because I can :P

TL;DR
I don't have any straight answers because even tho I mimic the minimum required settings that twitch has it doesn't always work but I'll start troubleshooting later this week.
 

Bamse

Member
I've been trying out all kinds of stuff this evening and it I can now say I'm 100% sure its the transcode.
If I run my normal 50000kb/s settings, but if I change my bitrate to 3500kb/s and specify twitch instead of my nginx/rtmp-machine everything works perfectly. As soon as I change it back my seek bar disappears.
I've been trying all kinds of settings in ffmpeg and no matter what twitchs' or R1CH's stream analyzer (webpage version, not the computer/connection test program) says everything looks good and works just fine, but VODs are without a seek bar and got no "0:05/3:00"-meter in the bottom bar until the whole video has been played.
I'm not sure what I'm gonna try next but I guess redoing the nginx config from square one to make sure I haven't done any mistakes. I'll report back in ~24h hours.

I'm using Ubuntu 14,04 LTS on my server installation and I've been using this PPA to get ffmpeg: https://launchpad.net/~jon-severinsson/+archive/ubuntu/ffmpeg
Can it be an idea to try to upgrade using this one instead?
https://launchpad.net/~mc3man/+archive/ubuntu/trusty-media
It's also listed on ffmpeg.org and seems to be using quite a newer version of ffmpeg.
 
Last edited:

Bamse

Member
Yuck, I've tried everything I can possibly think of. I've upgraded ffmpeg, I've tried with a blank new nginx.conf, new very simple exec ffmpeg lines etc etc. No seek bar to be seen anywhere :P

Looking at the rtmp_error.log I see one thing that catches my eye a bit;

when OBS connects the log looks like this:
Code:
2015/03/11 23:18:15 [info] 3318#0: *1 client connected '192.168.0.10'
2015/03/11 23:18:16 [info] 3318#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_encoding=0, client: 192.168.0.10, server: 0.0.0.0:1935

A fraction later it comes to the exec command and it connects to itself
Code:
2015/03/11 23:18:16 [info] 3318#0: *1 exec: starting managed child 'ffmpeg', client: 192.168.0.10, server: 0.0.0.0:1935
2015/03/11 23:18:16 [info] 3318#0: *2 client connected '127.0.0.1'
2015/03/11 23:18:16 [info] 3318#0: *2 connect: app='big' args='' flashver='LNX 9,0,124,2' swf_url='' tc_url='rtmp://localhost:1935/big' page_url='' acodecs=4071 vcodecs=252 object_encoding=0, client: 127.0.0.1, server: 0.0.0.0:1935
Hmm, very different flashVer and quite a lot of other changed parameters. Might still be cool since it's the internal transcode starting I guess...

Stuff continues to happen and we watch the output
Code:
2015/03/11 23:18:18 [info] 3318#0: *3 client connected '127.0.0.1'
2015/03/11 23:18:18 [info] 3318#0: *3 connect: app='small' args='' flashver='FMLE/3.0 (compatible; Lavf56.25' swf_url='' tc_url='rtmp://localhost:1935/small' page_url='' acodecs=0 vcodecs=0 object_encoding=0, client: 127.0.0.1, server: 0.0.0.0:1935

Ok, now I'm getting a bit suspicious; flashVer on the output is way off, missing a closing ")" and it's also not the compatibility I'd want, right? :) I'm very out of my depth here, but if I could choose I'd want it to mimic the input in as many ways as possible.

We continue ...
Code:
2015/03/11 23:18:18 [info] 3318#0: *3 relay: create push name='720p' app='' playpath='' url='live-arn.justin.tv/app/<SUPERSECRETSTREAMKEY>', client: 127.0.0.1, server: 0.0.0.0:1935

push looks kinda good, no weird things there.

So, I read up on some RTMP-module specific keys you could try, especially for the pull and push "commands". They have a key you can specify for the flashVer, but I'm having all kinds of issues there. Nothing I input as flashVer changes anything in the log and seek bar is still gone.

I'm on the verge of starting ripping hair and I've prepared OBS for streaming directly to twitch :P
What bugs me the most is that I haven't changed anything on the streaming computer until i started troubleshooting. Damnit! :)
 

BlackDwarf

New Member
Any movement on your discussion with Twitch?
I'm helping run a LAN this weekend and was going to repurpose my stream VM to handle our outgoing Twitch coverage but I fear it'll be slightly worthless footage if there's no seek capability on the VOD after.
Seems even if you download the VOD after the fact, seeking is unavailable on the download :\
 

Bamse

Member
I've had a wall of silence for about a week and a half now, and with the recent events over at twitch HQ I can now understand why :)

But, after abandoning this solution for all my "real" streams and going back to a 1PC setup I tried this again this past Sunday. Result: it works again.
I've made one change to the config (apart from changing the stream key :P) and that is that I've added a second push line to hitbox.tv, so that the ppl having issues with my stream on twitch can watch my stream lag/buffer/stutter free there.

So give it a whack, for me it works all of a sudden \o/
... for now :P
 

BlackDwarf

New Member
Haha!

I've gone and installed proper ffmpeg on the VM and switched to your previously shown settings:
Code:
exec ffmpeg -i rtmp://localhost:1935/transcode/stream -vcodec libx264 -preset veryfast -x264opts nal-hrd=cbr:force-cfr=1:keyint=120 -profile:v main -level 4.1 -b:v 3500k -maxrate 3500k -bufsize 1750k -r 60 -acodec copy -f flv rtmp://localhost:1935/live/${name};

And still no seek bar on Twitch for me.
Adding a second push would double outbound bandwidth, yes?
 

Bamse

Member
Try changing profile level to 4.0, not even sure there is a main level 4.1, my bad posting that. But after all my testing I doubt that will fix it :/

Correct on the bandwidth.
 

Dubardo

New Member
I've manage to stream my feed to Twitch, but I've a severe case of stuttering...

My FFMPEG.bat is:
Code:
ffmpeg -i rtmp://localhost:1935/live/raw -vcodec libx264 -preset fast -x264opts nal-hrd=cbr:force-cfr=1:keyint=120 -profile:v main -b:v 3500k -maxrate 3500k -minrate 3500k -bufsize 3500k -threads 12 -s hd720 -sws_flags spline -r 60 -acodec copy -f flv rtmp://localhost:1935/twitch/1080

And my nginx.conf is:
Code:
rtmp {
    server {
        listen 1935;
        chunk_size 8192;

        application live {
            live on;
            record off;           
                                    
        }
            application twitch {
            live on;
            record off;
            push rtmp://live-jfk.twitch.tv/app/[streamkey];
              

        }
    }
}

Seems like my FFMPEG doesn't upload at the speed it's compressing.
FFMPEG compress at around 3500kbps and then proceced to upload at 1-2mbps/s... which would explain the stuterring. Also really bad quality in compression from my FFMPEG code, i've got a dedicated i7 920 for that, I expected better.
 

Bamse

Member
Whats your CPU usage?
IF you are in the hih 80's I'd start with trying a faster preset, like veryfast and going from from there.
My i7 2630QM can just about handle the faster preset and although being a mobile CPU it's quite a few generations newer than the 920.
And remember that not many non-partners are able to run 3500kb/s without stuttering no matter what method of delivery they use :(
If your CPU can handle it, try streaming to hitbox.tv (or similar) and see if you stream is stuttering there perhaps, just for testing purposes that is. :)
 

Bamse

Member
ooooooooh my god.
I think I finally found what's been causing the VOD-not-being-able-to-fast-forward issue I've been having on twitch for the past like 4-6 months :D

When setting up an application in the rtmp-module it defaults to "meta on;", this didn't work for me so I've been running with "meta copy;" since I wanted as much data as possible to be mimicked from the OBS-output. After trying what I thought was everything I finally tried turning off meta completely by using "meta off;" on my push-application. I've streamed some shorts tests and in all of my ~30 tries in varying length I've not gotten one VOD that wasn't able to be time-skipped.

So, for now I'm a very happy camper :D
 

goldenh

New Member
This is great! I've been using it for a while now. But, I'd like to use it as a audio compressor as well. I can't seem to figure it out, because I can't figure out how to get ffmpeg to make an error log or capture stderr. All I want to do is set the threshold to 18db with a ratio of 3.0, in mono ac3 if possible. Thanks!
 

Bamse

Member
I haven't tried it out myself in any live scenarios because at the time I was looking at compressing with ffmpeg I found an overwhelming amount of negative threads on this compared to good ones.
Most guides that I've read points to the compand-filter available for ffmpeg with its documentation here: http://ffmpeg.org/ffmpeg-filters.html#compand
After some basic testing I went with VST-hosted plugins with a GUI compressor/gate/expander on my gaming rig instead since my setup allows for this ... it was just way to finicky with the command line :)

And most important, I wanted to let as much CPU power to be "dedicated" to the video transcoding as possible. Using the filter took at least a noticeable amount and I was way to anal to let that happen ;)
 

goldenh

New Member
Thanks Bamse, I was aware of the compand filter, but I'm not sure I'm using it right as the stream seems to reset every few seconds when I copy paste any of the example compands. I currently use VSThost and the Reaper Compression plugin but I've become dissatisfied with it because something about my setup introduces a random latency of between 100-400ms onto the audio for the stream that changes over time. More importantly, I have my mic input and skype input - and after putting each through a separate VSThost instance - they have *different latencies* so I can only compensate for one at a time.

compand might not be the best quality but it will allow me to keep the unedited audio file with no latency along with the higher quality video which I can post-process for youtube. I don't need it to balance music or game sounds, just act as a cap for multiple human voices so excited laughing and shouting doesn't break viewer's eardums :)

If you can give me an example of a working ffmpeg command line that uses compand based on the below (from the OP) I'd really appreciated it!

exec ffmpeg -i rtmp://localhost: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 -s hd720 -sws_flags spline -acodec copy -f flv rtmp://localhost:1935/live/${name};

Otherwise can you tell me how to enable ffmpeg error logging in the virtual machine so I can try and get help on the ffmpeg forum. Adding 2> /home/streamer/error.log to the end of the ffmpeg command doesn't seem to work and I tried adding the -Report option, I can't seem to find the error log if it is producing one.
 
Last edited:

goldenh

New Member
Update: I figured out that I could run the same command from the command line (changing the output to a flv file) to get the error log, which told me that the compand settings I was using required stereo input. That's fine, so I can stream fine. But I'd still like answers to both my questions!
 

Bamse

Member
I'll have to tap out on this one.
dI Don't have my old command lines saved anywhere and I have no idea how to get the error reports logged I'm afraid, mainly because I haven't tried :P
 

goldenh

New Member
No problem! I think I've figured it out...
compand=0 0:1 1:-90/-900 -70/-70 -18/-18 0/-6:0.01:0:0:0

It doesn't sound quite right buuuuut I think this is the intended command.
 

Beast96GT

Member
Thanks for writing this up, guys.

My setup:
PC 1 : Intel 4790K, GTX 980ti SLI, I need to use NVENC since it supports > 1080p (QS does not).
PC 2 : Intel 5820K, GTX 560, Ubuntu, FFMPEG

My questions:
1. Does FFMPEG need to be compiled with NVENC codecs to receive the stream from OBS and transcode it? I'm asking because my setup worked with Quick Sync, but FFMPEG won't work with OBS set to NVENC!

2. Does FFMPEG need different command line arguments for, say -vcodec, to use NVENC?

3. Do I have to have an Nvidia video card with NVENC technology in PC 2 for FFMPEG to transcode it?

THANKS, I feel like I'm super close on this one... but these last few hurdles are driving me NUTS.
 

Bamse

Member
1. I'd say nope. I can stream using both NVENC, software x264 or QS without any issues on the nginx-side. Granted, I run a nowadays pretty old build of nginx/rtmp and ffmpeg that I haven't updated since ... uh ... february or something? :)
It really shouldn't matter tho since the all output from OBS is x264 in a flv container (using standard settings) following certain standards , it's just a matter of what mechanic is encoding the input to x264.

2. Definitely nope.

3. See no. 2.

Please post your ffmpeg command used in nginx and we might spot something there perhaps? :)
 
Top