How to download m3u8 format media file in Android

Nizam picture Nizam · Jan 24, 2017 · Viewed 12.9k times · Source

I need to parse an m3u8 media file, which is a playlist, and download the actual media content.
As per my understanding, the following are the process involved:

  • Parse the m3u8 file and get the '.TS' chunks
  • Once all the chunks has been retrieved, merge as a single file
  • Convert the merged TS file to mp4 format.

Unfortunately, I couldn't find any lib/module to perform the above-mentioned steps. Can anyone provide a better approach or working sample to process and download the m3u8 file?

Any help is much appreciated.

Answer

Nizam picture Nizam · Mar 23, 2017

Here is my solution: https://github.com/nichucs/HLS2MP4 With 3 simple java classes, you can do this.

Disadvantage of the previous one is, it has around 20MB size.