How to download m3u8 media files in Android

I need to parse the m3u8 multimedia file, which is a playlist, and download the actual media content.
In my understanding, the following process:

  • Parse the m3u8 file and get .TS fragments.
  • Once all the pieces have been extracted, merge them as one file
  • Converts the merged TS file to mp4 format.

Unfortunately, I could not find any lib / module to complete the above steps. Can someone provide a better approach or working sample for processing and downloading the m3u8 file?

Any help is greatly appreciated.

+6
source share
2 answers

You have the right steps. But this will include a huge effort to implement on their own. Better go to some available libraries.

I got a great example with a sample project: https://github.com/nichucs/ffmpeg-android-java-master Original repo: http://writingminds.imtqy.com/ffmpeg-android-java/

+1
source

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

The disadvantage of the previous one is that it has a size of about 20 MB.

+1
source

Source: https://habr.com/ru/post/1014355/


All Articles