Commit Graph
1278 Commits
Author SHA1 Message Date
f41eef0937 Add composable conversions
* Add non-owning conversions via ConversionOptions.ownsOutput

A conversion with ownsOutput: false only adds tracks to the output and
drives their media data; starting, finalizing, and metadata tags remain
the caller's responsibility. This lets multiple conversions and
directly-added user tracks compose on a single Output (see upstream
issue #436).

- ownsOutput: false allows a pre-populated output (state must still be
  'pending') and seeds track-capacity accounting from existing tracks
- execute() requires the output to be started and never finalizes it
- cancel() closes only the conversion's own sources, releasing internal
  synchronizer waiters, and leaves the output usable
- tags cannot be combined with ownsOutput: false
- isValid requires at least one contributed track instead of the
  format's minimum track counts

Prototype for API discussion; default (owning) behavior is unchanged.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AJdfnbY9AFh9i9dKgtrj6E

* Add external-audio example using a non-owning conversion

Demonstrates composing a user-owned audio track (synthesized voiceover
via OfflineAudioContext + AudioBufferSource) onto a picked video with
Conversion.init({ ownsOutput: false }), including progress reporting
and playback/download of the result.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AJdfnbY9AFh9i9dKgtrj6E

* Release synchronizer waiters when canceling during output finalization

A non-owning conversion's cancel() previously no-oped entirely when the
output (owned by someone else) was already finalizing or finalized,
leaving pump loops parked in the track synchronizer and hanging
execute() forever. Now it still marks the conversion canceled and
releases parked waiters in that state, without force-closing sources
(finalization owns flushing them at that point).

Also adds coverage: non-owning onProgress monotonicity, canceling one
of two sibling conversions, capacity seeding across sequential inits,
exact metadata exclusivity, and cancel-before-execute.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AJdfnbY9AFh9i9dKgtrj6E

* Document non-owning conversions on the converting-media-files guide page

Adds the doc section requested in #436: what ownsOutput: false does, the
required choreography (add tracks -> output.start() before execute() ->
run the conversion concurrently with your own sources -> finalize), the
cancellation split (conversion.cancel() leaves the output alive; cancel
both for a full abort and tear the output down on error paths), isValid
semantics in this mode, and the tags restriction with the
setMetadataTags() alternative. Also cross-links the fresh-output rule to
the new section. VitePress build passes with dead-link checking on.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* Clean up conversion logic, add Output.tracks and .hasEnoughTracks(), move new conversion tests around, remove external audio example

* non-owning -> composable, and update docs

* Update

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: Vanilagy <[email protected]>
2026-07-22 08:42:19 +00:00
Vanilagy 794b84884f Make sure that samples are always closed in the Conversion API, even on error cases v1.50.9 2026-07-18 22:54:24 +02:00
Vanilagy 45c34f9dcd Bump patch 2026-07-18 16:15:53 +02:00
Vanilagy 3ec4061e03 Clean up 2026-07-18 15:49:57 +02:00
bf592a87ca Give Matroska subtitle cues a BlockDuration (#442)
Subtitle cues were written as SimpleBlocks, which carry no duration. A
SimpleBlock tells the player when a cue starts but not how long to show it,
so players such as VLC and libass-based renderers display nothing for
S_TEXT/WEBVTT tracks muxed into Matroska/WebM.

Route a subtitle chunk that has a positive duration through a BlockGroup so
its BlockDuration is written, matching how additions are already handled.
Non-subtitle tracks and zero-duration cues keep using SimpleBlocks.

Co-authored-by: hikari <[email protected]>
2026-07-18 15:48:55 +02:00
454476ab26 Fix WebVTT-in-MP4 output by starting the aux writer (#441)
* Fix WebVTT-in-MP4 output by starting the aux writer

The ISOBMFF muxer advertises WebVTT as a supported subtitle codec and maps
it to the wvtt sample entry, but IsobmffMuxer.start() never calls
auxWriter.start(). The aux writer builds subtitle sample boxes in memory, so
the first box write for any subtitle track hits its started === false assert
and muxing fails.

Start the aux writer alongside the main writer so WebVTT subtitle tracks can
be written to MP4/MOV.

* Move code around, add simple WebVTT muxing test

---------

Co-authored-by: hikari <[email protected]>
Co-authored-by: Vanilagy <[email protected]>
2026-07-18 13:45:23 +00:00
Vanilagy d2aea552d9 Add spacing 2026-07-18 15:27:06 +02:00
Igor SamokhovetsandGitHub 94d42667f1 Add extension decoders to media player example (#433)
* Add extension decoders to media player example

* Enable extension decoders in input examples

* Simplify media player file filter

* Align input file filters across examples
2026-07-18 15:26:31 +02:00
Vanilagy 0554696505 Fix nested worker randomly shutting off in Firefox (closes #435) 2026-07-18 14:44:57 +02:00
bfbd90e1d8 Account for multi-frame Opus packets when computing packet duration (#439)
* Account for multi-frame Opus packets when computing packet duration

parseOpusTocByte only read the config field of the TOC byte and always
assumed a single frame per packet. Per RFC 6716 section 3.2, a packet may
carry 1, 2 or an arbitrary number of frames, encoded in the two low bits of
the TOC byte (plus the frame count byte for code 3), and its duration is the
frame duration times the frame count.

As a result, the Ogg muxer wrote granule positions that advanced slower than
the actual audio. Chromium's MediaRecorder packs three 20 ms frames per Opus
packet, so remuxing WebM/Opus to Ogg/Opus produced files declaring a third of
their real duration: a 5.7 s recording ended with a final granule position of
99840 (2.08 s). Decoders that trust the container then truncate the audio.

* Clean up

---------

Co-authored-by: Vanilagy <[email protected]>
2026-07-18 12:05:31 +00:00
Vanilagy 1183b542ee Make WAVE demuxer throw for format tags that it doesn't support (fixes #440), add support for reading & writing float64 PCM in WAVE 2026-07-14 17:30:50 +02:00
Vanilagy db75747533 Bump patch v1.50.8 2026-07-10 00:15:25 +02:00
Vanilagy 3fcb93712d @mediabunny/server: Properly force IDR frames when encoding AVC/HEVC on NVENC 2026-07-08 16:50:58 +02:00
Vanilagy 5b1dbf5558 Fix npm i not being called after sync workspace deps 2026-07-08 16:07:41 +02:00
Vanilagy 9180af799d Oops v1.50.7 2026-07-07 21:27:05 +02:00
Vanilagy b8d5cc5b36 Bump patch, remove Ponder :( 2026-07-07 21:17:06 +02:00
Ali TlekbaiandGitHub d5b07373b3 Fix AudioResampler crackle at exact rate ratios: 32 kHz -> 48 kHz (#432) 2026-07-07 21:13:35 +02:00
Vanilagy b99b86db0b Bump patch v1.50.6 2026-07-03 16:44:39 +02:00
Vanilagy b0e5f655aa Make AUD-based NALU stripping less aggressive (closes #426) 2026-07-03 16:37:06 +02:00
Vanilagy 0c2853d0aa Merge branch 'main' of https://github.com/Vanilagy/metamuxer v1.50.5 2026-07-03 16:24:09 +02:00
Vanilagy cc970e1f53 Fix invalid check for no available read worker stalling reads, bump patch 2026-07-03 16:24:08 +02:00
Vanilagy 5e68d9655c Make ProRes tracks return true for hasOnlyKeyPackets() 2026-07-02 22:58:51 +02:00
Vanilagy 7171cf4338 Add sync workspace deps script 2026-07-02 20:42:46 +02:00
Vanilagy baff6a67a3 Omg v1.50.4 2026-07-02 20:31:13 +02:00
Vanilagy d0401b42a5 Bump TurboRes to fix bug 2026-07-02 20:30:36 +02:00
Vanilagy 72427b8b39 Bump TurboRes, use desiredSize, bump patch 2026-07-02 20:18:25 +02:00
Viktor SzépeandGitHub 6812cf1643 Fix typos in source, tests, and docs (#430)
* Fix typos in source, tests, and docs

* Fix introduction guide typos
2026-07-02 09:33:43 +02:00
Zi How PohandGitHub c9a828c272 Fix duplicated entries in generated API docs (#429) 2026-07-02 07:31:09 +00:00
Vanilagy e851120bfe Add PhotoCircle bronze sponsor 2026-07-01 18:11:01 +02:00
Vanilagy 1a4fec9f6e Bump TurboRes & patch v1.50.3 2026-07-01 17:18:21 +02:00
Vanilagy 8c8ce8a4a5 Merge main into release AFTER the npm publish completes 2026-07-01 16:26:58 +02:00
Vanilagy 7ea8f6d751 Up timeout on test 2026-07-01 16:25:53 +02:00
Vanilagy 8fb22633fe Add frame container atom header stripping & readding for ProRes in Matroska, bump patch v1.50.2 2026-07-01 16:22:38 +02:00
Vanilagy 0480ecbd3a Bump TurboRes version, mention response headers in README, bump patch v1.50.1 2026-07-01 15:27:36 +02:00
Vanilagy 9547d36353 Add workaround for https://issues.chromium.org/issues/529852980 2026-07-01 13:50:48 +02:00
Vanilagy d8d22aa4eb Make release workflow build the docs 2026-07-01 11:40:03 +02:00
Vanilagy 50b281a9f8 Merge branch 'main' into release 2026-07-01 11:37:12 +02:00
Vanilagy 409961c02b Rename 2026-07-01 11:35:22 +02:00
Vanilagy d8a6e09a85 Up timeout 2026-07-01 11:32:45 +02:00
Vanilagy 2c7e8d85ca Create separate Build check CI 2026-07-01 11:28:52 +02:00
Vanilagy a9441aa9a9 Fix API docs generation issue 2026-07-01 11:25:24 +02:00
github-actions[bot] 403093c514 Merge main into release for tag v1.50.0 2026-06-30 20:08:10 +00:00
Vanilagy 6c6687dfaf Bump TurboRes v1.50.0 2026-06-30 21:59:05 +02:00
Vanilagy 7d89c8de2d Add ProRes encode and decode support to @mediabunny/server 2026-06-30 21:40:58 +02:00
Vanilagy b4ef20cd36 Bump minor 2026-06-30 18:26:54 +02:00
Vanilagy a4884184e9 Remove GPU path for alpha merger/splitter, add worker pool for merger, allow concurrent merging for better performance 2026-06-30 18:23:59 +02:00
6f4a40ff4e Fix VP9 alpha merge for padded decoded frames (#422)
* Fix VP9 alpha merge for padded decoded frames

* Clean up alpha merging and splitting logic

---------

Co-authored-by: Vanilagy <[email protected]>
2026-06-30 17:09:16 +02:00
David P.andGitHub 7453336f70 Merge pull request #425 from Vanilagy/prores
Add ProRes support and @mediabunny/prores extension
2026-06-30 16:09:06 +02:00
Vanilagy bfbcea69b4 Fix AAC error in Matroska muxer, remove special VideoFrame path for VideoSample due to Chromium bug 2026-06-30 16:04:30 +02:00
Vanilagy 40e35d6f14 Update lockfile 2026-06-29 19:18:24 +02:00