Commit Graph
148 Commits
Author SHA1 Message Date
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 633d1bc235 Increase test timeout 🙄 2026-05-12 13:18:11 +02:00
Vanilagy 060ceb8ed3 Fix tests some more 2026-05-12 00:43:08 +02:00
Vanilagy 5599e52a1a Fix async race condition in transparency code, reduce HEVC conversion duration 2026-05-12 00:24:03 +02:00
Vanilagy 4e5f894d7a Adjust tests for CI 2026-05-12 00:06:48 +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
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 fff69619ec Lint 2026-05-09 00:42:37 +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 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 782d3e134b Use edit lists to model non-zero start timestamps for regular MP4 (fixes #336); fix MP4 PCM logic breaking down with approximate packet timestamps 2026-04-30 10:32:42 +02:00
Vanilagy f3dec587fd Make FLAC encoder bit depth depend on input sample format, add sampleFormat audio transformation option, fix incorrect bitrate validation for FLAC (closes #357) 2026-04-29 16:27:20 +02:00
Vanilagy 0f6c374750 Ensure extensions work with huge timestamps, fix AC3 and AAC extension's behavior with huge timestamps 2026-04-27 20:58:05 +02:00
Vanilagy 9fdf263482 Merge branch 'main' into hls 2026-04-24 20:56:59 +02:00
Vanilagy 97f6b35cda Add special TXXX handling for ID3v2 2026-04-24 19:42:15 +02:00
Vanilagy 5ee78c6480 Add pssh box parsing and expose them in resolveKey 2026-04-24 19:01:25 +02:00
b05cdbe7e0 fix: two long-running HLS transcode issues (#355)
* fix: release targets from Output._targets on finalize

Long-running HLS transcodes leak memory. Every finalized BufferTarget
stays in _targets until the outer Output closes, pinning its buffer.
Writer.finalize() already does this cleanup for writer-based flows;
extend it to buffer-finalize paths via the public 'finalized' event.

* fix: ReadOrchestrator LRU eviction picks only drained workers

assert(pendingSlices.length === 0) fires under heavy concurrent reads
(e.g. multi-rendition HLS decode from BlobSource). LRU filter only
checked !running; workers with queued slices could be evicted.
Add pendingSlices.length === 0 to the filter.

* fix: export AppendOnlyStreamTarget from index

Missing from the re-export; public docs import it by name.

* fix: join HLS init segment path with root + playlist path

Init path went through _getTarget bare; segments got joined with rootPath + playlist.path. Playlist-relative URI then can't resolve when the playlist lives in a subdirectory.

* Fix targets not being cleaned up, fix paused workers with remaining pending slices, modify doc block, fixed isRoot not being changed on proxied requests

---------

Co-authored-by: Vanilagy <[email protected]>
2026-04-23 14:37:56 +02:00
Vanilagy 0524bb43eb I always forget it 2026-04-22 16:57:22 +02:00
Vanilagy 493ef50820 Add support for SAMPLE-AES and SAMPLE-AES-CTR decryption, add "Common Encryption" support to ISOBMFF demuxer, add InputFormatOptions, rewrite ISOBMFF track codec resolution 2026-04-22 16:54:49 +02:00
Vanilagy 5e8d0b25a0 Yes thank you 2026-04-21 15:14:20 +02:00
Vanilagy 3fc69490f5 Suppress range request warning for HLS-adjacent requests (closes #354) 2026-04-21 15:12:34 +02:00
Vanilagy 783cfa6fbe Add AppendOnlyStreamSource, adjust examples to use it 2026-04-21 14:58:33 +02:00
Vanilagy 2b3e5f45c6 Remove createInputFrom, changed meaning of PathedSource, add CustomPathedSource 2026-04-21 13:22:10 +02:00
77e70f9090 Add BufferTarget.onFinalize, OutputOptions.onFinalize, ConcurrentRunner (#349)
* Add BufferTarget.onFinalize option for awaitable async action on finalize

The `finalized` event fires synchronously and its return value is ignored,
making it unsuitable for use cases where the muxer should wait (e.g.
uploading the buffer to S3, R2, or other object stores that require a
known Content-Length and therefore can't stream via StreamTarget).

Adds a new `BufferTargetOptions` type with an `onFinalize` callback that
the muxer awaits before resolving. Matches the existing callback pattern
used by `HlsOutputFormatOptions.onSegment`, `onMaster`, etc.

When used with PathedTarget, this provides proper backpressure: the next
segment won't start being produced until the previous one has finished
uploading, keeping memory bounded regardless of video length.

- Adds `BufferTargetOptions` type, exported from the package root
- `BufferTarget` constructor now accepts optional options (backward compatible)
- `_finalize()` awaits `onFinalize` before emitting the `finalized` event
- Adds runtime validation for non-function callbacks
- Updates "Upload to a server" docs in writing-hls.md with S3 pattern
- Documents `onFinalize` in writing-media-files.md BufferTarget section
- Adds tests for callback invocation, async awaiting, backward compat, and validation

* Add ConcurrentRunner, add OutputOptions.onFinalize, adjust docs accordingly, clean up tests

* give me more control baby

* forgot to tell about it

* polish guide and js docs

* vanilagy says remove this, docs will reveal it

---------

Co-authored-by: Vanilagy <[email protected]>
2026-04-17 18:42:09 +02:00
Vanilagy 95e9dc5210 MORE CODE REVIEW 2026-04-16 18:27:51 +02:00
Vanilagy b85ecd3109 Code review fixes 2026-04-16 17:43:12 +02:00
Vanilagy 56b25fbdf8 Add onSegmentPopped, add more tests, improve validation, improve M3U8 grammar 2026-04-16 14:48:57 +02:00
Vanilagy f99adf2208 Optimize media tag codec parsing, add a test for it, extract tag strings into constants 2026-04-16 11:31:43 +02:00
Vanilagy 2d0aac3208 Fix HLS demuxer parsing bug, extract HLS mime type out, add TargetRequest.mimeType 2026-04-16 10:53:36 +02:00
Vanilagy 8241820a4f Remove unnecessary sync getters 2026-04-15 09:16:40 +02:00
Vanilagy d9f12c0c7a PLEASE BE FIXED 2026-04-14 21:49:15 +02:00
Vanilagy a3767af141 Fix HLS muxer audio segmentation bug, fix conversion tests failing in CI 2026-04-14 21:40:07 +02:00
Vanilagy 6410ea9f42 Make Conversion API copy input pairability graph by default, fix HLS muxer rotation bug, remove onfinalized callback 2026-04-14 21:14:58 +02:00
Vanilagy e8ba0544d1 Unexpected .only modifier 2026-04-14 16:29:19 +02:00
Vanilagy 2f576aa486 Add fan-out API to Conversion API, fix erroneous track count validation 2026-04-14 16:27:02 +02:00
Vanilagy c6e505a6fe Make default keyFrameInterval 2 seconds to align with default HLS segment duration 2026-04-13 17:47:48 +02:00
Vanilagy 2a2b6450c9 Add better doc blocks, special deprecated logic for API doc generation, add multi-tiered SegmentedInput hydration for reducing file request count, ditch VirtualInputFormat indirection 2026-04-13 17:25:46 +02:00
Vanilagy 051578c2ca Remove input track descriptors, add async getters on tracks for everything, deprecate old sync getters 2026-04-10 16:23:17 +02:00
Vanilagy aa810fc433 Fix SourceRef race conditions, fix "source" and "target" getter returning unused instances, add missing validation, make "getDurationFromMetadata" only exist on tracks, fix examples, expand media player to support live playback, change the signatures of some Input APIs 2026-04-10 13:38:14 +02:00
Vanilagy 0813bcab28 Add missing doc blocks for everything, add PathedTarget and PathedSource, few other changes & fixes 2026-04-09 15:22:45 +02:00
Vanilagy fdb5f4102f Add new createInputFrom helper function 2026-04-08 14:52:27 +02:00
Vanilagy bee1518100 Add TrackDescriptor concept 2026-04-08 12:21:08 +02:00
Vanilagy 3c0a6fc299 Fix failing tests, add missing license headers 2026-04-01 16:39:42 +02:00