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

Viewed 140

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.

I can create a playlist and enable ABR on the server but it it taking a lot of CPU resources.

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.

1 Answers

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. With this way, the uploaded VOD files are transcoded as HLS and multi bitrates will be available.

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/add_vod_transcode_bash_script/vod_transcode.sh
  • After downloading, run the command chmod +x vod_transcode.sh to give this script execute access. 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.
  • Make the following changes to red5-web.properties in the /usr/local/antmedia/webapps/app-name/WEB-INF/ folder:

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.

  • 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.

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

antmedia.io

Related