This module helps you convert an M3U8 file to an MP4 file easily using ffmpeg/node.js
This module can be installed via npm. You will also need to install ffmpeg for this module to work:
$ sudo apt install ffmpeg
$ npm install --save m3u8-to-mp4
var m3u8ToMp4 = require("m3u8-to-mp4");
var converter = new m3u8ToMp4();
- filename: M3U8 file path. You can use remote URL
- filename: Output file path. Has to be local :)
var m3u8ToMp4 = require("m3u8-to-mp4");
var converter = new m3u8ToMp4();
(async function() {
await converter
.setInputFile("https://<URL_OF_THE_WEBSITE>/<PATH_TO_THE_M3U8_FILE>")
.setOutputFile("dummy.mp4")
.start();
console.log("File converted");
})();
or if you want to use it with .then() instead of async/await:
var m3u8ToMp4 = require("m3u8-to-mp4");
var converter = new m3u8ToMp4();
converter
.setInputFile("https://<URL_OF_THE_WEBSITE>/<PATH_TO_THE_M3U8_FILE>")
.setOutputFile("dummy.mp4")
.start()
.then(() => {
console.log("File converted");
});