mclovinbam
New Member
Hey Does anyone have a nginx.conf that i can use that will allow me to stream to it from another location and i can have it show up on my obs like my friend playing a split screen game, showing both povs.
you have to set the split screen in obs. nginx can't do this for you on its own.Hey Does anyone have a nginx.conf that i can use that will allow me to stream to it from another location and i can have it show up on my obs like my friend playing a split screen game, showing both povs.
Twitch
^
|
+
+---Server---+
| FFMPEG |
| ^ |
| | |
You+-----> NGINX-RTMP <------+Friend
+------------+
you have to set the split screen in obs. nginx can't do this for you on its own.
The only "standalone" way i know is
Code:Twitch ^ | + +---Server---+ | FFMPEG | | ^ | | | | You+-----> NGINX-RTMP <------+Friend +------------+
Hi at first
Note to Windows users:
http://nginx-win.ecsds.eu/download/
- rtmp, 1.7.12.1 is the last free version with rtmp, we do have a rtmp
special offer for the 1.9 branch (which without rtmp you could use
to tcp load balance 1.7.12.1 with rtmp)
Commercial subscription only modules:
...
= Streaming with nginx-rtmp-module
...
nginx.exe
webserver
Use HLS output in NGINX-rtmp config
multicast? i belive its only possible in your local network
i think you should use someting like p2p
a plugin for video.js is aviable
It seems there should be a way to just broadcast a stream that any number of people can connect to without multiplying the bandwidth requirement.
At the moment, I still haven't figured out how to get a player window on my page with the video stream from OBS. I'm also somewhat confused as to why I need a second server software running in parallel with IIS7 to do this.
Missing is the code to put in the web page to display the stream, a player of sorts.
I'm growing annoyed with Twitch because of the lengthy adverts that they display now when someone attempts to watch a stream.
This underscores the need to stream directly from my own server without involving outside corporations. But the building blocks between OBS and my server are missing.
Yes it is possible to save bandwidth but it is not really practical or easy to set up.
The IIS7 doesn't speak RTMP, you just need a receiver in this case nginx which converts it to hls
browsers can not play rtmp without flash plugin
so you need to provide this as hls.
for this you also need javascript
https://github.com/video-dev/hls.js
i would recommend you to use youtube there you can turn off the advertising
I'm trying to avoid Flash now. It's obsolete, unsupported and a security risk and using it will limit my audience to outdated legacy browsers. What are sites like Youtube using? HTML5? I don't have Flash on any of my machines, but can play Youtube videos. One of my websites requires flash (it hasn't been updated in years) and it won't display in my current browser.
Saving bandwidth... I should be able to have 1 or 1000 viewers watch my stream without increasing bandwidth. I'm on cable, so the backhaul is only enough for user responses and sending e-mail. I have had good success with 2.5mb/s streaming. There HAS to be a way to have people tap into the stream without doubling the bandwidth each time the number of viewers increases. The data is already flowing out the port... the trick is to make it so it's not locked to one viewer (one stream, one viewer), but make it so it's one stream any number of viewers, like a radio broadcast.
Back to the player problem, so I DO need a second server to handle the stream video... the next question becomes how to display the stream without requiring viewers to download software first. I want it to play just like Youtube. There must be a way.
worker_processes 1;
error_log logs/error.log info;
events {
worker_connections 1024;
}
rtmp {
server {
listen 1935;
application live {
live on;
push rtmp://127.0.0.1/hls/stream;
}
application hls {
live on;
hls on;
hls_path temp/hls;
hls_fragment 8s;
}
}
}
http {
server {
listen 8080;
location / {
root html;
}
location /stat {
rtmp_stat all;
rtmp_stat_stylesheet stat.xsl;
}
location /stat.xsl {
root html;
}
location /hls {
#server hls fragments
types{
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
alias temp/hls;
expires -1;
}
}
}
<html>
<head>
<title>Hls.js demo - basic usage</title>
</head>
<body>
<script src="hls.js"></script>
<center>
<h1>Hls.js demo - basic usage</h1>
<video height="600" id="video" controls></video>
</center>
<script>
if(Hls.isSupported()) {
var video = document.getElementById('video');
var hls = new Hls();
hls.loadSource('hls/stream.m3u8');
hls.attachMedia(video);
hls.on(Hls.Events.MANIFEST_PARSED,function() {
video.play();
});
}
// hls.js is not supported on platforms that do not have Media Source Extensions (MSE) enabled.
// When the browser has built-in HLS support (check using `canPlayType`), we can provide an HLS manifest (i.e. .m3u8 URL) directly to the video element throught the `src` property.
// This is using the built-in support of the plain video element, without using hls.js.
else if (video.canPlayType('application/vnd.apple.mpegurl')) {
video.src = 'hls/stream.m3u8';
video.addEventListener('canplay',function() {
video.play();
});
}
</script>
</body>
</html>
Thanks for that sample code, especially how to stream html5.
I'm unclear about the following piece of code:
<script src="hls.js"></script>
Where is the Javascript file found (I assume it has to be placed on the server in order to make the player work?)
<center>
<h1>Hls.js demo - basic usage</h1>
<video height="480" id="video" controls></video>
</center>
<script>
if(Hls.isSupported()) {
var video = document.getElementById('video');
var hls = new Hls();
hls.loadSource('rtmp://192.168.0.109:8080/live'); //<-------- here is something wrong
//url should be like http://192.168.0.109:8080/live
//or the path were these hls files stored by nginx
hls.attachMedia(video);
hls.on(Hls.Events.MANIFEST_PARSED,function() {
video.play();
});
}
// hls.js is not supported on platforms that do not have Media Source Extensions (MSE) enabled.
// When the browser has built-in HLS support (check using `canPlayType`), we can provide an HLS manifest (i.e. .m3u8 URL) directly to the video element throught the `src` property.
// This is using the built-in support of the plain video element, without using hls.js.
else if (video.canPlayType('application/vnd.apple.mpegurl')) {
video.src = 'rtmp://192.168.0.109:8080/live';//<-------- here is something wrong
//url should be like http://192.168.0.109:8080/live
//or the path were these hls files stored by nginx
video.addEventListener('canplay',function() {
video.play();
});
}
</script>
dam sorry i missed somethingI'm thrashing away here, little by little.. so far, I've dropped in the code on a test site and the player appears along with player controls.
I've got nginx running on port 8080 to avoid conflict with IIS7, and firewall pinholes for it. I can see the server from elsewhere on the LAN.
I have OBS set to stream to rtsp:192.168.0.109:8080 (but I get server timeouts when I start stream).
I have this code embedded in the test website:
<center>
<h1>Hls.js demo - basic usage</h1>
<video height="480" id="video" controls></video>
</center>
<script>
if(Hls.isSupported()) {
var video = document.getElementById('video');
var hls = new Hls();
hls.loadSource('rtmp://192.168.0.109:8080/live');
hls.attachMedia(video);
hls.on(Hls.Events.MANIFEST_PARSED,function() {
video.play();
});
}
// hls.js is not supported on platforms that do not have Media Source Extensions (MSE) enabled.
// When the browser has built-in HLS support (check using `canPlayType`), we can provide an HLS manifest (i.e. .m3u8 URL) directly to the video element throught the `src` property.
// This is using the built-in support of the plain video element, without using hls.js.
else if (video.canPlayType('application/vnd.apple.mpegurl')) {
video.src = 'rtmp://192.168.0.109:8080/live';
video.addEventListener('canplay',function() {
video.play();
});
}
</script>
<html>
<head>
<title>Hls.js demo - basic usage</title>
</head>
<body>
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
<center>
<h1>Hls.js demo - basic usage</h1>
<video height="600" id="video" autoplay controls preload="metadata"></video>
</center>
<script>
if(Hls.isSupported()) {
var video = document.getElementById('video');
var hls = new Hls();
hls.loadSource('http://192.168.0.109:8080/hls/stream.m3u8'); //<--------- here the server path to the hls playlist file
hls.attachMedia(video);
hls.on(Hls.Events.MANIFEST_PARSED,function() {
video.play();
});
}
else if (video.canPlayType('application/vnd.apple.mpegurl')) {
video.src = 'http://192.168.0.109:8080/hls/stream.m3u8'; //<--------- here the server path to the hls playlist file
video.addEventListener('canplay',function() {
video.play();
});
}
</script>
</body>
</html>
When I try to follow the tutorial, I always get an error in the ngix log (using the linked to Windows builds):
[emerg] 8572#3080: unknown directive "rtmp" in C:\nginx/conf/nginx.conf:182
This has happened across 2 different systems. If I delete the RTMP reference from nginx.conf I get no error. Am I somehow missing the RTMP module?
I appreciate any insight the forum can provide...
Yes, you are missing the RTMP module. Which version did you download from the linked site?
worker_processes 1;
error_log logs/error.log debug;
events {
worker_connections 1024;
}
rtmp {
server {
listen 1935;
application live {
live on;
}
application hls {
live on;
hls on;
hls_path temp/hls;
hls_fragment 8s;
}
}
}
http {
server {
listen 8080;
location / {
root www;
}
location /stat {
rtmp_stat all;
rtmp_stat_stylesheet stat.xsl;
}
location /stat.xsl {
root www;
}
location /hls {
#server hls fragments
types{
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
alias temp/hls;
expires -1;
}
}
}
}
}
Anyone had a problem when nginx randomly stops working? I,'m on raspberry pi 3,tried multiple distributions (currently on raspbian ) checked error logs (nothing). Server is working and I can stream to it over lan or internet just fine but after some time it refuses to connect to it an I need to restart the nginx.Googled the problem but still did not found any solution.