简体   繁体   English

将预先录制的视频提供给 Azure 媒体服务作为实时 stream

[英]Feed a pre-recorded video to Azure Media services as a live stream

I wish to do something that sound to me so simple but I struggle to find a solution.我想做一些对我来说听起来很简单的事情,但我很难找到解决方案。

I have a pre-recorded video that I need to fire up by API.我有一个预先录制的视频,需要由 API 启动。 I need that video to be stream live trough RTMP.我需要该视频是 stream 通过 RTMP 直播。 Right now I do the following:现在我执行以下操作:

(All automated via code) (所有通过代码自动化)

  • Create an azure live event创建 azure 直播活动
  • Get the input url for the live event获取现场活动的输入 url
  • Start a docker image with FFMPG使用 FFMPG 启动 docker 映像
  • Provide the parameters (origin pre-recorded video and target input for the live encoder)提供参数(现场编码器的原始预录视频和目标输入)
  • Get the output URL from the end-point从端点获取 output URL
  • Put it in a database将其放入数据库
  • Have an API that my web player query to know the status of the job有一个 API 我的 web 播放器查询以了解作业的状态
  • Start the stream when my row in the database now have a output URL from the live encoder当我在数据库中的行现在有来自实时编码器的 output URL 时,启动 stream

It seam awfully complexes.它缝合非常复杂。 And I am quite worry about many issues in such a flow:我很担心这样一个流程中的许多问题:

  • Performance issue with ffmpg ffmpg 的性能问题
  • Delay in booting all resources延迟启动所有资源
  • One component crashing in that flow一个组件在该流程中崩溃

In the end I just want to start a live stream and tell it to use a MP4 instead of waiting for a RTMP feed....最后,我只想开始直播 stream 并告诉它使用 MP4 而不是等待 RTMP 提要....

Options >选项 >

  • Restream.io let me schedule any video and start streaming it to my endpoint. Restream.io 让我可以安排任何视频并开始将其流式传输到我的端点。 I have to mess with their API to make that work and I would rather keep everything in azure.我必须弄乱他们的 API 才能完成这项工作,我宁愿将所有东西都保留在 azure 中。

I'm pretty sure I am missing a ridiculously simple thing here.我很确定我在这里错过了一件非常简单的事情。 Any help will be so appreciated!任何帮助将不胜感激!

First to answer people questions, I had this flow run over 300 test stream, each varying form 48 hours long to short 30 min streams.首先要回答人们的问题,我让这个流程运行了 300 多个测试 stream,每个流程从 48 小时到 30 分钟的不同形式。

The failed rate was extremely high.失败率极高。

  • Media Service failing to boot in time媒体服务未能及时启动
  • FFMPEG dropping frame rate FFMPEG 丢帧率
  • Very expensive setup as you can imagine您可以想象的非常昂贵的设置
  • Disconnect between Media Service and FFMPEG.断开媒体服务和 FFMPEG 之间的连接。
  • Live Encoder failing to catch the stream back from FFMPEG实时编码器未能从 FFMPEG 捕获 stream

On the other hand, my normal stream performance (from a RTMP source) were incredibly stable.另一方面,我正常的 stream 性能(来自 RTMP 源)非常稳定。

  • 10 days 24h/7 streaming on 10 endpoint encoder (Warning, you have to contact Microsoft to increase your limit of 5) 10 天 24h/7 在 10 个端点编码器上流式传输(警告,您必须联系 Microsoft 以增加您的 5 个限制)
  • More than 20 Terabytes across 350 cities around the world with stellar performance and very very low latency.超过 20 TB 的数据覆盖全球 350 个城市,具有出色的性能和非常低的延迟。

So for the pre-recorded video that are delivered as a 'realtime stream' experience for all my viewers, I went in a much simple way.因此,对于为所有观众提供“实时流”体验的预先录制的视频,我采用了一种非常简单的方式。

Option 1 when I DO needed Variable Bit Rate:当我确实需要可变比特率时的选项 1:

  • Automated the script in OBS on a AWS G4 instance.在 AWS G4 实例上自动执行 OBS 中的脚本。
  • Fully control via api (Boot up, shutdown and stream)通过 api 完全控制(启动、关闭和流式传输)
  • Very detailed error state that I push to Azure Events Hub我推送到 Azure 事件中心的非常详细的错误 state
  • 0 failed rate on a huge volume of stream大量 stream 的失败率为 0
  • Cons: Not in my azure billing account缺点:不在我的 azure 计费帐户中

Option 2 when I do NOT need Variable Bit Rate:当我不需要可变比特率时的选项 2:

  • Setup a MP4 in Azure Media Service在 Azure 媒体服务中设置 MP4
  • Json timestamp as metadata form my MP4 Json 时间戳作为我的 MP4 的元数据
  • Synch via Javascript my Azure Video player to follow the current timestamp in the MP4 and have all my stream event trigger the player and my app at the right moment for everyone watching.通过 Javascript 我的 Azure 视频播放器同步,以遵循 MP4 中的当前时间戳,并让我所有的 stream 事件在适当的时候触发播放器和我的应用程序,供所有人观看。

Now I am attacking live translation for 5 languages on all VOD and RTMP... wish me luck.现在我正在攻击所有 VOD 和 RTMP 上 5 种语言的实时翻译......祝我好运。

Cheers!干杯!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM