Commit Graph
91 Commits
Author SHA1 Message Date
Vanilagy 35e16ca23e Fix incorrect GOP timestamp verification logic for first GOP (fixes #321) 2026-03-13 10:45:34 +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 bb4749cd8d Add support for reading/writing non-square pixel video frames (fixes #309) 2026-02-25 17:16:33 +01:00
Vanilagy a97200f3f0 Add @mediabunny/ac3 extension package 2026-02-12 18:31:59 +01:00
Vanilagy 6c78a0ff09 Fix HEVC not being encodable in CI 2026-01-19 10:25:57 +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 c0f2693cb3 Add HEVC support to MPEG-TS demuxer 2026-01-16 10:05:40 +01:00
Vanilagy 54dfa75a7e Add proper packet duration extraction to MPEG-TS demuxer 2026-01-15 16:33:17 +01:00
Vanilagy 0719a17c85 Add mutex to packet lookup algorithm, fix incorrect next packet retrieval following packet lookup 2026-01-14 21:53:23 +01:00
Vanilagy f363fe50e2 WIP 2026-01-05 11:41:32 +01:00
Vanilagy d6c223b0f6 Fix keyframe sample index lookup logic for ISOBMFF in rare B-frame scenarios 2025-12-05 22:14:23 +01:00
Vanilagy 3620b04caf Fix incomplete AV1 sequence header OBU parsing, fix missing saample close() calls in audio resampling path, add error logging when open samples are GC'd, bump patch 2025-12-04 09:58:12 +01:00
Vanilagy 217b383f12 Add read/write support for track disposition information 2025-11-13 11:00:42 +01:00
Vanilagy 02b08e036b Fix Matroska files where no audio packets are key packets (fixes #192) 2025-11-12 16:07:17 +01:00
Vanilagy 12216ae29e Remove reordering Matroska blocks by references (fixes #178) 2025-11-12 10:49:47 +01:00
Vanilagy 23f814679e Modify audio encoder to fill gaps between timestamps with silence to ensure AV sync (fixes #176) 2025-11-11 18:03:28 +01:00
Vanilagy 8b39eb0d43 Revert Matroska default duration flooring 2025-11-10 21:14:43 +01:00
Vanilagy c0da28fb6c Floor Matroska default packet duration (fixes #170) 2025-11-10 16:14:25 +01:00
Vanilagy 5039c730bf Fix MediaStreamTracks not being stopped inside of the worker (fixes #204) 2025-11-02 13:00:38 +01:00
Vanilagy 198928088b Make cluster/fragment lookup operations almost stateless, fix high Matroska memory, allow more maxCacheSizes 2025-09-29 20:36:37 +02:00
Vanilagy 537119357d Add strict slice range validation, fix RF64 reading error (fixes #146) 2025-09-25 10:26:44 +02:00
David P.andGitHub fa4e064345 Transparent video read/write support (#145)
* Add support for reading transparent Matroska and implement alpha side data & decode

* Few fixes

* Implement alpha encoding

* Gracefully handle inability to acquire WebGL context, properly clean up WebGL contexts

* Improve touch device detection

* Test test

* Test test #2

* Test test 3

* Test test 4

* Test test 5

* Test test 6

* Test test 7

* Test test 8

* Test test 9

* Test test 10

* Test test 11

* Test test 12

* Test test 13

* Test test 14

* Test test 15

* Test test 16

* Test test 17

* Test test 18

* Test test 19

* Test test 20

* Fix type errors, improve MetadataTags docs

* Do a bunch of docs work

* Test test?

* "Unexpected only modifier 🤓"

* Add InputVideoTrack.canBeTransparent()

* Some clean-up

* Adjust CI to be less spammy in PRs

* Fix broken license headers
2025-09-24 21:20:14 +02:00
Vanilagy 608c769a7e Add explicit disposability to Inputs (#126) 2025-09-21 20:18:59 +02:00
Vanilagy a3f4f7f4f7 Allow all Matroska AttachedFiles to be read & written via metadata tags 2025-09-19 20:12:29 +02:00
Vanilagy eb1ce86187 Fix faulty MP3 bitrate and frame size calculation (fixes #134) 2025-09-19 13:20:36 +02:00
420423bc0f feat: Add support for custom MP4 metadata with mdta format (#132)
* feat: Add support for custom MP4 metadata with mdta format

- Add metadataFormat option ('mdir' | 'mdta') to IsobmffOutputFormatOptions
- Implement complete mdta format with keys box generation
- Enable custom metadata fields readable by ffmpeg/ffprobe
- Maintain backward compatibility with default mdir format

* Refactor ISOBMFF metadata tag writing logic

* Autism

---------

Co-authored-by: tanfu <[email protected]>
Co-authored-by: Vanilagy <[email protected]>
2025-09-18 23:41:08 +02:00
Vanilagy 6d5bd58ae8 Add support for header removal content compression in Matroska 2025-09-17 23:09:04 +02:00
Vanilagy fcec67645a Allow object for tags field in conversion 2025-09-16 15:10:16 +02:00
Vanilagy 6f06631355 Use decoder information for resampler sample rate, fix Opus sample rate to 48 kHz everywhere 2025-09-10 23:03:20 +02:00
Vanilagy b9f7ab2fa2 Skip HEVC RASL slices following a decoder reset 2025-09-09 13:09:41 +02:00
Vanilagy f3613b7260 Fix null sample in encoder support checking logic in Conversion API (#90) 2025-09-06 12:00:46 +02:00
Vanilagy bd99d8f28f Add metadata tests, fix a few bugs 2025-09-05 21:42:26 +02:00
Vanilagy 034a7254d2 Merge branch 'main' into metadata 2025-09-03 21:12:16 +02:00
Vanilagy ef95960e13 Add support for unsized sources, add ReadableStreamSource, fix WAVE packet lookup 2025-09-02 16:39:38 +02:00
Vanilagy 641cdd02e3 Add new slice-based reader system, port all demuxers to new reader system, add optimized BlobSource 2025-08-28 17:24:31 +02:00
Vanilagy fb0c41aa09 Implement MP3 metadata (ID3v1/2) read & write 2025-08-25 17:43:40 +02:00
Vanilagy 803e58a0d2 Add internalCodecId field 2025-08-23 16:24:36 +02:00
Vanilagy bb1b20afa7 Add track name support 2025-08-23 15:33:44 +02:00
Vanilagy 2d62395fc0 Fix faulty faulty lookup table logic (addresses #70) 2025-08-22 14:20:57 +02:00
Vanilagy bb9554df60 Handle ISOBMFF boxes with no size 2025-08-20 15:12:25 +02:00
Vanilagy f4b97c1731 Make mfra box lookup more resilient 2025-08-20 14:33:26 +02:00
Vanilagy 5782219941 Add Matroska resync logic for malformed files, add RVE sponsor 2025-08-20 13:38:54 +02:00
Vanilagy e0a4169bf8 Handle missing starting key sample in ISOBMFF 2025-08-12 09:29:57 +02:00
Vanilagy 1492fd5c6f Add workaround for Chromium range request caching bug 2025-08-11 18:14:02 +02:00
Vanilagy 47c955524f Rework MP3 reading pattern 2025-08-11 02:50:13 +02:00
Vanilagy 56ae97f994 Fix decoded frame timestamps (#49) 2025-08-10 19:26:41 +02:00
Vanilagy cbb2681d33 Create @mediabunny/mp3-encoder, restructure and extend build system 2025-08-10 00:45:30 +02:00
Vanilagy 597b68b299 Add support for Matroska lacing, fix packet lookup logic 2025-08-08 17:10:03 +02:00