npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@deepinnet/live-player-ffmpeg

v1.1.0

Published

live-player-ffmpeg

Readme

@deepinnet/live-player-ffmpeg

@deepinnet/live-player-ffmpeg@deepinnet/live-player 的浏览器软件解码实现。它只接收播放器已解封装的 H.264、H.265、AAC、PCMA、PCMU、MP2、AC-3、G.726 和 DTS 编码包;不处理网络、FLV/TS/fMP4 容器、缓冲、同步或渲染。

非 AAC 音频在浏览器中直接解码为 PCM,并不会重新编码为 AAC。G.726 样本必须携带 bitRate(16/24/32/40 kbps)和 packingrfc3551aal2)配置。

所有 FFmpeg 调用都运行在 Web Worker 中。默认加载单线程 SIMD WASM,不要求 COOP/COEP;threading: 'auto' 会在 crossOriginIsolatedSharedArrayBuffer 可用时加载 pthread 产物。跨源 HLS 同时启用 COOP/COEP 时,服务端还必须满足对应的 CORP/CORS 要求。

运行时资源固定发布在 ffmpegWasm/ 目录。应用构建时须使用下文的 Webpack 或 Vite 集成将该目录带入产物;完成集成后,创建解码器无需再传入资源 URL。

安装与使用

npm install @deepinnet/live-player @deepinnet/live-player-ffmpeg
import Player from '@deepinnet/live-player';
import { createFFmpegDecoder } from '@deepinnet/live-player-ffmpeg';

const player = new Player({
  fallback: { decoderFactory: createFFmpegDecoder() },
  source: { url: 'https://example.test/live.flv' },
  target: document.querySelector('#player')!,
});

Webpack

从构建子入口取得包内资源路径,将其复制到输出目录的 ffmpegWasm/,并通过 DefinePlugin 注入应用实际的公开 URL。FFMPEG_WASM_BASE_URL 必须与 to 的部署 URL 对应;以下示例适用于根路径部署。

import webpack from 'webpack';
import CopyWebpackPlugin from 'copy-webpack-plugin';
import { ffmpegWasmDirectory, ffmpegWasmPath } from '@deepinnet/live-player-ffmpeg/build';

export default {
  plugins: [
    new CopyWebpackPlugin({
      patterns: [{ from: ffmpegWasmPath, to: ffmpegWasmDirectory }],
    }),
    new webpack.DefinePlugin({
      FFMPEG_WASM_BASE_URL: JSON.stringify('/ffmpegWasm/'),
    }),
  ],
};

子路径或 CDN 部署时,只需将 FFMPEG_WASM_BASE_URL 改为对应的完整公开 URL,例如 https://cdn.example.test/app/ffmpegWasm/

Vite

注册包导出的插件即可。它在 vite build 时复制资源到输出目录,并在 vite dev 时直接托管资源;同时会按 Vite 的 base 自动注入运行时 URL。

import { defineConfig } from 'vite';
import { ffmpegWasmVitePlugin } from '@deepinnet/live-player-ffmpeg/build';

export default defineConfig({
  base: '/app/',
  plugins: [ffmpegWasmVitePlugin()],
});

自定义资源地址

资源位于外部 CDN 等特殊位置时,使用单一 baseUrl 覆盖默认路径:

createFFmpegDecoder({
  baseUrl: 'https://cdn.example.test/ffmpegWasm/',
  threading: 'auto',
});

构建 FFmpeg 运行时

需要 Docker。npm run build:ffmpeg 使用固定的 FFmpeg 7.1.1 URL 与 SHA-256、Emscripten 3.1.74,生成单线程 ffmpeg-bridge.* 与 pthread ffmpeg-bridge-threaded.* 产物。构建会优先复用本地 deepinnet/live-player-ffmpeg:7.1.1-single 镜像中的 FFmpeg 源码层;缓存缺失时才从官方 URL 下载。两套产物均成功后才替换 prebuilt/

可通过环境变量控制构建:

# 仅使用本地源码镜像;缓存缺失时立即失败,不访问网络。
FFMPEG_OFFLINE=1 npm run build:ffmpeg

# 使用自定义本地源码镜像或固定 Docker 平台。
FFMPEG_SOURCE_IMAGE=registry.example/ffmpeg-source:7.1.1 \
FFMPEG_DOCKER_PLATFORM=linux/amd64 \
npm run build:ffmpeg

构建启用 H.264、HEVC、AAC、PCMA、PCMU、MP2、AC-3、G.726、DTS、libswscalelibswresample。请在发布时同时遵守 FFmpeg 的 LGPL 义务。