简体   繁体   English

Ant媒体服务器如何对上传的点播文件进行转码并以HLS播放?

[英]How to transcode the uploaded VoD files and play them as HLS in Ant Media Server?

I'm uploading MP4 files under VOD section of Ant Media Server but couldn't find a way to make multi bitrate stream with it.我在 Ant 媒体服务器的 VOD 部分下上传 MP4 文件,但找不到用它制作多比特率 stream 的方法。

I can create a playlist and enable ABR on the server but it it taking a lot of CPU resources.我可以创建一个播放列表并在服务器上启用 ABR,但它会占用大量 CPU 资源。

So I was wondering if there is a simpler method or any custom script that I can use to transcode the upload VOD files to multi bitrates and play with HLS.所以我想知道是否有更简单的方法或任何自定义脚本可用于将上传的 VOD 文件转码为多比特率并使用 HLS 播放。

Thank you for the question.感谢你的提问。

I think the most efficient way is doing that through script.我认为最有效的方法是通过脚本来做到这一点。

In v2.4.3 VOD finish script feature is added. v2.4.3 增加点播结束脚本功能 With this way, the uploaded VOD files are transcoded as HLS and multi bitrates will be available.通过这种方式,上传的 VOD 文件将转码为 HLS,并且可以使用多种比特率。

Let me explain this solution step by step.让我逐步解释这个解决方案。

  • First, you need to download the VOD to HLS transcode script from below link https://github.com/ant-media/Scripts/blob/master/vod_transcode.sh首先,您需要从以下链接下载 VOD 到 HLS 转码脚本https://github.com/ant-media/Scripts/blob/master/vod_transcode.sh
  • After downloading, run the command chmod +x vod_transcode.sh to give this script execute access.下载后,运行命令chmod +x vod_transcode.sh给这个脚本执行权限。 By default, the script transcodes to 240p, 480p, and 720p, and the default target directory is /usr/local/antmedia/webapps/WebRTCAppEE/streams/ , but you can alter these as needed.默认情况下,脚本转码为 240p、480p 和 720p,默认目标目录为/usr/local/antmedia/webapps/WebRTCAppEE/streams/ ,但您可以根据需要更改这些目录。
  • Make the following changes to red5-web.properties in the /usr/local/antmedia/webapps/app-name/WEB-INF/ folder:/usr/local/antmedia/webapps/app-name/WEB-INF/文件夹中的red5-web.properties进行如下修改:

settings.vodUploadFinishScript=/script-directory-path/vod_transcode.sh settings.vodUploadFinishScript=/script-directory-path/vod_transcode.sh

  • After making these changes please restart the server.进行这些更改后,请重新启动服务器。

  • Now, upload any VOD file into the application where you used the script and it will transcode it to HLS inside your target directory after execution.现在,将任何 VOD 文件上传到您使用脚本的应用程序中,它会在执行后将其转码为目标目录中的 HLS。

  • Under target directory, there will be master.m3u8 and m3u8 files of different resolutions will be created which you can play with below URL format.在target目录下,会生成master.m3u8和不同分辨率的m3u8文件,你可以播放以下URL格式。

    https://domain:5443/app-name/target-directory/streamId.m3u8 https://domain:5443/app-name/target-directory/streamId.m3u8

antmedia.io antmedia.io

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

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