nginx-rtmp – Usage example / test
Now that we went through all the nginx setup and configuration stuff, its time to tell you about my experiences in using the software.
I set up a test scenario. The video footage of Grid2 and BF3 could come either off a console or a PC. I am capturing this in Box1 with a capture card and save it as a high quality file to disk. This uses a Intel Core2Quad 8400 up to 80-90% on 1080p30fps with the ultrafast preset. So I choose a higher crf value combined with zero buffer to reach a decent quality (similar to fraps/dxtory in most parts). Most I5’s should be able to produce a similar stream while playing on the same PC, but this is just a side note.
Now the nginx server can actually run on any of the PC’s/Boxes we use in this scenario. In my case I installed it on my laptop which I sometimes use to add Video footage to my streams. Running Linux and nginx only, it merely had any work to do by the way. Though if I used a better system for the nginx server, I could have setup an exec transcode to my final streaming settings. My laptop barely can handle encoding, so I have to do this on Box2.
Depending on your steps earlier, you can now again either use your Gaming PC, Box1 or a different Box2. You “just” need free computing power for the encoding on this box. With a simple avconv command line you can grab the high quality stream off the server, transcode it to your desired output resolution and send it back to nginx or directly to twitch or whatever. Assuming you never wanted to do a high quality recording, you can probably tweak my example for your needs. As you can see, nearly unlimited options are available.
The screenshot above shows the cpu usage used by the encoding in the upper part of the left window. In the lower right corner of the screen you can see the avconv.exe running under windows. This one could be replaced by an exec command on the nginx machine, assuming enough cpu power is available.
And in the upper right you can see the statistics of the nginx server. Live1 receives the high quality stream in 1920×1080 with a bitrate of roughly 15Mb at the time. Now this stream is being grabbed by the avconv.exe which explains why Live1 also puts out 15Mb at the time. Live2 receives the transcoded stream by avconv. Its resized to 1280×720 and a bitrate of roughly 2Mb. The nginx server is set to push any stream it receives on Live2 to my twitch.tv and hashd.tv channels. And as you can see, it outputs a near exact double of 4Mb which represents these two streams.
If you have questions or suggestions, just post them below. And now have fun fiddling with your setup.