Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

mp4-remux

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mp4-remux

Remux Video and Audio as Stream in browser

latest
Source
npmnpm
Version
0.2.1
Version published
Maintainers
1
Created
Source

mp4-remux

MP4 混流工具

功能:纯浏览器环境下,将视频流与音频流重新混合,该过程完全流式处理

Try

https://tools.mscststs.com/tools/mp4-remux

Usage

import

  • use CDN
<script src="https://unpkg.com/mp4-remux/lib/mp4-remux.iife.js" ></script>
<script src="https://cdn.jsdelivr.net/npm/mp4-remux/lib/mp4-remux.iife.js" ></script>
  • use NPM
import remux from "mp4-remux"

Example 1: 通过 Fetch 获取音频和视频流,然后写入本地文件;

const videoStream = (await fetch('__videoUrl__')).body;
const audioStream = (await fetch('__audioUrl__')).body;


const remuxedStream = remux(videoStream, audioStream);

const fileHandler = await window?.showSaveFilePicker({
  suggestedName: "output.mp4",
  types: [
    { accept: {
        "video/mp4": ".mp4"
      }
    }],
});

const writable = await fileHandler.createWritable();

const writableStream = new WritableStream({
  write: (chunk)=>writable.write(chunk),
  close: ()=>writable.close(),
})

remuxedStream.pipeTo(writableStream);

不足

  • 目前仅支持专门对于 Dash 进行分割的文件,即其中一个文件仅包含音频,另一个文件仅包含视频
  • (fixed in: v0.2.0) 目前仅支持两个文件含有不同 Trackid 的情况,暂时没有对所有的 Trackid 重新编码

鸣谢 | Thanks

mp4box.js

Keywords

mp4

FAQs

Package last updated on 14 Oct 2023

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