Commit Graph
177 Commits
Author SHA1 Message Date
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 84dec01dfd Add pause and resume methods to MediaStreamTrack sources (closes #241) 2025-12-11 15:51:18 +01:00
Vanilagy cc649ba192 Add allowRotationMetadata video conversion option (see #247) 2025-12-11 14:41:00 +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 5b703a1c78 Fix MP3 encoder emitting incorrect timestamps, fixed overaggressive audio sample gap filling (fixes #233) 2025-12-05 12:41:36 +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 e33e9f13fe Fix missing VideoSample.close() calls in CanvasSink conversion path 2025-11-12 10:05:41 +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 71dd2c565b Merge branch 'main' of https://github.com/Vanilagy/metamuxer 2025-11-11 11:05:17 +01:00
Vanilagy 3db4aa8b91 Fixed doubly stacked rotation correction when converting rotated video with a custom process function (fixes #218) 2025-11-11 11:05:15 +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 e880f54553 Add custom processing to Conversion API 2025-10-17 14:52:13 +02: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 a1008b8088 Fix invalid crop region for rotated video samples (fixes #151) 2025-09-26 16:31:24 +02:00
Vanilagy be151d3494 Add isValid field to Conversion if output track counts haven't been reached, improve error messages to be more clear (closes #148) 2025-09-26 13:11:35 +02:00
Vanilagy 1b8e4f9f4b Add alpha option to Conversion API 2025-09-26 11:12:48 +02:00
Vanilagy 728c8cd928 Bump minor version 2025-09-25 15:11:48 +02:00
Vanilagy 3f03eb8fbb Small adjustments 2025-09-25 14:49:09 +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
d426d36386 FLAC container support (#95)
* add a test

* recognize as input format

* scaffold flac demuxer

* implement getting metadata

* Implement mime type

* read all metadata + deduplicate stubs

* Read first packet

* copyright headers

* read the first packet

* Get entire first packet, work on advancing

* iterate over all samples

* testable with bun

* stub out metadata support

* parse descriptive metadata

* All in 1 file

seems more appropriate to the philosophy

* some parameters are not needed anymore all within 1 class

* skip over bytes we are sure are not the syncword

* run prettier

* timestamp is determined based on passed blocks, not maximumBlockSize

* no binary search needed!

* simplifications

* Finish demuxer reading sequentially

* more tests + add a file with a seektable

* don't throw if (this.audioInfo.minimumBlockSize !== this.audioInfo.maximumBlockSize

* Add docs

* Update format compatibility table

* Simplification

* confirm conversion is working

* Finish

* Resolve TODO comment

* Support images (read-only)

* Returning description as Uint8Array

* Cleanup of demuxer

* Misc renames

* Object on same line

* Resolve first batch of comments

* Throw errors on corrupt blocks, correctly use requestSlice()

* Fix description field

* Explain why last frame is a bit shorter

* Add FLAC to README

* Put track backings below demuxer

* convert to methods

* Reorder container checking

* getBlockSize() -> readBlockSize()

* bitStream -> bitstream

* better naming for bytes

* use .skip()

* Don't return blockSize twice in readFlacFrameHeader

* Use enum + switch to distinguish Flac block types

* Use else-if

* Use else-if

* Compressed switch statement

* readCodedNumber

* Update flac-misc.ts

* We don't need the bits variable at all

* reorder functions in flac-demuxer

* Handle gracefully not being able to load another sample

* Update flac-demuxer.ts

* blockingbit null

* use async instead of promise.resolve

* use binary search

* Replace recursion with while loop

* Add mutex to getPacket()

* Load more data not in getPacketAtIndex, but outside

* Apply suggestion from @Vanilagy

Co-authored-by: David P. <[email protected]>

* computeDuration() reads last packet

* Update flac-demuxer.ts

* share vorbis comment reading logic

* reuse vorbis comment writing logic, set vendor always to "Mediabunny"

* flush after writign

* Use FileSlice.tempFromBytes

* assert !== null

* fixing nitpicks

* apply suggestions

* fix ogg

* We are now muxing images

* apply suggestion

* Update src/flac/flac-muxer.ts

Co-authored-by: David P. <[email protected]>

* apply suggestion

* readSampleRate()

* seek outside writeHeader()

* mention vorbis metadata +  add to metadatatags comment

* should be able to -> can

* Add test in metadata tags

* Add test for packets being byte identical after remuxing

* compare to null

* no casting to uint8array

* make test pass

* Update flac-muxer.ts

* Call validateAudioChunkMetadata() and validateAndNormalizeTimestamp()

* `onFrame` option

* emit frames using onFrame

* Run prettier over files

* Fix FLAC PICTURE block logic, small other changes

* Update docs

* Remove .only modifier

* fix remuxing and add test

* Don't throw error if parsing fails in header, since hitting a syncword might just be coincidential

* Fix remaining type errors

---------

Co-authored-by: David P. <[email protected]>
2025-09-18 21:05:09 +02:00
Vanilagy 407dd05953 Make Matroska block decoding lazy 2025-09-18 10:00:03 +02:00
Vanilagy 6d5bd58ae8 Add support for header removal content compression in Matroska 2025-09-17 23:09:04 +02:00
Vanilagy c5523516c7 Add fastStart: 'reserve' option (closes #119) 2025-09-17 12:26:24 +02:00
Vanilagy 530ccd7523 Drag 0-duration VideoFrame duration to null (fixes #116) 2025-09-16 15:50:14 +02:00
Vanilagy fcec67645a Allow object for tags field in conversion 2025-09-16 15:10:16 +02:00
Vanilagy eba1f360d5 Clean up cropping logic 2025-09-12 16:48:35 +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 b58476b1b0 Renaming 2025-09-05 18:59:13 +02:00
Vanilagy dd7804e5ab Add metadata read/write support for WAVE 2025-09-05 16:31:26 +02:00
Vanilagy d3a030c307 Add metadata read/write support for Ogg 2025-09-05 15:39:29 +02:00
Vanilagy 6d32de0fb1 Add metadata read/write support for Matroska 2025-09-05 13:41:09 +02:00
Vanilagy efa933863d Add metadata read/write support to ISOBMFF, add more metadata fields, add raw metadata support 2025-09-04 21:28:23 +02:00
Vanilagy 034a7254d2 Merge branch 'main' into metadata 2025-09-03 21:12:16 +02:00