简体   繁体   English

如何在 Ant Media Server 中录制 HLS Streamsto S3?

[英]How to Record HLS Streamsto S3 in Ant Media Server?

I want to record all HLS streams/previews to S3 bucket.我想将所有 HLS 流/预览记录到 S3 存储桶。 How can I do that?我怎样才能做到这一点?

There are a couple of ways to upload the HLS files to S3.有几种方法可以将 HLS 文件上传到 S3。 First solution is writing files to S3(mounting the S3 Bucket) while broadcasting and second solution is writing the files after broadcasting is finished.第一个解决方案是在广播时将文件写入 S3(挂载 S3 Bucket),第二个解决方案是在广播完成后写入文件。

Before Starting在开始之前

If you would like to have full recording of HLS files, you need to do following settings如果您想完整录制 HLS 文件,您需要进行以下设置

  1. Set HLS playlist type( settings.hlsPlayListType ) to event and settings.deleteHLSFilesOnEnded to false .将 HLS 播放列表类型( settings.hlsPlayListType )设置为 event 并将settings.deleteHLSFilesOnEnded为 false 。 Edit your /usr/local/antmedia/webapps/{YOUR_APP}/WEB-INF/red5-web.properties for the application and set the following settings编辑应用程序的/usr/local/antmedia/webapps/{YOUR_APP}/WEB-INF/red5-web.properties并设置以下设置
    settings.hlsPlayListType=event settings.deleteHLSFilesOnEnded=false
  2. Restart the server重启服务器
    sudo service antmedia restart

First Solution: Writing HLS files to S3 while broadcasting (aka. Mount S3 Bucket)第一个解决方案:在广播时将 HLS 文件写入 S3(又名挂载 S3 存储桶)

  1. Install s3fs安装 s3fs
     sudo apt install s3fs
  2. Create access key and secret key from AWS IAM - that has write access to S3 bucketsAWS IAM创建访问密钥和秘密密钥 - 对 S3 存储桶具有写入权限
  3. Write your access and secret key to configuration file将您的访问权限和密钥写入配置文件
    echo {WRITE_YOUR_ACCESS_KEY_ID}:{WRITE_YOUR_SECRET_ACCESS_KEY} | sudo tee /etc/passwd-s3fs > /dev/null sudo chmod 600 /etc/passwd-s3fs
  4. Create directory to mount S3创建目录以挂载 S3
     sudo mkdir /mnt/myS3Bucket
  5. Mount S3安装 S3
     sudo s3fs -o dbglevel=info -o curldbg -o allow_other -o use_cache=/tmp/s3-cache myS3Bucket /mnt/myS3Bucket
    Please check the disk if mount is successful.如果挂载成功,请检查磁盘。 You should see a line similar to below in the output when you run df运行df时,您应该在输出中看到类似于以下的行
    s3fs 274877906944 0 274877906944 0% /mnt/myS3Bucket
  6. Link your app's streams directory to your mount directory将应用程序的streams目录链接到挂载目录
    sudo ln -s /mnt/myS3Bucket /usr/local/antmedia/webapps/{YOUR_APP}/streams

After that all your streams are directly written to S3 bucket.之后,您的所有流都直接写入 S3 存储桶。

Second Solution: Writing the HLS files to S3 after broadcasting is finished第二种解决方案:广播完成后将 HLS 文件写入 S3

You can do that with Ant Media Server S3 integration.您可以通过 Ant Media Server S3 集成来做到这一点。 Check this out 看一下这个

antmedia.io蚂蚁媒体

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

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