-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ying_123
committed
Jun 11, 2023
1 parent
de2db0e
commit a808947
Showing
8 changed files
with
275 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,10 +4,6 @@ | |
# node modules | ||
node_modules/ | ||
|
||
# dist | ||
dist/package.json | ||
dist/README.md | ||
|
||
# roolup cache | ||
.rollup.cache/ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
### A tool for download hls/m3u8 to mp4 | ||
|
||
#### This package depends on @ffmpeg/ffmpeg, you need install it first | ||
|
||
```shell | ||
# install ffmpeg | ||
npm install @ffmpeg/ffmpeg @ffmpeg/core | ||
|
||
``` | ||
|
||
##### for more information, see [https://github.com/ffmpegwasm/ffmpeg.wasm](https://github.com/ffmpegwasm/ffmpeg.wasm) | ||
|
||
### online demo | ||
|
||
[online demo](https://code-app.netlify.app/hls2mp4/) | ||
|
||
### install | ||
|
||
```shell | ||
# npm | ||
npm install hls2mp4 | ||
|
||
# yarn | ||
yarn add hls2mp4 | ||
``` | ||
|
||
### usage | ||
|
||
```js | ||
import Hls2Mp4 from "hls2mp4"; | ||
|
||
const hls2mp4 = new Hls2Mp4({ | ||
log: true | ||
}, (type, progress) => { | ||
// type = 0 => load FFmpeg | ||
// type = 1 => parse m3u8 | ||
// type = 2 => downloading ts | ||
// type = 3 => merge ts | ||
}); | ||
|
||
const buffer = await hls2mp4.download('your m3u8 url') | ||
hls2mp4.saveToFile(buffer, 'test.mp4') | ||
``` | ||
|
||
#### as script | ||
```html | ||
<script src="static/js/ffmpeg.min.js"></script> | ||
<script src="dist/hls2mp4.js"></script> | ||
<script> | ||
const hls2mp4 = new Hls2Mp4({...}) | ||
</script> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.