Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@zackdk/m3u8tomp4

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zackdk/m3u8tomp4

a convenient tool merge m3u8 to mp4

  • 1.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Welcome to m3u8tomp4 👋

Version Documentation Maintenance

一个便利的工具,从 m3u8 转换到 mp4 文件,并且可以在浏览器端使用!

感谢

基于优秀的 FFMPEG ffmpeg.wasm,简单封装了下。

demo 演示

见 demo 文件夹下。

在线体验

安装

In Browser

<script src="https://unpkg.com/@zackdk/m3u8tomp4@1.0.4/dist/m3u8tomp4.browser.mini.js"></script>

npm

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);

options

interface MergeOptions {
  /** 下载 TS 片段时,最大的并发请求数量,默认 6 */
  maxLimit?: number;
  /** 是否打印日志,默认 true */
  logOpen?: boolean;
  /** 如果下载ts片段,出现下载失败的情况,重新下载所有失败片段的次数,默认 3 */
  retryTimes?: number;
}

限制

具体请参照 ffmpeg.wasm 的FAQ.

  1. 只能在支持 SharedArrayBuffer 的浏览器种运行.(目前看来只有 PC 端的谷歌浏览器可以用)

  2. 由于 WebAssembly 的限制,最大支持 2GB 文件的输入.

支持一下

如果该库对你有帮助,可以点一下 ⭐️!

Keywords

FAQs

Package last updated on 12 Sep 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc