Commit Graph
475 Commits
Author SHA1 Message Date
Vanilagy 93e9c256ab Maybe this helps a little 2026-03-11 16:28:44 +01:00
Vanilagy 05ae21e5ea Add EncodedPacketSink.getFirstKeyPacket() (used to fix #314) 2026-03-09 10:19:01 +01:00
Vanilagy 397c464846 Change comment 2026-03-06 16:12:30 +01:00
Vanilagy 2087658eea Add <video> element fallback case for MediaStreamVideoTrackSource, adding Firefox support 2026-03-06 16:11:59 +01:00
6a11a1302c Fix CTS=0 in fragmented fMP4 with multiple tracks (#317)
* Fix CTS=0 in fragmented fMP4 with multiple tracks

When muxing fragmented MP4 with both video and audio tracks,
compositionTimeOffset (CTS) was zero for all video samples, causing
B-frame content to display in decode order instead of presentation
order (visible judder).

Root cause: During finalize(), interleaveSamples(true) triggers
finalizeFragment() via the cross-track keyframe check in
addSampleToTrack. This writes the trun box before processTimestamps
has computed correct decodeTimestamp values, so CTS = PTS - DTS = 0.

Fix: Call processTimestamps() for all tracks at the start of
finalizeFragment(). This is safe because processTimestamps is a no-op
when the timestampProcessingQueue is empty.

Video-only fragmented muxing was unaffected because the single-track
case never triggers the cross-track keyframe check during
interleaveSamples.

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

* Fix the problem at the actual root

* Oopsie doopsie

---------

Co-authored-by: Claude Opus 4.6 <[email protected]>
Co-authored-by: Vanilagy <[email protected]>
2026-03-06 09:56:53 +00:00
Vanilagy f79834c3c1 Add frame rate-based sampling for MediaStreamVideoTrackSource, reducing the probability of files with wildly irregular FPS; add unthrottled timer primitives 2026-03-05 19:57:32 +01:00
Vanilagy a15283eaa3 Add @mediabunny/flac-encoder extension, clean up some other code, fix incorrect top-level tsconfig 2026-03-04 21:21:52 +01:00
Vanilagy c4398fb88c Add @mediabunny/aac-encoder extension package 2026-03-04 17:05:34 +01:00
152002bd5d fix(isobmff): write QuickTime-compliant MOV AAC sample entry (#311)
* fix(isobmff): write QuickTime-compliant MOV AAC sample entry

* Clean up logic, only version 1 sample description box was needed, remove bloaty tests

---------

Co-authored-by: Vanilagy <[email protected]>
2026-02-26 21:48:11 +01:00
Vanilagy bb4749cd8d Add support for reading/writing non-square pixel video frames (fixes #309) 2026-02-25 17:16:33 +01:00
31147d6e96 fix: surface StreamTarget write errors instead of swallowing them (#305)
* fix: await StreamTarget writes to prevent overlapping OPFS operations

* no need for flush

* preserve fire and forget writes

* Remove pendingWrites, add missing mutex acquire to ADTS muxer finalize method

---------

Co-authored-by: Vanilagy <[email protected]>
2026-02-24 11:21:13 +00:00
Vanilagy ddc826e6e3 MPEG-TS muxer: Write out DTS for video tracks (fixes buggy QuickTime behavior) 2026-02-16 15:30:23 +01:00
2876197631 Fix WaveDemuxer reading too far in corrupted ID3 chunk (#301)
* Update read-mp4.test.ts

* Fix the bug

* Delete read-wav.test.ts

* Submit test file

* Small adjustments

---------

Co-authored-by: Vanilagy <[email protected]>
2026-02-16 10:48:07 +00:00
Vanilagy a97200f3f0 Add @mediabunny/ac3 extension package 2026-02-12 18:31:59 +01:00
Vanilagy 7cc26edacb Add Mediabunny Codec Registry 2026-02-12 11:56:37 +01:00
Vanilagy 4fae45ec40 Allow negative trim ranges for conversion, add OutputFormat.supportsTimestampedMediaData 2026-02-11 15:56:51 +01:00
417c85d8ed feat(codec): add detection support for AC-3, E-AC-3 audio codecs (#275)
* ac3/eac3 detection

* fix tests

* review pass + follow codebase comments style

* Add ac3/eac3 to docs

* WIP mpeg-2

* Set registration_descriptor

* add support for ac3 system b in mpeg-ts

* Update docs with ac3 in .ts support

* fix formatting

* Remove default to fix linter

* Add eac3 to mpeg-ts

* fix formatting

* Fix failing test

* Refactor AC3/EAC3 code a little

---------

Co-authored-by: Vanilagy <[email protected]>
2026-02-11 15:23:12 +01:00
Vanilagy cacbc2a399 Fix assertion failure 2026-02-07 10:35:40 +01:00
Vanilagy ab0fd6a8d8 Fix WAVE demuxer out of bounds reads 2026-02-07 10:28:14 +01:00
David P.andGitHub 43c1ea7efd Merge pull request #292 from fredrikj/parallelism
Add UrlSourceOptions.parallelism
2026-02-03 16:03:55 +01:00
Vanilagy cab92c55ec Fix a few things 2026-02-03 16:01:46 +01:00
Vanilagy 81bc9d7c44 Fix MP3 files with initial XING frame not being properly recognized (fixes #294) 2026-02-03 15:53:51 +01:00
Fredrik Johansson 3209363470 Add UrlSourceOptions.parallelism 2026-01-29 09:31:51 +01:00
Vanilagy d16b1927ad Conversion: compute duration using only the utilized tracks 2026-01-27 15:54:20 +01:00
Vanilagy 7aa0fa465e Add support for ID3 metadata in ADTS, make MPEG-TS demuxer more resilient 2026-01-27 14:32:16 +01:00
Vanilagy cc5f7d8e8f Fixed incorrect segment logic in MPEG-TS metadata extraction, remove unused code, make packetization not require a track backing 2026-01-23 18:05:32 +01:00
Vanilagy 8c67872e83 Add double loading detection and warning, improve UrlSource abort signal documentation, bump minor 2026-01-23 13:31:59 +01:00
Vanilagy b63db955f6 Merge branch 'main' of https://github.com/Vanilagy/mediabunny 2026-01-23 13:16:41 +01:00
Vanilagy 92454b28f7 Use random_access_indicator for key packet detection, rewrite packet lookup algorithm to use a chunked approach to perform better over the network 2026-01-23 13:16:41 +01:00
Vanilagy db3cb143fe Sure thing ts-doc 2026-01-22 09:43:20 +01:00
Vanilagy e20f779ede Add InputTrack.number 2026-01-22 09:18:43 +01:00
Vanilagy 79f19b6717 Fix MPEG-TS demuxer reading entire file in the metadata phase, optimize it a bit, bump patch 2026-01-20 20:08:17 +01:00
Vanilagy 98387258a4 Add unhandled throws 2026-01-20 08:49:49 +01:00
Vanilagy ab3a514884 Cmon 2026-01-19 15:04:39 +01:00
Vanilagy dbaaea255c Expand packet.clone(), make conversion start timestamp default to the input's start timestamp 2026-01-19 14:04:20 +01:00
Vanilagy d23b0369f3 Fix side data not being copied when calling EncodedPacket.clone 2026-01-19 13:32:47 +01:00
Vanilagy 6c78a0ff09 Fix HEVC not being encodable in CI 2026-01-19 10:25:57 +01:00
Vanilagy c3a3eb6abf Merge remote-tracking branch 'origin/main' into mpeg-ts 2026-01-16 21:04:14 +01:00
Vanilagy 58053ed00c Bruh 2026-01-16 20:53:40 +01:00
Vanilagy 53b04619e1 Convert ADTS to AAC in muxers that accept it 2026-01-16 17:27:50 +01:00
Vanilagy 7e8f9fbbb1 It's 2026 2026-01-16 17:02:12 +01:00
Vanilagy 41e012f1e8 Fix typecheck, lint and build 2026-01-16 17:00:01 +01:00
Vanilagy 282751ec1c Set discontinuity_indicator to 1 for the first packet 2026-01-16 16:56:50 +01:00
Vanilagy e8b27768a9 Add MPEG-TS muxer, fix a demuxer bug, remove Infinity from output format track counts 2026-01-16 16:33:28 +01:00
Vanilagy ae37973878 MPEG-TS demuxer optimizations: faster Annex B segmentation, better NALU iteration 2026-01-16 13:26:58 +01:00
Vanilagy e3ee9d91a9 Add MP3 support to MPEG-TS demuxer 2026-01-16 10:28:00 +01:00
Vanilagy c0f2693cb3 Add HEVC support to MPEG-TS demuxer 2026-01-16 10:05:40 +01:00
Vanilagy d8d6ccc1f7 Update internalCodecId docs 2026-01-15 16:46:13 +01:00
Vanilagy dc25b5d7c5 No metadata for now 2026-01-15 16:44:22 +01:00
Vanilagy 54dfa75a7e Add proper packet duration extraction to MPEG-TS demuxer 2026-01-15 16:33:17 +01:00