[英]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.让我逐步解释这个解决方案。
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./usr/local/antmedia/webapps/WebRTCAppEE/streams/
,但您可以根据需要更改这些目录。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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.