SOLVED

Unable to use NGINX RTMP Streaming Server with Stream

%3CLINGO-SUB%20id%3D%22lingo-sub-1276682%22%20slang%3D%22en-US%22%3EUnable%20to%20use%20NGINX%20RTMP%20Streaming%20Server%20with%20Stream%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1276682%22%20slang%3D%22en-US%22%3E%3CP%3EI'm%20trying%20to%20set%20up%20a%20NGINX%20RTMP%20on%20a%20VM%20to%20distribute%20a%20stream%20to%20multiple%20endpoints%20at%20the%20same%20time.%20I've%20successfully%20set%20up%20a%20stream%20from%20OBS%20to%20NGINX%20and%20then%20send%20it%20to%20Facebook%20and%20Youtube%20at%20the%20same%20time.%20However%2C%20when%20I%20set%20it%20up%20to%20add%20Stream%2C%20it%20never%20fully%20connects%20in%20Stream.%20I%20copy%20the%20Server%20Ingest%20URL%20from%20Stream%20and%20paste%20it%20into%20my%20nginx.conf%20file%20and%20unfortunately%20never%20connects.%20There%20aren't%20any%20errors%20in%20NGINX%2C%20but%20stream%20does%20tell%20me%20that%20I%20may%20be%20sending%20an%20incorrect%20signal.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%20%20push%20rtmp%3A%2F%2Flocalhost%2Fcustom%3B%0A%20%20%7D%0A%20%20%23%20Custom%20RTMP%20Application%0A%20%20application%20custom%20%7B%0A%20%20%20live%20on%3B%0A%20%20%20record%20off%3B%0A%0A%20%20%20%23%20Only%20allow%20localhost%20to%20publish%0A%20%20%20allow%20publish%20127.0.0.1%3B%0A%20%20%20deny%20publish%20all%3B%0A%0A%20%20%20%23%20Push%20URL%20with%20the%20Custom%20stream%20Ingest%20URL%0A%20%20%20push%20rtmp%3A%2F%2Funiquecode-uniquecode2-usea.channel.media.azure.net%3A1935%2Flive%2Funiquecode3%3B%0A%20%20%7D%0A%0A%20%7D%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHere's%20a%20site%20that%20talks%20through%20how%20to%20setup%20a%20NGINX%20RTMP%20Server.%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fwww.scaleway.com%2Fen%2Fdocs%2Fsetup-rtmp-streaming-server%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.scaleway.com%2Fen%2Fdocs%2Fsetup-rtmp-streaming-server%2F%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1277436%22%20slang%3D%22en-US%22%3ERe%3A%20Unable%20to%20use%20NGINX%20RTMP%20Streaming%20Server%20with%20Stream%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1277436%22%20slang%3D%22en-US%22%3EDid%20you%20add%20the%20password%20part%3F%20You%20take%20the%20ending%20key%20in%20the%20URL%20provided%20from%20Stream%20and%20use%20it%20as%20the%20password%20in%20addition%20to%20having%20the%20full%20URL%20.%20%3CBR%20%2F%3E%3CBR%20%2F%3Elocation%20%2Fauth%20%7B%3CBR%20%2F%3E%20if%20(%24arg_pwd%20%3D%20'stream%20url%20key%20here')%20%7B%3CBR%20%2F%3E%20return%20200%3B%3CBR%20%2F%3E%20%7D%3CBR%20%2F%3E%20return%20401%3B%3CBR%20%2F%3E%7D%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1278600%22%20slang%3D%22en-US%22%3ERe%3A%20Unable%20to%20use%20NGINX%20RTMP%20Streaming%20Server%20with%20Stream%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1278600%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F869%22%20target%3D%22_blank%22%3E%40Chris%20Webb%3C%2FA%3EThanks%20for%20the%20reply!%20I%20do%20have%20that%20block%20of%20code%20under%20the%20server_name%20section.%20I%20tried%20changing%20it%20to%20what%20you%20suggested%20and%20also%20updated%20my%20OBS%20stream%20to%20add%20that%20key%20to%20the%20stream%20key.%20However%2C%20I%20believe%20that%20is%20only%20for%20local%20authentication%20between%20my%20OBS%20client%20and%20my%20NGINX%20Server.%20It%20unfortunately%20did%20not%20make%20a%20difference%20on%20the%20Microsoft%20Stream%20side.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20currently%20don't%20have%20an%20issue%20streaming%20from%20OBS%20to%20NGINX%2C%20and%20then%20NGINX%20distributing%20the%20stream%20out%20to%20local%20clients%20over%20rtmp%2C%20Facebook%20Live%2C%20and%20Youtube%20Live%20all%20at%20the%20same%20time.%20I'm%20struggling%20with%20distributing%20the%20stream%20to%20Microsoft%20Stream%20though.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAppreciate%20your%20help!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1282783%22%20slang%3D%22en-US%22%3ERe%3A%20Unable%20to%20use%20NGINX%20RTMP%20Streaming%20Server%20with%20Stream%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1282783%22%20slang%3D%22en-US%22%3E%3CP%3EI%20was%20able%20to%20figure%20it%20out%20and%20get%20it%20to%20work.%20You%20get%20the%20following%20Server%20Ingest%20URL%20from%20Stream%20when%20you%20Start%20Setup%20of%20your%20video.%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3Ertmp%3A%2F%2Funiquecode-uniquecode2-usea.channel.media.azure.net%3A1935%2Flive%2Funiquecode3%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EYou%20then%20need%20to%20split%20up%20the%20URL%20and%20have%20the%20first%20part%20of%20the%20URL%20with%20the%20port%20as%20the%20push%2C%20and%20then%20add%20app%20to%20the%20end%20with%20app%3Dlive%2Funiquecode3%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%20%20push%20rtmp%3A%2F%2Flocalhost%2Fcustom%3B%0A%20%20%7D%0A%20%20%23%20Custom%20RTMP%20Application%0A%20%20application%20custom%20%7B%0A%20%20%20live%20on%3B%0A%20%20%20record%20off%3B%0A%0A%20%20%20%23%20Only%20allow%20localhost%20to%20publish%0A%20%20%20allow%20publish%20127.0.0.1%3B%0A%20%20%20deny%20publish%20all%3B%0A%0A%20%20%20%23%20Push%20URL%20with%20the%20Custom%20stream%20Ingest%20URL%0A%20%20%20push%20rtmp%3A%2F%2Funiquecode-uniquecode2-usea.channel.media.azure.net%3A1935%20app%3Dlive%2Funiquecode3%3B%0A%20%20%7D%0A%20%7D%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1293850%22%20slang%3D%22en-US%22%3ERe%3A%20Unable%20to%20use%20NGINX%20RTMP%20Streaming%20Server%20with%20Stream%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1293850%22%20slang%3D%22en-US%22%3E%3CP%3EI%20added%20support%20for%20Microsoft%20Stream%20to%20this%20NGINX%20Docker%20Container%20if%20you%20want%20to%20stream%20to%20the%20container%2C%20and%20then%20stream%20to%20Microsoft%20Stream%2C%20Facebook%2C%20Youtube%2C%20Instagram%2C%20Periscope%2C%20all%20at%20the%20same%20time.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fmichaelkamprath%2Fmulti-service-rtmp-broadcaster%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2Fmichaelkamprath%2Fmulti-service-rtmp-broadcaster%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Contributor

I'm trying to set up a NGINX RTMP on a VM to distribute a stream to multiple endpoints at the same time. I've successfully set up a stream from OBS to NGINX and then send it to Facebook and Youtube at the same time. However, when I set it up to add Stream, it never fully connects in Stream. I copy the Server Ingest URL from Stream and paste it into my nginx.conf file and unfortunately never connects. There aren't any errors in NGINX, but stream does tell me that I may be sending an incorrect signal.

 

  push rtmp://localhost/custom;
		}
		# Custom RTMP Application
		application custom {
			live on;
			record off;

			# Only allow localhost to publish
			allow publish 127.0.0.1;
			deny publish all;

			# Push URL with the Custom stream Ingest URL
			push rtmp://uniquecode-uniquecode2-usea.channel.media.azure.net:1935/live/uniquecode3;
		}

	}

 

Here's a site that talks through how to setup a NGINX RTMP Server.

https://www.scaleway.com/en/docs/setup-rtmp-streaming-server/

 

4 Replies
Highlighted
Did you add the password part? You take the ending key in the URL provided from Stream and use it as the password in addition to having the full URL .

location /auth {
if ($arg_pwd = 'stream url key here') {
return 200;
}
return 401;
}
Highlighted

@Chris WebbThanks for the reply! I do have that block of code under the server_name section. I tried changing it to what you suggested and also updated my OBS stream to add that key to the stream key. However, I believe that is only for local authentication between my OBS client and my NGINX Server. It unfortunately did not make a difference on the Microsoft Stream side.

 

I currently don't have an issue streaming from OBS to NGINX, and then NGINX distributing the stream out to local clients over rtmp, Facebook Live, and Youtube Live all at the same time. I'm struggling with distributing the stream to Microsoft Stream though.

 

Appreciate your help!

Highlighted
Best Response confirmed by hovee (Occasional Contributor)
Solution

I was able to figure it out and get it to work. You get the following Server Ingest URL from Stream when you Start Setup of your video.

rtmp://uniquecode-uniquecode2-usea.channel.media.azure.net:1935/live/uniquecode3

You then need to split up the URL and have the first part of the URL with the port as the push, and then add app to the end with app=live/uniquecode3;

 

  push rtmp://localhost/custom;
		}
		# Custom RTMP Application
		application custom {
			live on;
			record off;

			# Only allow localhost to publish
			allow publish 127.0.0.1;
			deny publish all;

			# Push URL with the Custom stream Ingest URL
			push rtmp://uniquecode-uniquecode2-usea.channel.media.azure.net:1935 app=live/uniquecode3;
		}
	}

 

 

 

Highlighted

I added support for Microsoft Stream to this NGINX Docker Container if you want to stream to the container, and then stream to Microsoft Stream, Facebook, Youtube, Instagram, Periscope, all at the same time.

 

https://github.com/michaelkamprath/multi-service-rtmp-broadcaster