1.2.11 • Published 7 months ago

hls2mp4 v1.2.11

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

A tool for download hls/m3u8 to mp4

  • This package depends on @ffmpeg/ffmpeg, you need install it first
# install ffmpeg
npm install @ffmpeg/ffmpeg

online demo

online demo

install

# npm
npm install hls2mp4

# yarn
yarn add hls2mp4

usage

import Hls2Mp4 from "hls2mp4";

const hls2mp4 = new Hls2Mp4({
  /**
   * @type {number}
   * max retry times while request data failed
   */
  maxRetry = 3,
  /**
   * @type {number}
   * the concurrency for download ts
   */
  tsDownloadConcurrency = 10,
  /**
   * the base url of ffmpeg
   */
  ffmpegBaseUrl = 'https://unpkg.com/@ffmpeg/core@0.12.2/dist/umd',
  /**
   * progress callback
  */
  onProgress?: (type, progress) => {
    // type = 0  => load FFmpeg
    // type = 1  => parse m3u8
    // type = 2  => downloading ts
    // type = 3  => merge ts
  };
  /**
   * error callback
  */
  onError?: (error) => {};
});

const buffer = await hls2mp4.download('your m3u8 url')
if (buffer) {
  hls2mp4.saveToFile(buffer, 'test.mp4')
}
else {
  // download failed
}

as script

<script src="static/js/ffmpeg.min.js"></script>
<script src="dist/hls2mp4.js"></script>
<script>
  const hls2mp4 = new Hls2Mp4({...})
</script>
1.2.11

7 months ago

1.2.9

9 months ago

1.2.10

9 months ago

1.2.8

1 year ago

1.2.7

1 year ago

1.2.6

1 year ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago