Commit Graph
685 Commits
Author SHA1 Message Date
Vanilagy 5b890efc29 Dumb oversight 2026-06-18 10:06:16 +02:00
Vanilagy bfd4059c22 Add advanced access unit delimination logic to MPEG-TS demuxer (fixes #414), ignore irrelevant PIDs in MPEG-TS metadata reading 2026-06-17 17:16:39 +02:00
Vanilagy 53833f6e94 Add missing validation for HlsInputFormatOptions 2026-06-16 20:36:54 +02:00
Vanilagy 5b4a5db1a5 Add HlsInputFormatOptions.offsetTimestampsByDateTime option, add InputTrack.getUnixTimeForTimestamp() 2026-06-16 16:32:53 +02:00
Vanilagy 2f0c040fcd Properly handle subrequests for redirected URLs 2026-06-16 14:53:27 +02:00
4affad934e Add per-sink decoder preferences (hardwareAcceleration, optimizeForLatency) (#406)
* Add per-sink decoder preferences to VideoSampleSink and CanvasSink

Adds an optional VideoSinkDecoderOptions ({ hardwareAcceleration,
optimizeForLatency }) parameter to VideoSampleSink, exposed on CanvasSink
via options.decoderOptions, applied to the decoder config before the
VideoDecoderWrapper is constructed.

Motivation: applications that run many sinks concurrently (multi-track
video editors) need to manage hardware decode sessions deliberately -
the number of concurrent hardware sessions is OS-limited, undocumented,
and exceeding it fails silently on some platforms (macOS VideoToolbox
accepts configure() and decode() and simply never outputs). Such an
application places overflow sinks on 'prefer-software' explicitly.
optimizeForLatency is exposed alongside it since it is the other
WebCodecs decoder-config preference an application may want per sink.

The override composes with the existing interlaced-AVC Chromium
workaround, which runs later and can only strengthen the preference
toward software.

Validation mirrors decode.ts's validateVideoDecodingConfig.

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

* Modify docs

---------

Co-authored-by: Claude Opus 4.8 <[email protected]>
Co-authored-by: Vanilagy <[email protected]>
2026-06-16 11:42:24 +00:00
Vanilagy 324fae5153 Adjusted error management in ReadOrchestrator (closes #405) 2026-06-16 11:42:02 +02:00
08e3a85370 Fix orphaned queued reads when a freed worker slot is stolen concurrently (#404)
* Fix orphaned queued reads when a freed worker slot is stolen concurrently

ReadOrchestrator.runWorker's finally callback dequeues the oldest queued
read and asserts that createWorker succeeds ("we just freed up a worker").
That assumption races: the callback runs on a later microtask than the
worker's stop, and concurrent read() calls in that gap can LRU-evict the
freed worker and saturate every slot. The assert then throws as an
unhandled rejection after the read was removed from the queue but before
it was attached to any worker - its pending slices' promises never settle
and the awaiting reads hang forever.

Observed in production-like load (a 4-source composition player): 25
back-to-back occurrences saturating both workers, leaving clips
permanently undecodable.

Fix: create the worker first; only dequeue the read once a slot was
actually obtained. If every slot is busy, leave the read queued - each
running worker drains the queue from this same block when it stops, so
the read is picked up by whichever worker stops next.

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

* Update logic

---------

Co-authored-by: Claude Opus 4.8 <[email protected]>
Co-authored-by: Vanilagy <[email protected]>
2026-06-16 09:26:40 +00:00
Vanilagy 8b9a1acf16 Fix Conversion API process callbacks being called *before* other transformations (fixes #403), restructure Conversion API to make full use of in-source transformations, add AudioSample.trim() 2026-06-15 18:30:16 +02:00
Jonny BurgerandGitHub 0da1107858 [AI-generated] Fix unhandled rejection when disposing invalid input (#413)
* Fix input dispose rejection handling

* Move input disposal regression test
2026-06-15 16:25:02 +02:00
Vanilagy 00599e556e Properly handle zero-sample track fragments again (fixes #411) 2026-06-15 16:23:53 +02:00
Vanilagy 1ddeae2e80 Merge branch 'main' into prores 2026-06-12 15:41:58 +02:00
Vanilagy c423d62fd9 Change keyFrame parameter priority 2026-06-02 18:18:53 +02:00
Vanilagy 0cdf0063e2 Add VideoSample.encodeOptions, optimized ArrayBuffer-backed VideoSample cloning 2026-06-02 18:01:22 +02:00
Vanilagy bb2f5d505d Clarify and better error messages 2026-06-02 16:39:04 +02:00
Vanilagy d92df801bf Change requestEntireFile() slice offset logic (#390) 2026-06-02 13:28:37 +02:00
Vanilagy 6832153fef Merge branch 'main' of https://github.com/Vanilagy/metamuxer 2026-06-02 13:06:42 +02:00
Vanilagy 82690ef327 Clean up AVC packet NALUs with AUD in them for Chromium key frame detection (fixes #396) 2026-06-02 13:06:41 +02:00
c0d93f45a5 Support QuickTime nclc color information (#397)
* Support QuickTime nclc color information

* Tighten QuickTime nclc color test fixture

* Make QuickTime muxer write nclc color box

---------

Co-authored-by: Vanilagy <[email protected]>
2026-06-02 09:48:06 +00:00
Vanilagy 05f8ecd908 Respect Range header for UrlSource (#387) 2026-06-02 11:05:46 +02:00
96d0d9fb22 Fix tkhd issue for Apple ecosystem compatibility (#391)
* fix: ensure at least one track per type is enabled for Apple ecosystem compatibility

* Add ensureOneEnabledTrack() to ISOBMFF muxer

* Add test case

---------

Co-authored-by: Vanilagy <[email protected]>
2026-06-01 22:55:02 +02:00
Vanilagy c6c768d93e Omit 'signal', clarify docs for reading ranged resources (#387) 2026-06-01 22:00:39 +02:00
Vanilagy 441eea38b9 CustomSource -> StreamSource 2026-05-24 15:48:01 +02:00
Vanilagy ef27d73405 Fix FinalizationRegistry being able to prevent Inputs from being GCd in some cases (fixes #367) 2026-05-24 14:45:13 +02:00
Vanilagy 41a331b0dc Cảm ơn 2026-05-22 11:46:33 +02:00
Vanilagy 85a80972a0 Make MP3 next frame location more strict for better recovery (fixes #382), fix Date timezone for ID3 tags 2026-05-22 11:31:26 +02:00
Vanilagy 0c455236da Add first encoded packet key frame check (fixes #365) 2026-05-19 16:15:17 +02:00
Sturlen aa38385cae fix(id3v2reader): use correct header size in readU24 2026-05-14 13:54:51 +02:00
Vanilagy d731037f6f Simplify PCM regex (closes #380) 2026-05-14 11:44:13 +02:00
Vanilagy 045f82584c Yes it can! 2026-05-13 18:59:58 +02:00
Vanilagy a0574fa09a Fix decoded audio always starting at 0, fix startTimestamp=0 for ranged media iterators (fixes #370) 2026-05-13 18:54:45 +02:00
Vanilagy 4c7b6d939b Yes 2026-05-13 17:31:52 +02:00
David P.andGitHub 09a8ff0166 Merge pull request #369 from Theredbt/fix/recognize-sidx-mp4-segment
fix(input-format): recognise CMAF segments that start with sidx
2026-05-13 17:29:28 +02:00
Vanilagy 4047038113 Add doc block clarification (fixes #368) 2026-05-13 17:27:36 +02:00
Vanilagy 292189e3d4 Add toAvFrame, NodeAv* -> Av*, add server README, fix track synchronizer in conversion, increase default cache size for ReadableStreamSource 2026-05-13 15:26:13 +02:00
Vanilagy 5599e52a1a Fix async race condition in transparency code, reduce HEVC conversion duration 2026-05-12 00:24:03 +02:00
Vanilagy 81531cc510 Fix some bugs & polish edge cases 2026-05-11 23:50:06 +02:00
Vanilagy d8c8606341 Merge branch 'main' into server 2026-05-11 21:36:38 +02:00
Vanilagy 1bf200894c Add CPU path for transparent encoding and decoding, add transparency support to FFmpeg-backed VP9 decoder and encoder 2026-05-11 21:33:29 +02:00
Vanilagy a89d715524 Add VideoSample.transform(), add custom transformer functions, ditch CanvasSink path in Conversion API, add libavfilter-based VideoSample transformation 2026-05-11 15:57:51 +02:00
Theredbt b48eb75565 fix(input-format): recognise CMAF segments that start with sidx
Sibling case to #308: when a fragmented MP4 segment begins with a sidx
box (no ftyp/styp/moof at the file root), Mp4InputFormat._canReadInput
returned false, causing Input.getTracks() to throw
UnsupportedInputFormatError.

This shape is standard in CMAF when the DASH on-demand profile is used
or when HLS playlists are derived from one (Vimeo's vod-adaptive-ak CDN,
for example). The segment is still a valid ISOBMFF fragment — the sidx
just sits before the moof.

Adds 'sidx' alongside the existing 'moof' check so the format probe
accepts these segments, and a focused regression test that fails on
the previous behaviour.
2026-05-11 04:22:46 +01:00
Vanilagy 3ae73a7c5e Loosen constraint on format returned by toRgbSample, fix X->A conversio, fix tests 2026-05-10 17:31:56 +02:00
Vanilagy 1e200edc83 Implement audio decoder & encoder 2026-05-10 16:37:25 +02:00
Vanilagy 3cde68e0ae Fix AudioResampler emitting timestamps before startTimestamp (fixes #366) 2026-05-09 00:40:25 +02:00
Vanilagy ab9958234a Change VideoSampleResource interface, validate return values, add more proper VideoSample.copyTo() logic, fix decoder/encoder color space issues 2026-05-08 19:37:41 +02:00
Vanilagy fff09411e6 Fixed negative timestamps occurring with live media (fixes #364) 2026-05-07 11:11:37 +02:00
Vanilagy f5bd540863 Add the video portion of @mediabunny/server 2026-05-05 23:38:14 +02:00
Vanilagy 6d9fb30c29 Fix things that broke in the merge 2026-05-04 17:58:05 +02:00
Vanilagy 2e933ee5fc Merge branch 'main' into sample-resources 2026-05-04 17:23:45 +02:00
Vanilagy 47ad5c6806 Add BlobSourceOptions.useStreamReader (#179) 2026-05-04 14:20:21 +02:00