Private RTMP server (preconfigured virtualbox image)

014

Member
If you used vim, then you:
1 Hit Escape
2 Type "w:q"
3 Hit Enter

If you used nano, then you:
Read the help at the bottom of the screen.

Be sure to restart nginx after making changes.
 
If you used vim, then you:
1 Hit Escape
2 Type "w:q"
3 Hit Enter

If you used nano, then you:
Read the help at the bottom of the screen.

Be sure to restart nginx after making changes.
apparently I had to type :wq (save and quit) so thanks :)

Also I suppose uncomment lines, is just deleting the # in front of the lines right?

edit:

so when I try to start stream (which I should have adjusted to be pushed to twitch) it tells me this:

nginx: [emerg] host not ound in url "live-ord.twitch.tv/app/live_xxxxxxxxxx... in /usr/local/nginx/conf/nginx.conf:132


edit:

had to change the twitch rtmp server. http://bashtech.net/twitch/ingest.php


edit2:

It all works pretty well but I would like my content to be streamed at 720p60fps.. With the default ffmpeg string(on this thread page3 it seems to be pushing to twitch at only 30fps? what exactly should I change?
 
Last edited:

014

Member
There should be a -r 30 in your config line. Change it to -r 60. I didn't know that Twitch could do 60fps, but I didn't look it up either.
 
Found that by now. But thanks though!

Current setup:

Gaming pc:
-windows 8.1 x64
-i5 2500k @4.5 auto-oc
-gtx780
-8gb ram
-obs 0.638 nvenc encoding(advanced:high quality) max br: 15000kbps buffer: 5000kb

rtmp laptop:
-windows 8.1 x64->virtualbox with your(014) nginx debian 1.2.7(4 virtual cores used 1024mb) ffmpeg fast preset 720p60fps
-i7 3610qm
-16gb ram

One more thing: I used the twitch livestream analyzer from r1ch and everything was perfect except:

"Your bitrate has high variation (4729 kbps ±625.56) which may cause lag for viewers. Make sure you are broadcasting in CBR (Constant Bitrate) mode and that "CBR Padding" or "Strict CBR" is enabled.""

I didn't change anything about the default 3000kbps max/min/... from your nginx build. So is there a way to fix this in the ffmpeg line?

Or is this because my obs is sending at 15000kbps to the rtmp server and it should be lowered from there as well?


Stream Info
  • Resolution: 1280x720
  • Frame Rate: 59 FPS
  • Audio: aac, 44100 Hz, stereo, s16, 104 kb/s
  • Total Bitrate: 4892 kbps
  • Padding: None
  • Stream Uptime: 1h 8m 29s
Video Frame Rate

Your average stream frame rate looks stable at 59 FPS ±2.2.


Quality Check

Your bitrate is sufficient for the resolution and FPS you are using (qval: 0.087).

Your audio levels look good (level: -25.0929 dB, peak: -15.5744 dB).

Stream Availability
United States: Poor

Europe: Poor

Dropped Frames

No dropped frames were detected.

Keyframe Check

Your keyframe interval looks good - 2s ±0 (120 frames ±0)
for more info

When I watch the stream from the twitch dashboard on pc, It freezes for 1-2 sec each minute or so. Even from the twitch app on my HTC one(m8) smartphone(Not happening with other channels). Music/sound never stops though. I don't know what might be the big cause for that but I'm guessing it all has to do with my cbr not being strict..

Also another thing: in my twitch dashboard I get the message I have a 4sec keyframe interval..although in my obs settings it's set to "2" so I think that also has to be changed somewhere in that ffmpeg line?


Sry for the wall of text, but I'm pretty close to being satisfied with the setup.
 
Last edited:

014

Member
Below are the settings that I use. I had the stuttering every now and then problem as well for a long time. I think I fixed it the other day by doing two things: 1) I made the buffer twice the size as the encoded video. 2) I made OBS resize the feed down to 720p before sending it on to the transcoder.

As far as the high bitrate goes, I'm not sure. I haven't used that Twitch tester, so I will have to monkey with it. You could look in Resource Monitor in Windows and go to the Networking tab to see how much data the VM is sending to the internet per second. You would open that on your laptop of course.






EDIT:
Oh, one thing about the stutter every minute or so is it doesn't happen if you watch the feed through a means other than Twitch. For example, if you watch your RTMP feed from your phone using MX Player, it won't stutter ever. If you watch from your own streaming page instead of Twitch, it doesn't stutter there either. Let me know if you still get stuttering after changing the bufsize in the ffmpeg command and the resolution in OBS.
 
Last edited:
Just noticed I had both exec enabled. Placed a # in front of the first exec

Of course that solved it :)

Having troubles finding the right fps/bitrates/presets now though. at this moment I'm about to try the exact same settings as you on both obs and the rtmp machine. One question though: what is the -re for? Googled it, but cannot seem to find an answer on that.
 

Attachments

Last edited:

014

Member
According to the ffmpeg man page, -re makes it simulate a grab device. I take that as meaning to simulate a dedicated capture card.

By the way, if you type "man ffmpeg" in the console, you'll be presented with the same info as the site I linked. You can use this same practice for nearly all Linux programs, like "man nginx" also.

For bitrate, I plugged in my settings based off of two things. I used the OBS settings from a separate thread here on this forum about hosting your own RTMP server (but not this preconfigured VM thread). For the ffmpeg settings, I used a Twitch guideline page that tells you what you should use depending on the resolution you're pushing. Search for "bitrate" on the page and you'll see recommendations. 2500k is what I have set in ffmpeg because that's what they say should be good for 720p. I get all green check marks for quality when I broadcast.

You might notice that the ffmpeg command I use does a straight copy of the audio coming from OBS. That means you should adjust it in OBS if you want it changed. You could also adjust ffmpeg, but I personally prefer it the way it is currently.
 

014

Member
Page 3 of this thread is where I mention /usr/local/nginx/html/stream/index.html. You will need to copy or mimic that file structure and then adjust the contents of index.html as necessary.

When I recreated a streaming server instead of using my VM, I used WinSCP to copy folders and files to my computer, and then copied them to the new streaming server. You could copy them directly from the VM to the new server, but I chose not to.

I have considered making this streaming setup into a nice installation script as another option beside downloading the VM. The goal would be to just run a single script and voila, you're done. It would be nice to have for Rasberry Pi or hosted VPS's, although I don't have a Pi to test with. I just haven't taken the time to develop such a script.
 
Last edited:

mrgreaper

Member
yeah i worked around it,

i loaded up the console on the vm image (ctrl+alt+t)
located the www folder (think it was /etc/www but not sure)
archived the live folder
then it got tricky lol
i used the command line ftp client in the vm image to connect to the pi's ftp and transfered the zip over
then transfered it to my pc to be unziped and edited
transfered the live folder to my ngnix html folder (/usr/local/nginx/html/)
chmod 777 it (im lazy)
i can now go to myip/live and viola there it is :)

why all the steps? the company that makes jwplayer seem to have taken the old downloads down (hence why the wget fails in other guides and now you need a license for the new version (limited to number of streams to for free users))
i like the old version, im not making money from my streams (and certainly never will from the jwplayer that is only thier for my co-host to see) after all

im sure there are easier ways lol

i do recommand a pi2, great devices if a little frustrating at times...that reminds me, must back up the sd card
 

sneaky4oe

Member
So, guys, I'll just leave this message here in case someone'll be interested in this info (I didn't find it when was looking for a laptop to buy):

I now own a laptop Asus X550DP and bought it to transcode&stream my gameplay to ****d up laggy twitch.
AMD A10-5750M, Radeon HD 8670M and Radeon HD 8670G

On fresh windows 8 I've built my own server of ubuntu 14.04 64x, gave it all 4 cores with 100% times in virtualbox, and setup nginx + ffmpeg.
exec ffmpeg -i rtmp://localhost/restream/1234 -vcodec libx264 -g 60 -preset veryfast -b:v 2000k -maxrate 2500k -bufsize 3000k -s 1280x720 -sws_flags lanczos -acodec copy -r 30 -f flv rtmp://localhost/lowered720/;

is my setup for this transcoding, demo is saved here: http://www.twitch.tv/sneaky4oe/c/6273131
It consumes from 50% up to 85%. Rarely goes to 100% of CPU usage, but overall picture is nice, as you can see. It's possible to lower preset and increase bitrate, but won't work with damned twitch.

In case someone'll need commands I use for server:
rtmp
{
server
{
listen 1935;
chunk_size 8192;
ping 10s;

application restream
{
live on;
meta copy;

# Direct streaming:

# Twitch source
# push rtmp://live-fra.twitch.tv/app/*****;

# GamingLive
# push rtmp://broadcastEU.gaminglive.tv/push/*****;

# HitBox
# push rtmp://live.hitbox.tv/push/*****l; #hitbox

# DailyMotion
# push rtmp://publish.dailymotion.com/*****; #dailymotion

# Cybergame source
# push rtmp://premium2.cybergame.tv:1953/premium/*****; #cybergame source

#### Lowered quality stream 720p @ localhost
exec ffmpeg -i rtmp://localhost/restream/1234 -vcodec libx264 -g 60 -preset veryfast -b:v 2000k -maxrate 2500k -bufsize 3000k -s 1280x720 -sws_flags lanczos -acodec copy -r 30 -f flv rtmp://localhost/lowered720/;
####
}

application lowered720
{
live on;
meta copy;

# Twitch lowered
push rtmp://live-fra.twitch.tv/app/*****;

# Twitch funstream_tv
# push rtmp://live-fra.twitch.tv/app/*****;

# GoodGame lowered
# push rtmp://msk.goodgame.ru:1940/live/*****;

# CyberGame lowered
# push rtmp://premium2.cybergame.tv:1953/premium/sneaky4oe~480p?*****;
}
}
}

I'm going to make up new infrastructure, since my laptop is connected to wifi and isn't really stable with it, but for now it's working fine for me.
 
Last edited:

sneaky4oe

Member
In fact,
exec ffmpeg -i rtmp://localhost/restream/ -vcodec libx264 -g 60 -preset faster -b:v 1800k -maxrate 2200k -bufsize 2500k -s 1280x720 -sws_flags lanczos -acodec copy -r 30 -f flv rtmp://localhost/lowered720/;
works really nice at my hardware. Just tested it - looks like youtube 720p video.
http://www.twitch.tv/sneaky4oe/c/6308029
 

014

Member
Why are you running Ubuntu on top of Windows 8 if the laptop is dedicated to transcoding?
 

blaze_125

New Member
Hi, I'm a new member and I just noticed this thread is in the "archived" section of the board... so this info is likely older but whatever... This is still the thread I used to setup my stream so I'll here before I move to other parts of the board.

I followed this thread and I got the stream to work on my Wired connections. Any computer that is wired to the network can now get the feed from my Nginx server. But... it's not working on the Wireless! I don't have a laptop so I can't tell if the issue is the portable device or if it's a networking problem. Every time I try to watch the feed from a mobile device I get a "no playable source found" error. I'm able to get to the "index.html" page that has the player, the player loads, but the feed does not load.

I tried the following mobile devices: Blackberry Z30 running BB10, BlackBerry Playbook running 2.x, iPad 1, iPad3, Android phone running Kitkat.
To sum it up... the feed works fine for wired computers, does not work on wireless mobile devices.

JWPlayer was preloaded on the VM I downloaded, and I added VIDEO-JS. They both behave the same on wireless.

Any clue?
 
Last edited:

014

Member
Hi, I'm a new member and I just noticed this thread is in the "archived" section of the board... so this info is likely older but whatever... This is still the thread I used to setup my stream so I'll here before I move to other parts of the board.

I followed this thread and I got the stream to work on my Wired connections. Any computer that is wired to the network can now get the feed from my Nginx server. But... it's not working on the Wireless! I don't have a laptop so I can't tell if the issue is the portable device or if it's a networking problem. Every time I try to watch the feed from a mobile device I get a "no playable source found" error. I'm able to get to the "index.html" page that has the player, the player loads, but the feed does not load.

I tried the following mobile devices: Blackberry Z30 running BB10, BlackBerry Playbook running 2.x, iPad 1, iPad3, Android phone running Kitkat.
To sum it up... the feed works fine for wired computers, does not work on wireless mobile devices.

JWPlayer was preloaded on the VM I downloaded, and I added VIDEO-JS. They both behave the same on wireless.

Any clue?
My guess is none of those tested devices can play Flash within their web browsers. It shouldn't have anything to do with wired vs. wireless devices. If you tried a laptop over wireless, I bet it would work. If I'm correct, then you can install apps on your mobile devices that can watch RTMP feeds and use the RTMP URL syntax I provided in this post.

If your devices are not using your WiFi and are instead using a cellular service, then your DNS is not set up to allow outside connections.
 

014

Member
Tried in virtual box get error cant run
I have not tested running this 1.3 version on Windows 8.1, but I know the older ones work. You should be able to edit the virtual machine to fix the problem. Remove the ethernet controller and then add a new one. I'm thinking that the driver VirtualBox ties to Windows 8.1 for networking purposes is different than the one it ties to Windows 7, thus the conflict.
 
Top