Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@zackdk/m3u8tomp4
Advanced tools
一个便利的工具,从 m3u8 转换到 mp4 文件,并且可以在浏览器端使用!
基于优秀的 FFMPEG ffmpeg.wasm,简单封装了下。
见 demo 文件夹下。
<script src="https://unpkg.com/@zackdk/m3u8tomp4@1.0.4/dist/m3u8tomp4.browser.mini.js"></script>
npm i @zackdk/m3u8tomp4
//node端
//import m3u8tomp4 from 'm3u8tomp4'; ES Module
const m3u8tomp4 = require('m3u8tomp4');
const fs = require('fs');
//返回一个promise, data 是一个 Unit8Array。
const data = await m3u8tomp4.default(m3u8Url, options);
fs.promises.writeFile('./test.mp4', data);
//浏览器内
const data = await m3u8tomp4(m3u8Url, options);
const url = URL.createObjectURL(new Blob([res.buffer], { type: 'video/mp4' }));
//log信息
m3u8tomp4.setLogger((msg) => console.log);
interface MergeOptions {
/** 下载 TS 片段时,最大的并发请求数量,默认 6 */
maxLimit?: number;
/** 是否打印日志,默认 true */
logOpen?: boolean;
/** 如果下载ts片段,出现下载失败的情况,重新下载所有失败片段的次数,默认 3 */
retryTimes?: number;
}
具体请参照 ffmpeg.wasm 的FAQ.
只能在支持 SharedArrayBuffer 的浏览器种运行.(目前看来只有 PC 端的谷歌浏览器可以用)
由于 WebAssembly 的限制,最大支持 2GB 文件的输入.
如果该库对你有帮助,可以点一下 ⭐️!
FAQs
a convenient tool merge m3u8 to mp4
We found that @zackdk/m3u8tomp4 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.