You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
WebCodecs only provide the ability to decode, but not to demux. mp4box.js is cool, but it only supports mp4 demux. Web-Demuxer aims to support as many multimedia formats as possible at once.
11
+
## Overview
12
+
13
+
WebCodecs provides decoding capabilities but lacks demuxing functionality. While mp4box.js is excellent for MP4 files, it only supports MP4 format. **Web-Demuxer** aims to support a wide range of multimedia formats in one package, specifically designed for seamless WebCodecs integration.
12
14
13
15
## Features
14
-
- 🪄 Specifically designed for WebCodecs, the API is very friendly for WebCodecs development, you can easily realize the media file demux.
15
-
- 📦 One-time support for a variety of media formats, such as mov/mp4/mkv/webm/flv/m4v/wmv/avi/ts, etc.
16
-
- 🧩 Support for customized packaging, you can adjust the configuration, packaged in a specified format demuxer
17
16
18
-
## Install
19
-
### NPM
17
+
- 🪄 **WebCodecs-First Design** - API optimized for WebCodecs development with intuitive methods
18
+
- 📦 **Multi-Format Support** - Handle mov/mp4/mkv/webm/flv/m4v/wmv/avi/ts and more formats
19
+
- 🧩 **Customizable Build** - Configure and build demuxers for specific formats only
20
+
- 🔧 **Rich Media Info** - Extract detailed metadata similar to ffprobe output
Loads a file and waits for the wasm worker to finish loading. The subsequent methods can only be called after the `load` method has been successfully executed.
88
72
89
-
Parameters:
90
-
-`source`: Required, support the `File` object or file URL to be processed.
73
+
### WASM File Setup
74
+
75
+
**‼️ Important:** Place the WASM file in your static directory (e.g., `public/`) for proper loading.
Get decoder configuration for WebCodecs based on media type ('video' or 'audio'). Returns `VideoDecoderConfig` or `AudioDecoderConfig` that can be used directly with WebCodecs.
96
89
97
-
Parameters:
98
-
- `type`: Required, media type ('video' or 'audio')
90
+
## Live Examples
91
+
-[Seek Video Frame](https://foreversc.github.io/web-demuxer/#example-seek) | [Source Code](https://github.com/bilibili/web-demuxer/blob/main/index.html#L131-L157)
Returns a `ReadableStream` for streaming raw media packet data.
264
+
265
+
**Parameters:**
266
+
-`type`: Media type (`'video'` or `'audio'`)
267
+
-`start`: Start time in seconds (default: 0)
268
+
-`end`: End time in seconds (default: 0, read till end)
269
+
-`seekFlag`: Seek direction (default: backward seek)
270
+
271
+
### Utility Methods
272
+
273
+
#### `setLogLevel(level: AVLogLevel): void`
274
+
275
+
Sets logging verbosity level for debugging purposes.
276
+
277
+
**Parameters:**
278
+
-`level`: Log level (see `AVLogLevel` for available options)
279
+
280
+
#### `destroy(): void`
281
+
282
+
Cleans up resources and terminates worker.
248
283
249
284
## Custom Demuxer
250
-
Currently, two versions of the demuxer are provided by default to support different formats:
251
-
- `dist/wasm-files/web-demuxer.wasm`: Full version (gzipped: 1131 kB), larger in size, supports mov, mp4, m4a, 3gp, 3g2, mj2, avi, flv, matroska, webm, m4v, mpeg, asf, mpegts
252
-
- `dist/wasm-files/web-demuxer-mini.wasm`: Minimalist version (gzipped: 493 kB), smaller in size, only supports mov, mp4, m4a, 3gp, 3g2, matroska, webm, m4v
253
-
> If you want to use a smaller size version, you can use version 1.0 of web-demuxer, the lite version is only 115KB
254
-
> Version 1.0 is written in C, focuses on WebCodecs, and is small in size, while version 2.0 uses C++ Embind, which provides richer media information output, is easier to maintain, and is large in size
255
285
256
-
You can also implement a demuxer for specific formats through custom configuration:
0 commit comments