1

I'm trying to stream my camera to Azure Media Services LiveEvent. I'm using Media Services' REST-API to obtain the ingest URL, however the docs don't mention how to stream RTMP from an Android Phone.

So far I've tried quiet a few Android RTMP publishing libraries available on Git but each one of them fails at establishing a connection. The list of libraries I've tried so far:

I've also tried streaming from an mp4 video file using ffmpeg inspired from this SO Answer:

ffmpeg -re -i video.mp4 -vcodec libx264 -profile:v main -preset:v medium -r 30 -g 60 -keyint_min 60 -sc_threshold 0 -b:v 2500k -maxrate 2500k -bufsize 2500k -filter:v scale="trunc(oha/2)2:720" -sws_flags lanczos+accurate_rnd -acodec aac -b:a 96k -ar 48000 -ac 2 -f flv rtmp://<AZURE_INGEST_URL>

But I'm getting:

rtmp://<AZURE_INGEST_URL>: I/O error

Am I missing something?

Is it even at all possible to stream to an ingest URL without a middle tier as suggested by many Azure people is the way to go?

Edit: I've successfully streamed to YouTube Live Streaming using two RTMP libraries and so I'm now pretty sure the issue is not with the RTMP streaming libraries but with how the Azure Live Streaming works. I'm definitely missing a step here.

Abbas
  • 3,529
  • 5
  • 36
  • 64
  • should be like below `rtmp://p***2-p**imediaservices-usso.channel.media.azure.net:1935 app=live/3b5e8425**********50449d57d379d`. This post maybe useful to you. https://stackoverflow.com/questions/63607182/nginx-rtmp-streaming-is-not-reaching-the-rtmp-endpoint/63610460#63610460 – Jason Pan Oct 23 '20 at 09:19
  • @JasonPan yes that's how my ingest URL looks like (I've only removed for security purposes). But the problem is why is the ingest URL not accepting my stream. – Abbas Oct 23 '20 at 09:22

1 Answers1

4

You may be simply forgetting to add a unique stream key after the ingest URL path.

Take a look at the OBS tutorial https://learn.microsoft.com/en-us/azure/media-services/latest/live-events-obs-quickstart

The ingest RTMP endpoint should end in /live/{GUID}

After that, add another / and a unique stream name so you end up with /live/{GUID}/{uniquename}

rtmp://accountname-uswe.channel.media.azure.net:1935/live/8b53cc4e68c04e00a4855ffc3e678a62/someuniqueStreamID

Then try to connect. Customers are often confused and think that the GUID in the path is the stream key - it is not a streamkey.

johndeu
  • 2,494
  • 1
  • 11
  • 10
  • Thanks for responding, I've tried adding a unique stream id, still no preview and the library keeps disconnecting looking for a header that is not there. – Abbas Oct 26 '20 at 06:05
  • Couple of questions - Are you sending both H264 and AAC codec? are you sticking to 1080p 30fps or below? Anything unique about the stream settings? We reject 60fps content on live transcoding channels? Did you test with both FFMPEG and OBS before testing the library? Did you try another library? – johndeu Oct 26 '20 at 16:26
  • Hi John, thanks for your responses. I have found out what the issue was. I was creating `LiveEvent` using the Rest-API using the sample requests provided in the docs. In the sample requests the ingest URLs did not have a defined `accessControl` policy the default seems to disallow every IP. Once I provided an `accessControl` for ingest url while creating the `LiveEvent`. I was able to stream to the ingest URL with and create Assets, LiveOutput, Streaming endpoint, etc. – Abbas Oct 28 '20 at 19:28
  • This might be a little out of the scope for this question. But I just found out that Azure supports a maximum of 5 simultaneous `LiveEvent`, since I got an error creating a fifth LiveEvent. Is there no way of increasing this limit? Since the use case I had in mind was a bit like Twitter's Periscope. And my app is a social platform, where (hopefully) there can be thousands of users streaming simultaneously to many others. – Abbas Oct 28 '20 at 19:33
  • Which Sample caused you to get stuck on accessControl? I need to fix that! – johndeu Nov 06 '20 at 19:21
  • You can file a quota increase support ticket to get more LiveEvents – johndeu Nov 06 '20 at 19:21
  • 1000s in a single account or region concurrent could be a concern - we may need to talk about load balancing and spreading around. Are you using pass-through channels only? – johndeu Nov 06 '20 at 19:22
  • Till then yes, we were only using pass through. But since then we've moved on from Azure Live Streaming to Agora Live Streaming (And I have moved on from that work-place). Specifically due to lack of scalability. Also there's a huge lag between providing an input through LiveEvent -> seeing it in preview -> (finally) Watch it using streaming locator. – Abbas Nov 06 '20 at 20:21
  • Just out of curiosity, would changing the LiveEvent encoding type help with the 5 simultaneous LiveEvent limitations? Also what would be the cap for LiveEvent quota if/when requested to increase? – Abbas Nov 06 '20 at 20:23
  • Here's the link to the sample you asked for https://learn.microsoft.com/en-us/rest/api/media/liveevents/create. You can see the `input` tag has no `accessControl`. – Abbas Nov 06 '20 at 20:25
  • Thank you, did you use the "TRY IT" button there, or were you just copying the request body below on the "Examples" header in that page? – johndeu Nov 06 '20 at 20:45
  • I think I see what you hit now... I was looking at the "TRY IT" button which also does not populate the body – johndeu Nov 06 '20 at 20:46